|
Otclient 1.0
14/8/2020
|
#include "apngloader.h"#include <cstdio>#include <cstdlib>#include <cstring>#include <fstream>#include <iostream>#include <memory>#include <sstream>#include <zlib.h>
Go to the source code of this file.
Macros | |
| #define | swap16(data) (((data >> 8) & 255) | ((data & 255) << 8)) |
| #define | swap32(data) ((swap16(data) << 16) | swap16(data >> 16)) |
| #define | PNG_ZBUF_SIZE 32768 |
| #define | PNG_DISPOSE_OP_NONE 0x00 |
| #define | PNG_DISPOSE_OP_BACKGROUND 0x01 |
| #define | PNG_DISPOSE_OP_PREVIOUS 0x02 |
| #define | PNG_BLEND_OP_SOURCE 0x00 |
| #define | PNG_BLEND_OP_OVER 0x01 |
| #define | notabc(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) |
| #define | ROWBYTES(pixel_bits, width) |
Functions | |
| unsigned int | read32 (std::istream &f1) |
| unsigned short | read16 (std::istream &f1) |
| unsigned short | readshort (unsigned char *p) |
| void | read_sub_row (unsigned char *row, unsigned int rowbytes, unsigned int bpp) |
| void | read_up_row (unsigned char *row, unsigned char *prev_row, unsigned int rowbytes, unsigned int) |
| void | read_average_row (unsigned char *row, unsigned char *prev_row, unsigned int rowbytes, unsigned int bpp) |
| void | read_paeth_row (unsigned char *row, unsigned char *prev_row, unsigned int rowbytes, unsigned int bpp) |
| void | unpack (z_stream &zstream, unsigned char *dst, unsigned int dst_size, unsigned char *src, unsigned int src_size, unsigned int h, unsigned int rowbytes, unsigned char bpp) |
| void | compose0 (unsigned char *dst1, unsigned int dstbytes1, unsigned char *dst2, unsigned int dstbytes2, unsigned char *src, unsigned int srcbytes, unsigned int w, unsigned int h, unsigned int bop, unsigned char depth) |
| void | compose2 (unsigned char *dst1, unsigned int dstbytes1, unsigned char *dst2, unsigned int dstbytes2, unsigned char *src, unsigned int srcbytes, unsigned int w, unsigned int h, unsigned int bop, unsigned char depth) |
| void | compose3 (unsigned char *dst1, unsigned int dstbytes1, unsigned char *dst2, unsigned int dstbytes2, unsigned char *src, unsigned int srcbytes, unsigned int w, unsigned int h, unsigned int bop, unsigned char depth) |
| void | compose4 (unsigned char *dst, unsigned int dstbytes, unsigned char *src, unsigned int srcbytes, unsigned int w, unsigned int h, unsigned int bop, unsigned char depth) |
| void | compose6 (unsigned char *dst, unsigned int dstbytes, unsigned char *src, unsigned int srcbytes, unsigned int w, unsigned int h, unsigned int bop, unsigned char depth) |
| int | load_apng (std::stringstream &file, struct apng_data *apng) |
| void | write_chunk (std::ostream &f, const char *name, unsigned char *data, unsigned int length) |
| void | write_IDATs (std::ostream &f, unsigned char *data, unsigned int length, unsigned int idat_size) |
| void | save_png (std::stringstream &f, unsigned int width, unsigned int height, int channels, unsigned char *pixels) |
| void | free_apng (struct apng_data *apng) |
Variables | |
| unsigned char | png_sign [8] = { 137, 80, 78, 71, 13, 10, 26, 10 } |
| int | mask4 [2] = { 240,15 } |
| int | shift4 [2] = { 4,0 } |
| int | mask2 [4] = { 192,48,12,3 } |
| int | shift2 [4] = { 6,4,2,0 } |
| int | mask1 [8] = { 128,64,32,16,8,4,2,1 } |
| int | shift1 [8] = { 7,6,5,4,3,2,1,0 } |
| unsigned int | keep_original = 1 |
| unsigned char | pal [256][3] |
| unsigned char | trns [256] |
| unsigned int | palsize |
| unsigned int | trnssize |
| unsigned int | hasTRNS |
| unsigned short | trns1 |
| unsigned short | trns2 |
| unsigned short | trns3 |
| #define notabc | ( | c | ) | ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) |
Definition at line 58 of file apngloader.cpp.
| #define PNG_BLEND_OP_OVER 0x01 |
Definition at line 56 of file apngloader.cpp.
| #define PNG_BLEND_OP_SOURCE 0x00 |
Definition at line 55 of file apngloader.cpp.
| #define PNG_DISPOSE_OP_BACKGROUND 0x01 |
Definition at line 52 of file apngloader.cpp.
| #define PNG_DISPOSE_OP_NONE 0x00 |
Definition at line 51 of file apngloader.cpp.
| #define PNG_DISPOSE_OP_PREVIOUS 0x02 |
Definition at line 53 of file apngloader.cpp.
| #define PNG_ZBUF_SIZE 32768 |
Definition at line 49 of file apngloader.cpp.
| #define ROWBYTES | ( | pixel_bits, | |
| width | |||
| ) |
Definition at line 60 of file apngloader.cpp.
| #define swap16 | ( | data | ) | (((data >> 8) & 255) | ((data & 255) << 8)) |
Definition at line 45 of file apngloader.cpp.
Definition at line 46 of file apngloader.cpp.
| void compose0 | ( | unsigned char * | dst1, |
| unsigned int | dstbytes1, | ||
| unsigned char * | dst2, | ||
| unsigned int | dstbytes2, | ||
| unsigned char * | src, | ||
| unsigned int | srcbytes, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| unsigned int | bop, | ||
| unsigned char | depth | ||
| ) |
Definition at line 200 of file apngloader.cpp.


