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