00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plpgmdec_8h-source.html,v 1.1 2004/06/06 12:56:41 uzadow Exp $ 00005 | 00006 | portable graymap Decoder Class 00007 | 00008 | Original author: Jose Miguel Buenaposada Biencinto. 00009 | 00010 | Copyright (c) 1996-2002 Ulrich von Zadow 00011 | 00012 \-------------------------------------------------------------------- 00013 */ 00014 00015 #ifndef INCL_PLPGMDEC 00016 #define INCL_PLPGMDEC 00017 00018 #ifndef INCL_PLPICDEC 00019 #include "plpicdec.h" 00020 #endif 00021 00022 #include "plpgm.h" 00023 00024 //! Portable Graymap file decoder. Delivers an 8 bpp grayscale image. 00025 class PLPGMDecoder : public PLPicDecoder 00026 { 00027 00028 public: 00029 //! Creates a decoder 00030 PLPGMDecoder 00031 (); 00032 00033 //! Destroys a decoder 00034 virtual ~PLPGMDecoder 00035 (); 00036 00037 //! 00038 virtual void Open (PLDataSource * pDataSrc); 00039 00040 //! 00041 virtual void GetImage (PLBmp & Bmp); 00042 00043 private: 00044 void readPgmHeader (PGMHEADER *pPgmHead, 00045 PLDataSource * pDataSrc); 00046 00047 int readASCIIDecimal(PLDataSource * pDataSrc); 00048 00049 void skipComment(PLDataSource * pDataSrc); 00050 00051 void skipPgmASCIISeparators(PLDataSource * pDataSrc); 00052 00053 PLBYTE *readASCIILine(PLDataSource *pDataSrc); 00054 00055 void readImage (PLBmp * pBmp, 00056 PLDataSource * pDataSrc); 00057 00058 void readData(PLBmp * pBmp, 00059 PLDataSource * pDataSrc); 00060 00061 void expandASCIILine 00062 ( PLBYTE * pDest, 00063 int MaxGrayValue, 00064 int Width, 00065 PLDataSource * pDataSrc 00066 ); 00067 00068 void expandByteLine 00069 ( PLBYTE * pDest, 00070 int MaxGrayValue, 00071 int Width, 00072 PLDataSource * pDataSrc 00073 ); 00074 00075 PLBYTE PLPGMDecoder::readASCIIPixel8 00076 ( int MaxGrayValue, 00077 PLDataSource * pDataSrc 00078 ); 00079 00080 PLBYTE m_LastByte; 00081 bool m_UseLastByte; 00082 PGMHEADER m_PGMHeader; 00083 }; 00084 00085 #endif 00086 /* 00087 /-------------------------------------------------------------------- 00088 | 00089 | $Log: plpgmdec_8h-source.html,v $ 00089 | Revision 1.1 2004/06/06 12:56:41 uzadow 00089 | Doxygenified documentation. 00089 | 00090 | Revision 1.5 2002/08/04 20:08:01 uzadow 00091 | Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support. 00092 | 00093 | Revision 1.4 2002/03/31 13:36:42 uzadow 00094 | Updated copyright. 00095 | 00096 | Revision 1.3 2001/10/21 17:12:40 uzadow 00097 | Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel. 00098 | 00099 | Revision 1.2 2001/10/06 22:37:08 uzadow 00100 | Linux compatibility. 00101 | 00102 | Revision 1.1 2001/09/16 19:03:22 uzadow 00103 | Added global name prefix PL, changed most filenames. 00104 | 00105 | Revision 1.4 2000/12/18 22:42:52 uzadow 00106 | Replaced RGBAPIXEL with PLPixel32. 00107 | 00108 | Revision 1.3 2000/05/23 10:19:11 Ulrich von Zadow 00109 | Minor unix compatibility changes. 00110 | 00111 | Revision 1.2 2000/03/21 10:51:16 Ulrich von Zadow 00112 | Documentation update. 00113 | 00114 | Revision 1.1 2000/03/16 13:56:37 Ulrich von Zadow 00115 | Added pgm decoder by Jose Miguel Buenaposada Biencinto 00116 | 00117 | 00118 \-------------------------------------------------------------------- 00119 */