c174ab5ba10726981f0021f094d0e4a6e754f63c
[synfig.git] / synfig-core / trunk / src / modules / mod_mng / trgt_mng.h
1 /*! ========================================================================
2 ** Synfig
3 **
4 **      Copyright (c) 2007 Paul Wise
5 **
6 **      This package is free software; you can redistribute it and/or
7 **      modify it under the terms of the GNU General Public License as
8 **      published by the Free Software Foundation; either version 2 of
9 **      the License, or (at your option) any later version.
10 **
11 **      This package is distributed in the hope that it will be useful,
12 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
13 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 **      General Public License for more details.
15 **
16 ** === N O T E S ===========================================================
17 **
18 ** ========================================================================= */
19
20 /* === S T A R T =========================================================== */
21
22 #ifndef __SYNFIG_TRGT_MNG_H
23 #define __SYNFIG_TRGT_MNG_H
24
25 /* === H E A D E R S ======================================================= */
26
27 #include <synfig/target_scanline.h>
28 #include <synfig/string.h>
29 #include <cstdio>
30
31 // #include <png.h>
32 // #include <jpeglib.h>
33
34 #if !defined(MNG_SUPPORT_FULL)
35 #define MNG_SUPPORT_FULL 1
36 #endif
37
38 #if !defined(MNG_SUPPORT_READ)
39 #define MNG_SUPPORT_READ 1
40 #endif
41
42 #if !defined(MNG_SUPPORT_WRITE)
43 #define MNG_SUPPORT_WRITE 1
44 #endif
45
46 #if !defined(MNG_SUPPORT_DISPLAY)
47 #define MNG_SUPPORT_DISPLAY 1
48 #endif
49
50 #if !defined(MNG_ACCESS_CHUNKS)
51 #define MNG_ACCESS_CHUNKS 1
52 #endif
53
54 #include <libmng.h>
55
56 /* === M A C R O S ========================================================= */
57
58 /* === T Y P E D E F S ===================================================== */
59
60 /* === C L A S S E S & S T R U C T S ======================================= */
61
62 class mng_trgt : public synfig::Target_Scanline
63 {
64         SYNFIG_TARGET_MODULE_EXT
65         
66 private:
67         
68         FILE *file;
69         int w,h;
70         mng_handle mng;
71
72         bool multi_image,ready;
73         int imagecount;
74         synfig::String filename;
75         unsigned char *buffer;
76         synfig::Color *color_buffer;
77
78         z_stream zstream;
79         unsigned char* zbuffer;
80         unsigned int zbuffer_len;
81
82 public:
83         
84         mng_trgt(const char *filename);
85         virtual ~mng_trgt();
86
87         virtual bool set_rend_desc(synfig::RendDesc *desc);
88         virtual bool init();
89         virtual bool start_frame(synfig::ProgressCallback *cb);
90         virtual void end_frame();
91
92         virtual synfig::Color * start_scanline(int scanline);
93         virtual bool end_scanline();
94 };
95
96 /* === E N D =============================================================== */
97
98 #endif