X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=utilities%2FCxImage%2Fximapcx.h;h=271992c7fa9df4a1e1b41ae71c998773ac16da64;hb=aa6b838a5b6880c40ca8d9dbe72846c5812e5f93;hp=6e18f1561b1fe844f5b9e34bd1595847f2113884;hpb=3fd15028ab81e6746d3af96695526d7d973a26c8;p=clitk.git diff --git a/utilities/CxImage/ximapcx.h b/utilities/CxImage/ximapcx.h index 6e18f15..271992c 100644 --- a/utilities/CxImage/ximapcx.h +++ b/utilities/CxImage/ximapcx.h @@ -1,64 +1,64 @@ -/* - * File: ximapcx.h - * Purpose: PCX Image Class Loader and Writer - */ -/* ========================================================== - * CxImagePCX (c) 05/Jan/2002 Davide Pizzolato - www.xdp.it - * For conditions of distribution and use, see copyright notice in ximage.h - * - * Parts of the code come from Paintlib: Copyright (c) 1996-1998 Ulrich von Zadow - * ========================================================== - */ -#if !defined(__ximaPCX_h) -#define __ximaPCX_h - -#include "ximage.h" - -#if CXIMAGE_SUPPORT_PCX - -class CxImagePCX: public CxImage -{ -// PCX Image File -#pragma pack(1) -typedef struct tagPCXHEADER -{ - char Manufacturer; // always 0X0A - char Version; // version number - char Encoding; // always 1 - char BitsPerPixel; // color bits - WORD Xmin, Ymin; // image origin - WORD Xmax, Ymax; // image dimensions - WORD Hres, Vres; // resolution values - BYTE ColorMap[16][3]; // color palette - char Reserved; - char ColorPlanes; // color planes - WORD BytesPerLine; // line buffer size - WORD PaletteType; // grey or color palette - char Filter[58]; -} PCXHEADER; -#pragma pack() - -public: - CxImagePCX(): CxImage(CXIMAGE_FORMAT_PCX) {} - -// bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_PCX);} -// bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_PCX);} - bool Decode(CxFile * hFile); - bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); } - -#if CXIMAGE_SUPPORT_ENCODE - bool Encode(CxFile * hFile); - bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); } -#endif // CXIMAGE_SUPPORT_ENCODE -protected: - bool PCX_PlanesToPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel); - bool PCX_UnpackPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel); - void PCX_PackPixels(const long p,BYTE &c, BYTE &n, CxFile &f); - void PCX_PackPlanes(BYTE* buff, const long size, CxFile &f); - void PCX_PixelsToPlanes(BYTE* raw, long width, BYTE* buf, long plane); - void PCX_toh(PCXHEADER* p); -}; - -#endif - -#endif +/* + * File: ximapcx.h + * Purpose: PCX Image Class Loader and Writer + */ +/* ========================================================== + * CxImagePCX (c) 05/Jan/2002 Davide Pizzolato - www.xdp.it + * For conditions of distribution and use, see copyright notice in ximage.h + * + * Parts of the code come from Paintlib: Copyright (c) 1996-1998 Ulrich von Zadow + * ========================================================== + */ +#if !defined(__ximaPCX_h) +#define __ximaPCX_h + +#include "ximage.h" + +#if CXIMAGE_SUPPORT_PCX + +class CxImagePCX: public CxImage +{ +// PCX Image File +#pragma pack(1) +typedef struct tagPCXHEADER +{ + char Manufacturer; // always 0X0A + char Version; // version number + char Encoding; // always 1 + char BitsPerPixel; // color bits + WORD Xmin, Ymin; // image origin + WORD Xmax, Ymax; // image dimensions + WORD Hres, Vres; // resolution values + BYTE ColorMap[16][3]; // color palette + char Reserved; + char ColorPlanes; // color planes + WORD BytesPerLine; // line buffer size + WORD PaletteType; // grey or color palette + char Filter[58]; +} PCXHEADER; +#pragma pack() + +public: + CxImagePCX(): CxImage(CXIMAGE_FORMAT_PCX) {} + +// bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_PCX);} +// bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_PCX);} + bool Decode(CxFile * hFile); + bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); } + +#if CXIMAGE_SUPPORT_ENCODE + bool Encode(CxFile * hFile); + bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); } +#endif // CXIMAGE_SUPPORT_ENCODE +protected: + bool PCX_PlanesToPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel); + bool PCX_UnpackPixels(BYTE * pixels, BYTE * bitplanes, short bytesperline, short planes, short bitsperpixel); + void PCX_PackPixels(const long p,BYTE &c, BYTE &n, CxFile &f); + void PCX_PackPlanes(BYTE* buff, const long size, CxFile &f); + void PCX_PixelsToPlanes(BYTE* raw, long width, BYTE* buf, long plane); + void PCX_toh(PCXHEADER* p); +}; + +#endif + +#endif