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