pcx.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef PCX_H
00011 #define PCX_H
00012
00013 #include <qglobal.h>
00014 #include <qdatastream.h>
00015 #include <qcolor.h>
00016
00017 class QImageIO;
00018
00019 extern "C"
00020 {
00021 void kimgio_pcx_read( QImageIO * );
00022 void kimgio_pcx_write( QImageIO * );
00023 }
00024
00025 class RGB
00026 {
00027 public:
00028 RGB() { }
00029
00030 RGB( const QRgb color )
00031 {
00032 r = qRed( color );
00033 g = qGreen( color );
00034 b = qBlue( color );
00035 }
00036
00037 Q_UINT8 r;
00038 Q_UINT8 g;
00039 Q_UINT8 b;
00040 };
00041
00042 class Palette
00043 {
00044 public:
00045 Palette() { }
00046
00047 void setColor( int i, const QRgb color )
00048 {
00049 rgb[ i ] = RGB( color );
00050 }
00051
00052 QRgb color( int i ) const
00053 {
00054 return qRgb( rgb[ i ].r, rgb[ i ].g, rgb[ i ].b );
00055 }
00056
00057 struct RGB rgb[ 16 ];
00058 };
00059
00060 class PCXHEADER
00061 {
00062 public:
00063 PCXHEADER();
00064
00065 inline int width() const { return ( XMax-XMin ) + 1; }
00066 inline int height() const { return ( YMax-YMin ) + 1; }
00067 inline bool isCompressed() const { return ( Encoding==1 ); }
00068
00069 Q_UINT8 Manufacturer;
00070 Q_UINT8 Version;
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 Q_UINT8 Encoding;
00081 Q_UINT8 Bpp;
00082
00083 Q_UINT16 XMin;
00084 Q_UINT16 YMin;
00085 Q_UINT16 XMax;
00086 Q_UINT16 YMax;
00087 Q_UINT16 HDpi;
00088 Q_UINT16 YDpi;
00089 Palette ColorMap;
00090 Q_UINT8 Reserved;
00091 Q_UINT8 NPlanes;
00092 Q_UINT16 BytesPerLine;
00093
00094
00095 Q_UINT16 PaletteInfo;
00096
00097 Q_UINT16 HScreenSize;
00098
00099 Q_UINT16 VScreenSize;
00100
00101 } KDE_PACKED;
00102
00103 #endif // PCX_H
00104
00105
00106
|