imagpng.h 1.8 KB

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