00001
00025
00026
00027 #ifndef __SYNFIG_MPTR_PNG_H
00028 #define __SYNFIG_MPTR_PNG_H
00029
00030
00031
00032 #include <synfig/importer.h>
00033 #include <synfig/string.h>
00034 #include <synfig/surface.h>
00035 #include <png.h>
00036
00037
00038
00039
00040
00041
00042
00043 class png_mptr : public synfig::Importer
00044 {
00045 SYNFIG_IMPORTER_MODULE_EXT
00046 private:
00047 synfig::String filename;
00048 synfig::Surface surface_buffer;
00049
00050 png_structp png_ptr;
00051 png_infop info_ptr;
00052 png_infop end_info;
00053
00054 bool trim;
00055 unsigned int orig_width, orig_height, trimmed_x, trimmed_y;
00056
00057 static void png_out_error(png_struct *png_data,const char *msg);
00058 static void png_out_warning(png_struct *png_data,const char *msg);
00059 static int read_chunk_callback(png_struct *png_data, png_unknown_chunkp chunk);
00060
00061 public:
00062 png_mptr(const char *filename);
00063 ~png_mptr();
00064
00065 virtual bool get_frame(synfig::Surface &surface,synfig::Time time, synfig::ProgressCallback *callback);
00066 virtual bool get_frame(synfig::Surface &surface,synfig::Time time,
00067 bool &trimmed, unsigned int &width, unsigned int &height, unsigned int &top, unsigned int &left,
00068 synfig::ProgressCallback *callback);
00069 };
00070
00071
00072
00073 #endif