3 * Purpose: PCX Image Class Loader and Writer
\r
5 /* ==========================================================
\r
6 * CxImagePCX (c) 05/Jan/2002 Davide Pizzolato - www.xdp.it
\r
7 * For conditions of distribution and use, see copyright notice in ximage.h
\r
9 * Parts of the code come from Paintlib: Copyright (c) 1996-1998 Ulrich von Zadow
\r
10 * ==========================================================
\r
12 #if !defined(__ximaPCX_h)
\r
17 #if CXIMAGE_SUPPORT_PCX
\r
19 class CxImagePCX: public CxImage
\r
23 typedef struct tagPCXHEADER
\r
25 char Manufacturer; // always 0X0A
\r
26 char Version; // version number
\r
27 char Encoding; // always 1
\r
28 char BitsPerPixel; // color bits
\r
29 WORD Xmin, Ymin; // image origin
\r
30 WORD Xmax, Ymax; // image dimensions
\r
31 WORD Hres, Vres; // resolution values
\r
32 BYTE ColorMap[16][3]; // color palette
\r
34 char ColorPlanes; // color planes
\r
35 WORD BytesPerLine; // line buffer size
\r
36 WORD PaletteType; // grey or color palette
\r
42 CxImagePCX(): CxImage(CXIMAGE_FORMAT_PCX) {}
\r
44 // bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_PCX);}
\r
45 // bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_PCX);}
\r
46 bool Decode(CxFile * hFile);
\r
47 bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
\r
49 #if CXIMAGE_SUPPORT_ENCODE
\r
50 bool Encode(CxFile * hFile);
\r
51 bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }
\r
52 #endif // CXIMAGE_SUPPORT_ENCODE
\r
54 bool PCX_PlanesToPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel);
\r
55 bool PCX_UnpackPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel);
\r
56 void PCX_PackPixels(const long p,BYTE &c, BYTE &n, CxFile &f);
\r
57 void PCX_PackPlanes(BYTE* buff, const long size, CxFile &f);
\r
58 void PCX_PixelsToPlanes(BYTE* raw, long width, BYTE* buf, long plane);
\r
59 void PCX_toh(PCXHEADER* p);
\r