3 * Purpose: TARGA Image Class Loader and Writer
\r
5 /* ==========================================================
\r
6 * CxImageTGA (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(__ximaTGA_h)
\r
17 #if CXIMAGE_SUPPORT_TGA
\r
19 class CxImageTGA: public CxImage
\r
22 typedef struct tagTgaHeader
\r
24 BYTE IdLength; // Image ID Field Length
\r
25 BYTE CmapType; // Color Map Type
\r
26 BYTE ImageType; // Image Type
\r
28 WORD CmapIndex; // First Entry Index
\r
29 WORD CmapLength; // Color Map Length
\r
30 BYTE CmapEntrySize; // Color Map Entry Size
\r
32 WORD X_Origin; // X-origin of Image
\r
33 WORD Y_Origin; // Y-origin of Image
\r
34 WORD ImageWidth; // Image Width
\r
35 WORD ImageHeight; // Image Height
\r
36 BYTE PixelDepth; // Pixel Depth
\r
37 BYTE ImagDesc; // Image Descriptor
\r
42 CxImageTGA(): CxImage(CXIMAGE_FORMAT_TGA) {}
\r
44 // bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_TGA);}
\r
45 // bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_TGA);}
\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 BYTE ExpandCompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, BYTE rleLeftover);
\r
55 void ExpandUncompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, int xoffset);
\r
56 void tga_toh(TGAHEADER* p);
\r