synfig-core  1.0.3
trgt_png_spritesheet.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
29 /* === S T A R T =========================================================== */
30 
31 #ifndef __SYNFIG_TRGT_PNG_SPRITESHEET_H
32 #define __SYNFIG_TRGT_PNG_SPRITESHEET_H
33 
34 /* === H E A D E R S ======================================================= */
35 
36 #include <png.h>
37 #include <synfig/target_scanline.h>
38 #include <synfig/string.h>
39 #include <synfig/targetparam.h>
40 #include <cstdio>
41 
42 /* === M A C R O S ========================================================= */
43 
44 /* === T Y P E D E F S ===================================================== */
45 
46 /* === C L A S S E S & S T R U C T S ======================================= */
47 
49 {
51 private:
52  struct PngImage
53  {
54  PngImage():
55  width(0),
56  height(0),
57  color_type(0),
58  bit_depth(0){}
59  unsigned int width;
60  unsigned int height;
61  png_byte color_type;
62  png_byte bit_depth;
63  png_structp png_ptr;
64  png_infop info_ptr;
65  };
66 
67  static void png_out_error(png_struct *png,const char *msg);
68  static void png_out_warning(png_struct *png,const char *msg);
69  bool ready;
70  bool initialized;
71  int imagecount;
72  int lastimage;
73  int numimages;
74  unsigned int cur_y;
75  unsigned int cur_row;
76  unsigned int cur_col;
77  synfig::TargetParam params;
78  synfig::Color ** color_data;
79  unsigned int sheet_width;
80  unsigned int sheet_height;
81  FILE * in_file_pointer;
82  PngImage in_image;
83  synfig::String filename;
84  synfig::String sequence_separator;
85  synfig::Color * overflow_buff;
86 public:
87  png_trgt_spritesheet(const char *filename, const synfig::TargetParam& /* params */);
88  virtual ~png_trgt_spritesheet();
89 
90  virtual bool set_rend_desc(synfig::RendDesc *desc);
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  bool read_png_file();
97  bool write_png_file();
98  bool load_png_file();
99 };
100 
101 /* === E N D =============================================================== */
102 
103 #endif