| void compose2 | ( | unsigned char * | dst1, |
| unsigned int | dstbytes1, | ||
| unsigned char * | dst2, | ||
| unsigned int | dstbytes2, | ||
| unsigned char * | src, | ||
| unsigned int | srcbytes, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| unsigned int | bop, | ||
| unsigned char | depth | ||
| ) |
Definition at line 242 of file apngloader.cpp.


| void compose3 | ( | unsigned char * | dst1, |
| unsigned int | dstbytes1, | ||
| unsigned char * | dst2, | ||
| unsigned int | dstbytes2, | ||
| unsigned char * | src, | ||
| unsigned int | srcbytes, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| unsigned int | bop, | ||
| unsigned char | depth | ||
| ) |
| void compose4 | ( | unsigned char * | dst, |
| unsigned int | dstbytes, | ||
| unsigned char * | src, | ||
| unsigned int | srcbytes, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| unsigned int | bop, | ||
| unsigned char | depth | ||
| ) |
| void compose6 | ( | unsigned char * | dst, |
| unsigned int | dstbytes, | ||
| unsigned char * | src, | ||
| unsigned int | srcbytes, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| unsigned int | bop, | ||
| unsigned char | depth | ||
| ) |
| void free_apng | ( | struct apng_data * | apng | ) |
| int load_apng | ( | std::stringstream & | file, |
| struct apng_data * | apng | ||
| ) |
Definition at line 515 of file apngloader.cpp.


| unsigned short read16 | ( | std::istream & | f1 | ) |
| unsigned int read32 | ( | std::istream & | f1 | ) |
| void read_average_row | ( | unsigned char * | row, |
| unsigned char * | prev_row, | ||
| unsigned int | rowbytes, | ||
| unsigned int | bpp | ||
| ) |
| void read_paeth_row | ( | unsigned char * | row, |
| unsigned char * | prev_row, | ||
| unsigned int | rowbytes, | ||
| unsigned int | bpp | ||
| ) |
| void read_sub_row | ( | unsigned char * | row, |
| unsigned int | rowbytes, | ||
| unsigned int | bpp | ||
| ) |
| void read_up_row | ( | unsigned char * | row, |
| unsigned char * | prev_row, | ||
| unsigned int | rowbytes, | ||
| unsigned int | |||
| ) |
| unsigned short readshort | ( | unsigned char * | p | ) |
| void save_png | ( | std::stringstream & | f, |
| unsigned int | width, | ||
| unsigned int | height, | ||
| int | channels, | ||
| unsigned char * | pixels | ||
| ) |
Definition at line 927 of file apngloader.cpp.


| void unpack | ( | z_stream & | zstream, |
| unsigned char * | dst, | ||
| unsigned int | dst_size, | ||
| unsigned char * | src, | ||
| unsigned int | src_size, | ||
| unsigned int | h, | ||
| unsigned int | rowbytes, | ||
| unsigned char | bpp | ||
| ) |
Definition at line 172 of file apngloader.cpp.


| void write_chunk | ( | std::ostream & | f, |
| const char * | name, | ||
| unsigned char * | data, | ||
| unsigned int | length | ||
| ) |
| void write_IDATs | ( | std::ostream & | f, |
| unsigned char * | data, | ||
| unsigned int | length, | ||
| unsigned int | idat_size | ||
| ) |
Definition at line 890 of file apngloader.cpp.


| unsigned int hasTRNS |
Definition at line 80 of file apngloader.cpp.
| unsigned int keep_original = 1 |
Definition at line 76 of file apngloader.cpp.
| int mask1[8] = { 128,64,32,16,8,4,2,1 } |
Definition at line 73 of file apngloader.cpp.
| int mask2[4] = { 192,48,12,3 } |
Definition at line 70 of file apngloader.cpp.
| int mask4[2] = { 240,15 } |
Definition at line 67 of file apngloader.cpp.
| unsigned char pal[256][3] |
Definition at line 77 of file apngloader.cpp.
| unsigned int palsize |
Definition at line 79 of file apngloader.cpp.
| unsigned char png_sign[8] = { 137, 80, 78, 71, 13, 10, 26, 10 } |
Definition at line 65 of file apngloader.cpp.
| int shift1[8] = { 7,6,5,4,3,2,1,0 } |
Definition at line 74 of file apngloader.cpp.
| int shift2[4] = { 6,4,2,0 } |
Definition at line 71 of file apngloader.cpp.
| int shift4[2] = { 4,0 } |
Definition at line 68 of file apngloader.cpp.
| unsigned char trns[256] |
Definition at line 78 of file apngloader.cpp.
| unsigned short trns1 |
Definition at line 81 of file apngloader.cpp.
| unsigned short trns2 |
Definition at line 81 of file apngloader.cpp.
| unsigned short trns3 |
Definition at line 81 of file apngloader.cpp.
| unsigned int trnssize |
Definition at line 79 of file apngloader.cpp.