00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plsgidec_8h-source.html,v 1.4 2004/09/15 15:26:32 uzadow Exp $ 00005 | 00006 | Copyright (c) 1996-2002 Ulrich von Zadow 00007 | 00008 \-------------------------------------------------------------------- 00009 */ 00010 00011 #ifndef INCL_PLSGIDEC 00012 #define INCL_PLSGIDEC 00013 00014 #ifndef INCL_PLPICDEC 00015 #include "plpicdec.h" 00016 #endif 00017 00018 //! SGI rgb file decoder. 00019 class PLSGIDecoder : public PLPicDecoder 00020 { 00021 typedef struct { 00022 PLWORD Magic; 00023 PLBYTE Storage; 00024 PLBYTE bpc; // bytes per color: 1 = bytes, 2 = shorts 00025 PLWORD Dimension; // 1 = single row, 2 = B/W, 3 = RGB 00026 PLWORD XSize; // width in pixels 00027 PLWORD YSize; // height in pixels 00028 PLWORD ZSize; // # of channels; GRAY=1, RGB=3, RGBA=4 00029 PLULONG PixMin, PixMax; // min/max pixel values 00030 PLULONG Dummy1; 00031 char Name[80]; 00032 PLULONG Colormap; 00033 } SGIHeader; 00034 00035 public: 00036 //! Creates a decoder 00037 PLSGIDecoder 00038 (); 00039 00040 //! Destroys a decoder 00041 virtual ~PLSGIDecoder 00042 (); 00043 00044 //! 00045 virtual void Open (PLDataSource * pDataSrc); 00046 00047 //! Fills the bitmap with the image. 00048 virtual void GetImage (PLBmpBase & Bmp); 00049 00050 private: 00051 void readHeader 00052 ( SGIHeader * pHeader, 00053 PLDataSource * pDataSrc 00054 ); 00055 void readUncompressed 00056 ( PLBmpBase & Bmp 00057 ); 00058 00059 void readRLE 00060 ( PLBmpBase & Bmp 00061 ); 00062 00063 SGIHeader m_Header; 00064 }; 00065 00066 #endif 00067 /* 00068 /-------------------------------------------------------------------- 00069 | 00070 | $Log: plsgidec_8h-source.html,v $ 00070 | Revision 1.4 2004/09/15 15:26:32 uzadow 00070 | Linux compatibility changes, doc update. 00070 | 00071 | Revision 1.3 2004/08/20 14:39:38 uzadow 00072 | Added rle format to sgi decoder. Doesn't work yet, though. 00073 | 00074 | Revision 1.2 2004/06/19 16:49:07 uzadow 00075 | Changed GetImage so it works with PLBmpBase 00076 | 00077 | Revision 1.1 2003/06/01 21:12:06 uzadow 00078 | Added sgi rgb file format. 00079 | 00080 | 00081 | 00082 \-------------------------------------------------------------------- 00083 */