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