00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plpngdec.h,v 1.4 2002/08/04 20:08:01 uzadow Exp $ 00005 | 00006 | Copyright (c) 1996-2002 Ulrich von Zadow 00007 | 00008 -------------------------------------------------------------------- 00009 */ 00010 00011 #ifndef INCL_PLPNGDEC 00012 #define INCL_PLPNGDEC 00013 00014 #ifndef INCL_PLPICDEC 00015 #include "plpicdec.h" 00016 #endif 00017 00018 #ifndef INCL_PLPNG 00019 #include "png.h" 00020 #endif 00021 00022 00023 00024 //! PNG file decoder. Uses LibPng to do the actual decoding. 00025 //! PNG supports many pixel formats not supported by paintlib. These 00026 //! pixel formats are converted to the nearest paintlib equivalent. 00027 //! Images with less or more than 8 bits per channel are converted to 00028 //! 8 bits per channel. Images with 16-bit palettes or grayscale 00029 //! images with an alpha channel are returned as full 32-bit RGBA 00030 //! bitmaps. 00031 class PLPNGDecoder : public PLPicDecoder 00032 { 00033 00034 00035 public: 00036 //! Creates a decoder 00037 PLPNGDecoder 00038 (); 00039 00040 //! Destroys a decoder 00041 virtual ~PLPNGDecoder 00042 (); 00043 00044 //! 00045 virtual void Open (PLDataSource * pDataSrc); 00046 00047 //! Fills the bitmap with the image. 00048 virtual void GetImage (PLBmp & Bmp); 00049 00050 private: 00051 00052 static void PLPNGDecoder::user_error_fn 00053 ( png_structp png_ptr, 00054 png_const_charp error_msg 00055 ); 00056 00057 static void PLPNGDecoder::user_warning_fn 00058 ( png_structp png_ptr, 00059 png_const_charp warning_msg 00060 ); 00061 00062 int m_color_type, m_bit_depth; 00063 png_structp m_png_ptr; 00064 png_infop m_info_ptr; 00065 }; 00066 00067 #endif 00068 /* 00069 /-------------------------------------------------------------------- 00070 | 00071 | $Log: plpngdec.h,v $ 00072 | Revision 1.4 2002/08/04 20:08:01 uzadow 00073 | Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support. 00074 | 00075 | Revision 1.3 2002/03/31 13:36:42 uzadow 00076 | Updated copyright. 00077 | 00078 | Revision 1.2 2001/10/21 17:12:40 uzadow 00079 | Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel. 00080 | 00081 | Revision 1.1 2001/09/16 19:03:22 uzadow 00082 | Added global name prefix PL, changed most filenames. 00083 | 00084 | Revision 1.5 2000/12/18 22:42:52 uzadow 00085 | Replaced RGBAPIXEL with PLPixel32. 00086 | 00087 | Revision 1.4 2000/01/16 20:43:14 anonymous 00088 | Removed MFC dependencies 00089 | 00090 | Revision 1.3 1999/12/08 15:39:45 Ulrich von Zadow 00091 | Unix compatibility changes 00092 | 00093 | 00094 -------------------------------------------------------------------- 00095 */