1
/***************************************************************************
7
****************************************************************************
12
Redistribution and use in source and binary forms, with or without
13
modification, are permitted provided that the following conditions are
16
* Redistributions of source code must retain the above copyright
17
notice, this list of conditions and the following disclaimer.
18
* Redistributions in binary form must reproduce the above copyright
19
notice, this list of conditions and the following disclaimer in
20
the documentation and/or other materials provided with the
22
* Neither the name 'MAME' nor the names of its contributors may be
23
used to endorse or promote products derived from this software
24
without specific prior written permission.
26
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
27
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
30
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
POSSIBILITY OF SUCH DAMAGE.
38
***************************************************************************/
51
/***************************************************************************
53
***************************************************************************/
55
#define PNG_Signature "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"
56
#define MNG_Signature "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A"
59
#define PNG_CN_IHDR 0x49484452L
60
#define PNG_CN_PLTE 0x504C5445L
61
#define PNG_CN_IDAT 0x49444154L
62
#define PNG_CN_IEND 0x49454E44L
63
#define PNG_CN_gAMA 0x67414D41L
64
#define PNG_CN_sBIT 0x73424954L
65
#define PNG_CN_cHRM 0x6348524DL
66
#define PNG_CN_tRNS 0x74524E53L
67
#define PNG_CN_bKGD 0x624B4744L
68
#define PNG_CN_hIST 0x68495354L
69
#define PNG_CN_tEXt 0x74455874L
70
#define PNG_CN_zTXt 0x7A545874L
71
#define PNG_CN_pHYs 0x70485973L
72
#define PNG_CN_oFFs 0x6F464673L
73
#define PNG_CN_tIME 0x74494D45L
74
#define PNG_CN_sCAL 0x7343414CL
77
#define MNG_CN_MHDR 0x4D484452L
78
#define MNG_CN_MEND 0x4D454E44L
79
#define MNG_CN_TERM 0x5445524DL
80
#define MNG_CN_BACK 0x4241434BL
82
/* Prediction filters */
86
#define PNG_PF_Average 3
87
#define PNG_PF_Paeth 4
94
PNGERR_UNKNOWN_FILTER,
97
PNGERR_DECOMPRESS_ERROR,
98
PNGERR_FILE_TRUNCATED,
100
PNGERR_UNKNOWN_CHUNK,
101
PNGERR_COMPRESS_ERROR,
102
PNGERR_UNSUPPORTED_FORMAT
104
typedef enum _png_error png_error;
108
/***************************************************************************
110
***************************************************************************/
112
typedef struct _png_text png_text;
116
const char * keyword; /* this is allocated */
117
const char * text; /* this points to a part of keyword */
121
typedef struct _png_info png_info;
125
UINT32 width, height;
128
double xscale, yscale;
130
UINT32 resolution_unit;
133
UINT8 compression_method;
135
UINT8 interlace_method;
148
/***************************************************************************
150
***************************************************************************/
152
void png_free(png_info *pnginfo);
154
png_error png_read_file(core_file *fp, png_info *pnginfo);
155
png_error png_read_bitmap(core_file *fp, bitmap_t **bitmap);
156
png_error png_expand_buffer_8bit(png_info *p);
158
png_error png_add_text(png_info *pnginfo, const char *keyword, const char *text);
159
png_error png_write_bitmap(core_file *fp, png_info *info, bitmap_t *bitmap, int palette_length, const UINT32 *palette);
161
png_error mng_capture_start(core_file *fp, bitmap_t *bitmap, double rate);
162
png_error mng_capture_frame(core_file *fp, png_info *info, bitmap_t *bitmap, int palette_length, const UINT32 *palette);
163
png_error mng_capture_stop(core_file *fp);
165
#endif /* __PNG_H__ */