13 #include "apngframe.h"
14 #include "apngasm-conf.h"
15 #include "apngasm-version.h"
23 namespace listener {
class IAPNGAsmListener; }
25 typedef struct {
unsigned char *p;
unsigned int size;
int x, y, w, h, valid, filters; } OP;
31 struct CHUNK {
unsigned int size;
unsigned char * p; };
48 APNGAsm(
const std::vector<APNGFrame> &frames);
78 #ifdef APNG_WRITE_SUPPORTED
84 bool assemble(
const std::string &outputPath);
87 #ifdef APNG_READ_SUPPORTED
93 const std::vector<APNGFrame>& disassemble(
const std::string &filePath);
100 bool savePNGs(
const std::string& outputDir)
const;
103 #ifdef APNG_SPECS_SUPPORTED
112 const std::vector<APNGFrame>& loadAnimationSpec(
const std::string &filePath);
120 bool saveJSON(
const std::string& outputPath,
const std::string& imageDir=
"")
const;
128 bool saveXML(
const std::string& outputPath,
const std::string& imageDir=
"")
const;
135 void setAPNGAsmListener(listener::IAPNGAsmListener* listener=NULL);
141 const std::vector<APNGFrame>& getFrames()
const;
159 const char* version(
void)
const;
163 std::vector<APNGFrame> _frames;
166 listener::IAPNGAsmListener* _listener;
168 #ifdef APNG_WRITE_SUPPORTED
169 unsigned char findCommonType(
void);
170 int upconvertToCommonType(
unsigned char coltype);
171 void dirtyTransparencyOptimization(
unsigned char coltype);
172 unsigned char downconvertOptimizations(
unsigned char coltype,
bool keep_palette,
bool keep_coltype);
174 bool save(
const std::string &outputPath,
unsigned char coltype,
unsigned first,
unsigned loops);
176 void process_rect(
unsigned char * row,
int rowbytes,
int bpp,
int stride,
int h,
unsigned char * rows);
177 void deflate_rect_fin(
unsigned char * zbuf,
unsigned int * zsize,
int bpp,
int stride,
unsigned char * rows,
int zbuf_size,
int n);
178 void deflate_rect_op(
unsigned char *pdata,
int x,
int y,
int w,
int h,
int bpp,
int stride,
int zbuf_size,
int n);
179 void get_rect(
unsigned int w,
unsigned int h,
unsigned char *pimage1,
unsigned char *pimage2,
unsigned char *ptemp,
unsigned int bpp,
unsigned int stride,
int zbuf_size,
unsigned int has_tcolor,
unsigned int tcolor,
int n);
181 void write_chunk(FILE * f,
const char * name,
unsigned char * data,
unsigned int length);
182 void write_IDATs(FILE * f,
int frame,
unsigned char * data,
unsigned int length,
unsigned int idat_size);
185 z_stream _op_zstream1;
186 z_stream _op_zstream2;
187 unsigned char * _op_zbuf1;
188 unsigned char * _op_zbuf2;
189 z_stream _fin_zstream;
190 unsigned char * _row_buf;
191 unsigned char * _sub_row;
192 unsigned char * _up_row;
193 unsigned char * _avg_row;
194 unsigned char * _paeth_row;
195 unsigned int _next_seq_num;
198 #ifdef APNG_READ_SUPPORTED
199 const std::vector<APNGFrame>& fileToFrames(
const std::string &filePath,
unsigned delayNum,
unsigned delayDen);
200 void compose_frame(
unsigned char ** rows_dst,
unsigned char ** rows_src,
unsigned char bop,
unsigned int x,
unsigned int y,
unsigned int w,
unsigned int h);
201 unsigned int read_chunk(FILE * f, CHUNK * pChunk);
202 void recalc_crc(
unsigned char * p,
unsigned int size);
204 std::vector<CHUNK> _info_chunks;
208 unsigned int _height;
211 unsigned char _trns[256];
212 unsigned int _palsize;
213 unsigned int _trnssize;
218 #endif // _APNGASM_H_
The APNGAsm core class is all you need to assemble and disassemble Animated PNG.
Definition: apngasm.h:37
Definition: apngframe.h:12
Definition: apngframe.h:16
const unsigned DEFAULT_FRAME_DENOMINATOR
The default denominator for the frame delay fraction.
Definition: apngframe.h:10
const unsigned DEFAULT_FRAME_NUMERATOR
The default numerator for the frame delay fraction.
Definition: apngframe.h:9