]> Creatis software - clitk.git/blob - utilities/CxImage/ximaico.h
cosmetic
[clitk.git] / utilities / CxImage / ximaico.h
1 /*
2  * File:        ximaico.h
3  * Purpose:     ICON Image Class Loader and Writer
4  */
5 /* ==========================================================
6  * CxImageICO (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it
7  * For conditions of distribution and use, see copyright notice in ximage.h
8  * ==========================================================
9  */
10 #if !defined(__ximaICO_h)
11 #define __ximaICO_h
12
13 #include "ximage.h"
14
15 #if CXIMAGE_SUPPORT_ICO
16
17 class CxImageICO: public CxImage
18 {
19 typedef struct tagIconDirectoryEntry {
20     BYTE  bWidth;
21     BYTE  bHeight;
22     BYTE  bColorCount;
23     BYTE  bReserved;
24     WORD  wPlanes;
25     WORD  wBitCount;
26     DWORD dwBytesInRes;
27     DWORD dwImageOffset;
28 } ICONDIRENTRY;
29
30 typedef struct tagIconDir {
31     WORD          idReserved;
32     WORD          idType;
33     WORD          idCount;
34 } ICONHEADER;
35
36 public:
37         CxImageICO(): CxImage(CXIMAGE_FORMAT_ICO) {m_dwImageOffset=0;}
38
39 //      bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_ICO);}
40 //      bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_ICO);}
41         bool Decode(CxFile * hFile);
42         bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
43
44 #if CXIMAGE_SUPPORT_ENCODE
45         bool Encode(CxFile * hFile, bool bAppend=false, int nPageCount=0);
46         bool Encode(CxFile * hFile, CxImage ** pImages, int nPageCount);
47         bool Encode(FILE *hFile, bool bAppend=false, int nPageCount=0)
48                                 { CxIOFile file(hFile); return Encode(&file,bAppend,nPageCount); }
49         bool Encode(FILE *hFile, CxImage ** pImages, int nPageCount)
50                                 { CxIOFile file(hFile); return Encode(&file, pImages, nPageCount); }
51 #endif // CXIMAGE_SUPPORT_ENCODE
52 protected:
53         DWORD m_dwImageOffset;
54 };
55
56 #endif
57
58 #endif