Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

plppmdec.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: plppmdec.h,v 1.3 2002/08/04 20:08:01 uzadow Exp $
00005 |
00006 |      Copyright (c) 2001 Ulrich von Zadow
00007 |
00008 |      Portable Pixmap Decoder Class
00009 |
00010 |      Originally by Todd Harris - Mar 2001
00011 |      adadapted from pgm.h originally by
00012 |                        Jose Miguel Buenaposada Biencinto. Mar 2000.
00013 |
00014 \--------------------------------------------------------------------
00015 */
00016 
00017 #ifndef INCL_PLPPMDEC
00018 #define INCL_PLPPMDEC
00019 
00020 #ifndef INCL_PLPICDEC
00021 #include "plpicdec.h"
00022 #endif
00023 
00024 #ifndef INCL_PLPPM
00025 #include "plppm.h"
00026 #endif
00027 
00028 //! Portable Pixmap file decoder. Delivers a 24 bit true color image.
00029 class PLPPMDecoder : public PLPicDecoder
00030 {
00031 
00032 public:
00033   //! Creates a decoder
00034   PLPPMDecoder
00035     ();
00036 
00037   //! Destroys a decoder
00038   virtual ~PLPPMDecoder
00039     ();
00040 
00041   //!
00042   virtual void Open (PLDataSource * pDataSrc);
00043 
00044   //!
00045   virtual void GetImage (PLBmp & Bmp);
00046 
00047 private:
00048 
00049   void readPpmHeader (PPMHEADER *pPpmHead,
00050                             PLDataSource * pDataSrc);
00051 
00052   int  readASCIIDecimal(PLDataSource * pDataSrc);
00053 
00054   void skipComment(PLDataSource * pDataSrc);
00055 
00056   void skipPpmASCIISeparators(PLDataSource * pDataSrc);
00057 
00058   PLBYTE *readASCIILine(PLDataSource *pDataSrc);
00059 
00060   void readImage (PLBmp * pBmp,
00061                   PLDataSource * pDataSrc);
00062 
00063   void readData(PLBmp * pBmp,
00064                 PLDataSource * pDataSrc);
00065 
00066   void expandASCIILine
00067     ( PLPixel32 * pDest,
00068       int MaxGrayValue,
00069       int Width,
00070       PLDataSource * pDataSrc
00071     );
00072 
00073   void expandByteLine
00074     ( PLPixel32 * pDest,
00075             int MaxGrayValue,
00076             int Width,
00077       PLDataSource * pDataSrc
00078     );
00079 
00080 
00081   PLPixel32 PLPPMDecoder::readASCIIPixel32
00082     ( int MaxGrayValue,
00083       PLDataSource * pDataSrc
00084     );
00085 
00086   PPMHEADER m_PPMHead;
00087   PLBYTE m_LastByte;
00088   bool m_UseLastByte;
00089 };
00090 
00091 #endif
00092 
00093 /*
00094 /--------------------------------------------------------------------
00095 |
00096 |      $Log: plppmdec.h,v $
00097 |      Revision 1.3  2002/08/04 20:08:01  uzadow
00098 |      Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.
00099 |
00100 |      Revision 1.2  2001/10/21 17:12:40  uzadow
00101 |      Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel.
00102 |
00103 |      Revision 1.1  2001/10/16 17:51:32  uzadow
00104 |      Added ppm support (Todd Harris)
00105 |
00106 |
00107 \--------------------------------------------------------------------
00108 */

Generated on Sun Jun 6 13:42:22 2004 for paintlib by doxygen 1.3.2