| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: imagpng.h |
| 3 | // Purpose: wxImage PNG handler |
| 4 | // Author: Robert Roebling |
| 5 | // RCS-ID: $Id$ |
| 6 | // Copyright: (c) Robert Roebling |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef _WX_IMAGPNG_H_ |
| 11 | #define _WX_IMAGPNG_H_ |
| 12 | |
| 13 | #include "wx/defs.h" |
| 14 | |
| 15 | //----------------------------------------------------------------------------- |
| 16 | // wxPNGHandler |
| 17 | //----------------------------------------------------------------------------- |
| 18 | |
| 19 | #if wxUSE_LIBPNG |
| 20 | |
| 21 | #include "wx/image.h" |
| 22 | |
| 23 | #define wxIMAGE_OPTION_PNG_FORMAT wxT("PngFormat") |
| 24 | #define wxIMAGE_OPTION_PNG_BITDEPTH wxT("PngBitDepth") |
| 25 | #define wxIMAGE_OPTION_PNG_FILTER wxT("PngF") |
| 26 | #define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL wxT("PngZL") |
| 27 | #define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL wxT("PngZM") |
| 28 | #define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY wxT("PngZS") |
| 29 | #define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE wxT("PngZB") |
| 30 | |
| 31 | enum |
| 32 | { |
| 33 | wxPNG_TYPE_COLOUR = 0, |
| 34 | wxPNG_TYPE_GREY = 2, |
| 35 | wxPNG_TYPE_GREY_RED = 3 |
| 36 | }; |
| 37 | |
| 38 | class WXDLLIMPEXP_CORE wxPNGHandler: public wxImageHandler |
| 39 | { |
| 40 | public: |
| 41 | inline wxPNGHandler() |
| 42 | { |
| 43 | m_name = wxT("PNG file"); |
| 44 | m_extension = wxT("png"); |
| 45 | m_type = wxBITMAP_TYPE_PNG; |
| 46 | m_mime = wxT("image/png"); |
| 47 | } |
| 48 | |
| 49 | #if wxUSE_STREAMS |
| 50 | virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); |
| 51 | virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); |
| 52 | protected: |
| 53 | virtual bool DoCanRead( wxInputStream& stream ); |
| 54 | #endif |
| 55 | |
| 56 | private: |
| 57 | DECLARE_DYNAMIC_CLASS(wxPNGHandler) |
| 58 | }; |
| 59 | |
| 60 | #endif |
| 61 | // wxUSE_LIBPNG |
| 62 | |
| 63 | #endif |
| 64 | // _WX_IMAGPNG_H_ |
| 65 | |