-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathpng.h
145 lines (123 loc) · 4.86 KB
/
png.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* This file is part of the Advance project.
*
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Andrea Mazzoleni
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* In addition, as a special exception, Andrea Mazzoleni
* gives permission to link the code of this program with
* the MAME library (or with modified versions of MAME that use the
* same license as MAME), and distribute linked combinations including
* the two. You must obey the GNU General Public License in all
* respects for all of the code used other than MAME. If you modify
* this file, you may extend this exception to your version of the
* file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*/
/** \file
* PNG file support.
*/
#ifndef __PNG_H
#define __PNG_H
#include "extra.h"
#include "fz.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \name PNG_CHUNK */
/*@{*/
#define ADV_PNG_CN_IHDR 0x49484452
#define ADV_PNG_CN_PLTE 0x504C5445
#define ADV_PNG_CN_IDAT 0x49444154
#define ADV_PNG_CN_IEND 0x49454E44
#define ADV_PNG_CN_tRNS 0x74524e53
/*@}*/
adv_error adv_png_read_chunk(adv_fz* f, unsigned char** data, unsigned* size, unsigned* type);
adv_error adv_png_write_chunk(adv_fz* f, unsigned type, const unsigned char* data, unsigned size, unsigned* count);
adv_error adv_png_read_signature(adv_fz* f);
adv_error adv_png_write_signature(adv_fz* f, unsigned* count);
adv_error adv_png_read_iend(adv_fz* f, const unsigned char* data, unsigned data_size, unsigned type);
adv_error adv_png_write_iend(adv_fz* f, unsigned* count);
adv_error adv_png_read_ihdr(
unsigned* pix_width, unsigned* pix_height, unsigned* pix_pixel,
unsigned char** dat_ptr, unsigned* dat_size,
unsigned char** pix_ptr, unsigned* pix_scanline,
unsigned char** pal_ptr, unsigned* pal_size,
unsigned char** rns_ptr, unsigned* rns_size,
adv_fz* f, const unsigned char* data, unsigned data_size
);
adv_error adv_png_write_ihdr(
unsigned pix_width, unsigned pix_height,
unsigned pix_depth, unsigned pix_type,
adv_fz* f, unsigned* count
);
adv_error adv_png_write_idat(
unsigned pix_width, unsigned pix_height, unsigned pix_pixel,
const uint8* pix_ptr, int pix_pixel_pitch, int pix_scanline_pitch,
adv_bool fast,
adv_fz* f, unsigned* count
);
adv_error adv_png_write_raw(
unsigned pix_width, unsigned pix_height, unsigned pix_pixel,
const unsigned char* pix_ptr, int pix_pixel_pitch, int pix_scanline_pitch,
const unsigned char* pal_ptr, unsigned pal_size,
const unsigned char* rns_ptr, unsigned rns_size,
adv_bool fast,
adv_fz* f, unsigned* count
);
void adv_png_expand_4(unsigned width, unsigned height, unsigned char* ptr);
void adv_png_expand_2(unsigned width, unsigned height, unsigned char* ptr);
void adv_png_expand_1(unsigned width, unsigned height, unsigned char* ptr);
void adv_png_unfilter_8(unsigned width, unsigned height, unsigned char* ptr, unsigned line);
void adv_png_unfilter_24(unsigned width, unsigned height, unsigned char* ptr, unsigned line);
void adv_png_unfilter_32(unsigned width, unsigned height, unsigned char* ptr, unsigned line);
/** \addtogroup VideoFile */
/*@{*/
adv_error adv_png_read(
unsigned* pix_width, unsigned* pix_height, unsigned* pix_pixel,
unsigned char** dat_ptr, unsigned* dat_size,
unsigned char** pix_ptr, unsigned* pix_scanline,
unsigned char** pal_ptr, unsigned* pal_size,
adv_fz* f
);
adv_error adv_png_read_rns(
unsigned* pix_width, unsigned* pix_height, unsigned* pix_pixel,
unsigned char** dat_ptr, unsigned* dat_size,
unsigned char** pix_ptr, unsigned* pix_scanline,
unsigned char** pal_ptr, unsigned* pal_size,
unsigned char** rns_ptr, unsigned* rns_size,
adv_fz* f
);
adv_error adv_png_write(
unsigned pix_width, unsigned pix_height, unsigned pix_pixel,
const unsigned char* pix_ptr, int pix_pixel_pitch, int pix_scanline_pitch,
const unsigned char* pal_ptr, unsigned pal_size,
adv_bool fast,
adv_fz* f, unsigned* count
);
adv_error adv_png_write_rns(
unsigned pix_width, unsigned pix_height, unsigned pix_pixel,
const unsigned char* pix_ptr, int pix_pixel_pitch, int pix_scanline_pitch,
const unsigned char* pal_ptr, unsigned pal_size,
const unsigned char* rns_ptr, unsigned rns_size,
adv_bool fast,
adv_fz* f, unsigned* count
);
/*@}*/
#ifdef __cplusplus
};
#endif
#endif