source: liacs/MIR2010/SourceCode/cximage/ximatga.h@ 181

Last change on this file since 181 was 95, checked in by Rick van der Zwet, 15 years ago

Bad boy, improper move of directory

File size: 2.1 KB
Line 
1/*
2 * File: ximatga.h
3 * Purpose: TARGA Image Class Loader and Writer
4 */
5/* ==========================================================
6 * CxImageTGA (c) 05/Jan/2002 Davide Pizzolato - www.xdp.it
7 * For conditions of distribution and use, see copyright notice in ximage.h
8 *
9 * Parts of the code come from Paintlib : Copyright (c) 1996-1998 Ulrich von Zadow
10 * ==========================================================
11 */
12#if !defined(__ximaTGA_h)
13#define __ximaTGA_h
14
15#include "ximage.h"
16
17#if CXIMAGE_SUPPORT_TGA
18
19class CxImageTGA: public CxImage
20{
21#pragma pack(1)
22typedef struct tagTgaHeader
23{
24 BYTE IdLength; // Image ID Field Length
25 BYTE CmapType; // Color Map Type
26 BYTE ImageType; // Image Type
27
28 WORD CmapIndex; // First Entry Index
29 WORD CmapLength; // Color Map Length
30 BYTE CmapEntrySize; // Color Map Entry Size
31
32 WORD X_Origin; // X-origin of Image
33 WORD Y_Origin; // Y-origin of Image
34 WORD ImageWidth; // Image Width
35 WORD ImageHeight; // Image Height
36 BYTE PixelDepth; // Pixel Depth
37 BYTE ImagDesc; // Image Descriptor
38} TGAHEADER;
39#pragma pack()
40
41public:
42 CxImageTGA(): CxImage(CXIMAGE_FORMAT_TGA) {}
43
44// bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_TGA);}
45// bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_TGA);}
46 bool Decode(CxFile * hFile);
47 bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
48
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
53protected:
54 BYTE ExpandCompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, BYTE rleLeftover);
55 void ExpandUncompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, int xoffset);
56 void tga_toh(TGAHEADER* p);
57};
58
59#endif
60
61#endif
Note: See TracBrowser for help on using the repository browser.