Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_07_rc3 / 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 ** FIXME: THIS DOES NOT ACTUALLY WORK YET
19 **
20 ** ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_TRGT_MNG_H
25 #define __SYNFIG_TRGT_MNG_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <synfig/target_scanline.h>
30 #include <synfig/string.h>
31 #include <cstdio>
32
33 #include <png.h>
34 #include <jpeglib.h>
35
36 #if !defined(MNG_SUPPORT_FULL)
37 #define MNG_SUPPORT_FULL 1
38 #endif
39
40 #if !defined(MNG_SUPPORT_READ)
41 #define MNG_SUPPORT_READ 1
42 #endif
43
44 #if !defined(MNG_SUPPORT_WRITE)
45 #define MNG_SUPPORT_WRITE 1
46 #endif
47
48 #if !defined(MNG_SUPPORT_DISPLAY)
49 #define MNG_SUPPORT_DISPLAY 1
50 #endif
51
52 #if !defined(MNG_ACCESS_CHUNKS)
53 #define MNG_ACCESS_CHUNKS 1
54 #endif
55
56 #include <libmng.h>
57
58 /* === M A C R O S ========================================================= */
59
60 /* === T Y P E D E F S ===================================================== */
61
62 /* === C L A S S E S & S T R U C T S ======================================= */
63
64 class mng_trgt : public synfig::Target_Scanline
65 {
66         SYNFIG_TARGET_MODULE_EXT
67         
68 private:
69         
70         FILE *file;
71         int w,h;
72         mng_handle mng;
73
74         bool multi_image,ready;
75         int imagecount;
76         synfig::String filename;
77         unsigned char *buffer;
78         synfig::Color *color_buffer;
79
80         z_stream zstream;
81         unsigned char* zbuffer;
82         unsigned int zbuffer_len;
83
84 public:
85         
86         mng_trgt(const char *filename);
87         virtual ~mng_trgt();
88
89         virtual bool set_rend_desc(synfig::RendDesc *desc);
90         virtual bool init();
91         virtual bool start_frame(synfig::ProgressCallback *cb);
92         virtual void end_frame();
93
94         virtual synfig::Color * start_scanline(int scanline);
95         virtual bool end_scanline();
96 };
97
98 /* === E N D =============================================================== */
99
100 #endif