]> Creatis software - clitk.git/blob - utilities/CxImage/ximamng.h
adc922ca2ac0323c16fbe68e912d82667a4cb8fc
[clitk.git] / utilities / CxImage / ximamng.h
1 /*\r
2  * File:        ximamng.h\r
3  * Purpose:     Declaration of the MNG Image Class\r
4  * Author:      Davide Pizzolato - www.xdp.it\r
5  * Created:     2001\r
6  */\r
7 /* ==========================================================\r
8  * CxImageMNG (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it\r
9  * For conditions of distribution and use, see copyright notice in ximage.h\r
10  *\r
11  * Special thanks to Frank Haug <f.haug(at)jdm(dot)de> for suggestions and code.\r
12  *\r
13  * original mng.cpp code created by Nikolaus Brennig, November 14th, 2000. <virtualnik(at)nol(dot)at>\r
14  *\r
15  * LIBMNG Copyright (c) 2000,2001 Gerard Juyn (gerard@libmng.com)\r
16  * ==========================================================\r
17  */\r
18 \r
19 #if !defined(__ximaMNG_h)\r
20 #define __ximaMNG_h\r
21 \r
22 #include "ximage.h"\r
23 \r
24 #if CXIMAGE_SUPPORT_MNG\r
25 \r
26 //#define MNG_NO_CMS\r
27 #define MNG_SUPPORT_DISPLAY\r
28 #define MNG_SUPPORT_READ\r
29 #define MNG_SUPPORT_WRITE\r
30 #define MNG_ACCESS_CHUNKS\r
31 #define MNG_STORE_CHUNKS\r
32 \r
33 extern "C" {\r
34 #include "../mng/libmng.h"\r
35 #include "../mng/libmng_data.h"\r
36 #include "../mng/libmng_error.h"\r
37 }\r
38 \r
39 //unsigned long _stdcall RunMNGThread(void *lpParam);\r
40 \r
41 typedef struct tagmngstuff \r
42 {\r
43         CxFile          *file;\r
44         BYTE            *image;\r
45         BYTE            *alpha;\r
46         HANDLE          thread;\r
47         mng_uint32      delay;\r
48         mng_uint32  width;\r
49         mng_uint32  height;\r
50         mng_uint32  effwdt;\r
51         mng_int16       bpp;\r
52         mng_bool        animation;\r
53         mng_bool        animation_enabled;\r
54         float           speed;\r
55         long            nBkgndIndex;\r
56         RGBQUAD         nBkgndColor;\r
57 } mngstuff;\r
58 \r
59 class CxImageMNG: public CxImage\r
60 {\r
61 public:\r
62         CxImageMNG();\r
63         ~CxImageMNG();\r
64 \r
65         bool Load(const TCHAR * imageFileName);\r
66 \r
67         bool Decode(CxFile * hFile);\r
68         bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }\r
69 \r
70 #if CXIMAGE_SUPPORT_ENCODE\r
71         bool Encode(CxFile * hFile);\r
72         bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }\r
73         bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_MNG);}\r
74 #endif // CXIMAGE_SUPPORT_ENCODE\r
75 \r
76         long Resume();\r
77         void SetSpeed(float speed);\r
78         \r
79         mng_handle hmng;\r
80         mngstuff mnginfo;\r
81 protected:\r
82         void WritePNG(mng_handle hMNG, int Frame, int FrameCount );\r
83         void SetCallbacks(mng_handle mng);\r
84 };\r
85 \r
86 #endif\r
87 \r
88 #endif\r