From e2e5000c329fb4a4882f4808b3eb2db1a64176b9 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Thu, 22 Jun 2017 21:00:25 -0700 Subject: [PATCH 1/8] Add wxTIFFHandler documentation, and start of wxGIFHandler's documentation. --- interface/wx/imaggif.h | 55 +++++++++++++++++++++++++++++++++++++++++ interface/wx/imagtiff.h | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 interface/wx/imaggif.h create mode 100644 interface/wx/imagtiff.h diff --git a/interface/wx/imaggif.h b/interface/wx/imaggif.h new file mode 100644 index 0000000000..c23c218d5b --- /dev/null +++ b/interface/wx/imaggif.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imaggif.h +// Purpose: interface of wxGIFHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +#define wxIMAGE_OPTION_GIF_COMMENT wxT("GifComment") + +/** + @class wxGIFHandler + + This is the image handler for the GIF format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxGIFHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxGIFHandler + */ + wxGIFHandler(); + + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose = true, + int index = -1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + + /** + Save the animated gif. + + @param images + The image array object which is to be affected by this operation. + @param stream + Opened output stream for writing the data. + @param verbose + If set to @true, errors reported by the image handler will produce wxLogMessages + + @return @true if the operation was successful, @false otherwise + */ + bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, + bool verbose = true, int delayMilliSecs = 1000); + +protected: + virtual int DoGetImageCount(wxInputStream& stream); + virtual bool DoCanRead(wxInputStream& stream); + + bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, + bool first, int delayMilliSecs, bool loop, + const wxRGB *pal, int palCount, + int mask_index); +}; \ No newline at end of file diff --git a/interface/wx/imagtiff.h b/interface/wx/imagtiff.h new file mode 100644 index 0000000000..409249dc4f --- /dev/null +++ b/interface/wx/imagtiff.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagtiff.h +// Purpose: interface of wxTIFFHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE wxString("BitsPerSample") +#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL wxString("SamplesPerPixel") +#define wxIMAGE_OPTION_TIFF_COMPRESSION wxString("Compression") +#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString("Photometric") +#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString("ImageDescriptor") + + +// todo: confirm library and category, and generate some real body documentation +/** + @class wxTIFFHandler + + This is the image handler for the TIFF format. + + @library{wxcore} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxTIFFHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxTIFFHandler + */ + wxTIFFHandler(); + + /** + Retrieve the version information about the TIFF library used by this + handler. + + @since 2.9.2 + */ + static wxVersionInfo GetLibraryVersionInfo(); + + // let the parent class' (wxImageHandler) documentation through for these methods + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + +protected: + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + virtual int DoGetImageCount(wxInputStream& stream); + virutal bool DoCanRead(wxInputStream& stream); +}; + From f1362c78a1bc40382d0a929707d46bd30031d0e9 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Fri, 23 Jun 2017 18:25:25 -0700 Subject: [PATCH 2/8] Complete transfer of usable method declarations in imaggif.h and fix a typo in imagtiff.h --- interface/wx/imaggif.h | 9 +++++++++ interface/wx/imagtiff.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/interface/wx/imaggif.h b/interface/wx/imaggif.h index c23c218d5b..7e04c604a2 100644 --- a/interface/wx/imaggif.h +++ b/interface/wx/imaggif.h @@ -45,11 +45,20 @@ public: bool verbose = true, int delayMilliSecs = 1000); protected: + // allow parent class documentation to overwrite. virtual int DoGetImageCount(wxInputStream& stream); virtual bool DoCanRead(wxInputStream& stream); + // TODO: document these as necessary bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, bool first, int delayMilliSecs, bool loop, const wxRGB *pal, int palCount, int mask_index); + bool InitHashTable(); + void ClearHashTable(); + void InsertHashTable(unsigned long key, int code); + int ExistsHashTable(unsigned long key); + bool CompressOutput(wxOutputStream *, int code); + bool SetupCompress(wxOutputStream *, int bpp); + bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen); }; \ No newline at end of file diff --git a/interface/wx/imagtiff.h b/interface/wx/imagtiff.h index 409249dc4f..193e6e4035 100644 --- a/interface/wx/imagtiff.h +++ b/interface/wx/imagtiff.h @@ -45,6 +45,6 @@ public: protected: virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); virtual int DoGetImageCount(wxInputStream& stream); - virutal bool DoCanRead(wxInputStream& stream); + virtual bool DoCanRead(wxInputStream& stream); }; From 148be09ede34b08081da4102df14733e4cbc7243 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Fri, 23 Jun 2017 18:33:10 -0700 Subject: [PATCH 3/8] Add wxPNGHandler to interface. --- interface/wx/imagpng.h | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 interface/wx/imagpng.h diff --git a/interface/wx/imagpng.h b/interface/wx/imagpng.h new file mode 100644 index 0000000000..b4e6e70eaf --- /dev/null +++ b/interface/wx/imagpng.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagpng.h +// Purpose: interface of wxPNGHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +#define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") +#define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") +#define wxIMAGE_OPTION_PNG_FILTER wxT("PngF") +#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL") +#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM") +#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") +#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") + + +enum +{ + wxPNG_TYPE_COLOUR = 0, + wxPNG_TYPE_GREY = 2, + wxPNG_TYPE_GREY_RED = 3, + wxPNG_TYPE_PALETTE = 4 +}; + +/** + @class wxPNGHandler + + This is the image handler for the PNG format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxPNGHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxPNGHandler + */ + wxPNGHandler(); + + // let parent class's documentation through. + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + +protected: + virtual bool DoCanRead( wxInputStream& stream ); +}; \ No newline at end of file From 2fd999f81ee39cf0a5579f54418e651937ddec1a Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Fri, 23 Jun 2017 18:47:43 -0700 Subject: [PATCH 4/8] Remove wxPNG_TYPE* enums from interface/wx/imagpng.h --- interface/wx/imagpng.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/wx/imagpng.h b/interface/wx/imagpng.h index b4e6e70eaf..789732cf02 100644 --- a/interface/wx/imagpng.h +++ b/interface/wx/imagpng.h @@ -13,7 +13,9 @@ #define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") #define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") - +/* These are already in interface/wx/image.h + They were likely put there as a stopgap, but they've been there long enough + that that location trumps moving them here. enum { wxPNG_TYPE_COLOUR = 0, @@ -21,6 +23,7 @@ enum wxPNG_TYPE_GREY_RED = 3, wxPNG_TYPE_PALETTE = 4 }; +*/ /** @class wxPNGHandler From cd203ca2fd5b1ffbdaa381726fbd85b8f60dd71a Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sat, 24 Jun 2017 11:00:56 -0700 Subject: [PATCH 5/8] Document remaining image handlers --- interface/wx/imagiff.h | 31 +++++++++++++++++++++++++++++++ interface/wx/imagjpeg.h | 40 ++++++++++++++++++++++++++++++++++++++++ interface/wx/imagpcx.h | 32 ++++++++++++++++++++++++++++++++ interface/wx/imagpnm.h | 32 ++++++++++++++++++++++++++++++++ interface/wx/imagtga.h | 32 ++++++++++++++++++++++++++++++++ interface/wx/imagxpm.h | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 199 insertions(+) create mode 100644 interface/wx/imagiff.h create mode 100644 interface/wx/imagjpeg.h create mode 100644 interface/wx/imagpcx.h create mode 100644 interface/wx/imagpnm.h create mode 100644 interface/wx/imagtga.h create mode 100644 interface/wx/imagxpm.h diff --git a/interface/wx/imagiff.h b/interface/wx/imagiff.h new file mode 100644 index 0000000000..c96b5649a1 --- /dev/null +++ b/interface/wx/imagiff.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagiff.h +// Purpose: interface of wxIFFHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxIFFHandler + + This is the image handler for the IFF format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxIFFHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxIFFHandler + */ + wxIFFHandler(); + + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file diff --git a/interface/wx/imagjpeg.h b/interface/wx/imagjpeg.h new file mode 100644 index 0000000000..0d727e4b7e --- /dev/null +++ b/interface/wx/imagjpeg.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagjpeg.h +// Purpose: interface of wxJPEGHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxJPEGHandler + + This is the image handler for the JPEG format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxJPEGHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxJPEGHandler + */ + wxJPEGHandler(); + + /** + Retrieve the version information about the JPEG library used by this + handler. + + @since 2.9.2 + */ + static wxVersionInfo GetLibraryVersionInfo(); + + // allow the parent class's documentation through. + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file diff --git a/interface/wx/imagpcx.h b/interface/wx/imagpcx.h new file mode 100644 index 0000000000..ebd1736742 --- /dev/null +++ b/interface/wx/imagpcx.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagpcx.h +// Purpose: interface of wxPCXHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxPCXHandler + + This is the image handler for the PCX format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxPCXHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxPCXHandler + */ + wxPCXHandler(); + + // allow the parent class's documentation through. + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file diff --git a/interface/wx/imagpnm.h b/interface/wx/imagpnm.h new file mode 100644 index 0000000000..8c28a87efd --- /dev/null +++ b/interface/wx/imagpnm.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagpnm.h +// Purpose: interface of wxPNMHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxPNMHandler + + This is the image handler for the PNM format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxPNMHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxPNMHandler + */ + wxPNMHandler(); + + // allow the parent class's documentation through. + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file diff --git a/interface/wx/imagtga.h b/interface/wx/imagtga.h new file mode 100644 index 0000000000..cef1392532 --- /dev/null +++ b/interface/wx/imagtga.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagtga.h +// Purpose: interface of wxTGAHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxTGAHandler + + This is the image handler for the TGA format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxTGAHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxTGAHandler + */ + wxTGAHandler(); + + // allow the parent class's documentation through. + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file diff --git a/interface/wx/imagxpm.h b/interface/wx/imagxpm.h new file mode 100644 index 0000000000..03e6b5fc3c --- /dev/null +++ b/interface/wx/imagxpm.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imagxpm.h +// Purpose: interface of wxXPMHandler +// Author: Samuel Dunn +// Licence: wxWindows licence +//////////////////////////////////////////////////////////////////////////// + +/** + @class wxXPMHandler + + This is the image handler for the XPM format. + + @library{core} + @category{gdi} + + @see wxImage, wxImageHandler, wxInitAllImageHandlers() +*/ +class wxXPMHandler : public wxImageHandler +{ +public: + /** + Default constructor for wxXPMHandler + */ + wxXPMHandler(); + + // allow the parent class's documentation through. + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + +protected: + virtual bool DoCanRead(wxInputStream& stream); +}; \ No newline at end of file From 565bf4d155e5b28212d500e6af527f3c41267635 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sun, 25 Jun 2017 14:06:47 -0700 Subject: [PATCH 6/8] Document SaveAnimation, remove documentation for remaining methods They've been deemed implementation details --- interface/wx/imaggif.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/interface/wx/imaggif.h b/interface/wx/imaggif.h index 7e04c604a2..19989f1420 100644 --- a/interface/wx/imaggif.h +++ b/interface/wx/imaggif.h @@ -38,6 +38,9 @@ public: Opened output stream for writing the data. @param verbose If set to @true, errors reported by the image handler will produce wxLogMessages + @param delayMilliSecs + How long, in milliseconds, to wait between each frame. + @return @true if the operation was successful, @false otherwise */ @@ -48,17 +51,4 @@ protected: // allow parent class documentation to overwrite. virtual int DoGetImageCount(wxInputStream& stream); virtual bool DoCanRead(wxInputStream& stream); - - // TODO: document these as necessary - bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, - bool first, int delayMilliSecs, bool loop, - const wxRGB *pal, int palCount, - int mask_index); - bool InitHashTable(); - void ClearHashTable(); - void InsertHashTable(unsigned long key, int code); - int ExistsHashTable(unsigned long key); - bool CompressOutput(wxOutputStream *, int code); - bool SetupCompress(wxOutputStream *, int bpp); - bool CompressLine(wxOutputStream *, const wxUint8 *line, int lineLen); }; \ No newline at end of file From cb91584c11da38f21b2d7bf1cea0539a3e5a4532 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sun, 25 Jun 2017 14:21:40 -0700 Subject: [PATCH 7/8] Tidying up. --- interface/wx/imagiff.h | 2 +- interface/wx/imagjpeg.h | 2 +- interface/wx/imagpcx.h | 2 +- interface/wx/imagpng.h | 2 +- interface/wx/imagpnm.h | 2 +- interface/wx/imagtga.h | 2 +- interface/wx/imagtiff.h | 2 -- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/interface/wx/imagiff.h b/interface/wx/imagiff.h index c96b5649a1..128b05935c 100644 --- a/interface/wx/imagiff.h +++ b/interface/wx/imagiff.h @@ -28,4 +28,4 @@ public: protected: virtual bool DoCanRead(wxInputStream& stream); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagjpeg.h b/interface/wx/imagjpeg.h index 0d727e4b7e..3cbd9b2ef8 100644 --- a/interface/wx/imagjpeg.h +++ b/interface/wx/imagjpeg.h @@ -37,4 +37,4 @@ public: protected: virtual bool DoCanRead(wxInputStream& stream); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagpcx.h b/interface/wx/imagpcx.h index ebd1736742..4872dad801 100644 --- a/interface/wx/imagpcx.h +++ b/interface/wx/imagpcx.h @@ -29,4 +29,4 @@ public: protected: virtual bool DoCanRead(wxInputStream& stream); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagpng.h b/interface/wx/imagpng.h index 789732cf02..a87febf1a4 100644 --- a/interface/wx/imagpng.h +++ b/interface/wx/imagpng.h @@ -49,4 +49,4 @@ public: protected: virtual bool DoCanRead( wxInputStream& stream ); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagpnm.h b/interface/wx/imagpnm.h index 8c28a87efd..01f923b59b 100644 --- a/interface/wx/imagpnm.h +++ b/interface/wx/imagpnm.h @@ -29,4 +29,4 @@ public: protected: virtual bool DoCanRead(wxInputStream& stream); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagtga.h b/interface/wx/imagtga.h index cef1392532..b5c2682861 100644 --- a/interface/wx/imagtga.h +++ b/interface/wx/imagtga.h @@ -29,4 +29,4 @@ public: protected: virtual bool DoCanRead(wxInputStream& stream); -}; \ No newline at end of file +}; diff --git a/interface/wx/imagtiff.h b/interface/wx/imagtiff.h index 193e6e4035..260c0ea1de 100644 --- a/interface/wx/imagtiff.h +++ b/interface/wx/imagtiff.h @@ -11,8 +11,6 @@ #define wxIMAGE_OPTION_TIFF_PHOTOMETRIC wxString("Photometric") #define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR wxString("ImageDescriptor") - -// todo: confirm library and category, and generate some real body documentation /** @class wxTIFFHandler From 8f7f623dd1c2d299b6cf01520f0a5c1247d8e3c1 Mon Sep 17 00:00:00 2001 From: Samuel Dunn Date: Sun, 25 Jun 2017 15:05:31 -0700 Subject: [PATCH 8/8] Change return statement to be consistent with parent class's SaveFile --- interface/wx/imaggif.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/wx/imaggif.h b/interface/wx/imaggif.h index 19989f1420..0fa8b0257a 100644 --- a/interface/wx/imaggif.h +++ b/interface/wx/imaggif.h @@ -42,7 +42,8 @@ public: How long, in milliseconds, to wait between each frame. - @return @true if the operation was successful, @false otherwise + @return @true if the operation succeeded, @false otherwise. + */ bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, bool verbose = true, int delayMilliSecs = 1000);