sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
pnginfo.h
Go to the documentation of this file.
1
/* pnginfo.h - internal structures for libpng
2
*
3
* Copyright (c) 2018-2025 Cosmin Truta
4
* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
5
* Copyright (c) 1996-1997 Andreas Dilger
6
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
7
*
8
* This code is released under the libpng license.
9
* For conditions of distribution and use, see the disclaimer
10
* and license in png.h
11
*/
12
17
#ifndef PNGPRIV_H
18
# error This file must not be included by applications; please include <png.h>
19
#endif
20
21
/* INTERNAL, PRIVATE definition of a PNG.
22
*
23
* png_info is a modifiable description of a PNG datastream. The fields inside
24
* this structure are accessed through png_get_<CHUNK>() functions and modified
25
* using png_set_<CHUNK>() functions.
26
*
27
* Some functions in libpng do directly access members of png_info. However,
28
* this should be avoided. png_struct objects contain members which hold
29
* caches, sometimes optimised, of the values from png_info objects, and
30
* png_info is not passed to the functions which read and write image data.
31
*/
32
#ifndef PNGINFO_H
33
#define PNGINFO_H
34
35
struct
png_info_def
36
{
37
/* The following are necessary for every PNG file */
38
png_uint_32 width;
/* width of image in pixels (from IHDR) */
39
png_uint_32 height;
/* height of image in pixels (from IHDR) */
40
png_uint_32 valid;
/* valid chunk data (see PNG_INFO_ below) */
41
size_t
rowbytes;
/* bytes needed to hold an untransformed row */
42
png_colorp palette;
/* array of color values (valid & PNG_INFO_PLTE) */
43
png_uint_16 num_palette;
/* number of color entries in "palette" (PLTE) */
44
png_uint_16 num_trans;
/* number of transparent palette color (tRNS) */
45
png_byte bit_depth;
/* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
46
png_byte color_type;
/* see PNG_COLOR_TYPE_ below (from IHDR) */
47
/* The following three should have been named *_method not *_type */
48
png_byte compression_type;
/* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
49
png_byte filter_type;
/* must be PNG_FILTER_TYPE_BASE (from IHDR) */
50
png_byte interlace_type;
/* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
51
52
/* The following are set by png_set_IHDR, called from the application on
53
* write, but the are never actually used by the write code.
54
*/
55
png_byte channels;
/* number of data channels per pixel (1, 2, 3, 4) */
56
png_byte pixel_depth;
/* number of bits per pixel */
57
png_byte spare_byte;
/* to align the data, and for future use */
58
59
#ifdef PNG_READ_SUPPORTED
60
/* This is never set during write */
61
png_byte signature[8];
/* magic bytes read by libpng from start of file */
62
#endif
63
64
/* The rest of the data is optional. If you are reading, check the
65
* valid field to see if the information in these are valid. If you
66
* are writing, set the valid field to those chunks you want written,
67
* and initialize the appropriate fields below.
68
*/
69
70
#ifdef PNG_cICP_SUPPORTED
71
/* cICP chunk data */
72
png_byte cicp_colour_primaries;
73
png_byte cicp_transfer_function;
74
png_byte cicp_matrix_coefficients;
75
png_byte cicp_video_full_range_flag;
76
#endif
77
78
#ifdef PNG_iCCP_SUPPORTED
79
/* iCCP chunk data. */
80
png_charp iccp_name;
/* profile name */
81
png_bytep iccp_profile;
/* International Color Consortium profile data */
82
png_uint_32 iccp_proflen;
/* ICC profile data length */
83
#endif
84
85
#ifdef PNG_cLLI_SUPPORTED
86
png_uint_32 maxCLL;
/* cd/m2 (nits) * 10,000 */
87
png_uint_32 maxFALL;
88
#endif
89
90
#ifdef PNG_mDCV_SUPPORTED
91
png_uint_16 mastering_red_x;
/* CIE (xy) x * 50,000 */
92
png_uint_16 mastering_red_y;
93
png_uint_16 mastering_green_x;
94
png_uint_16 mastering_green_y;
95
png_uint_16 mastering_blue_x;
96
png_uint_16 mastering_blue_y;
97
png_uint_16 mastering_white_x;
98
png_uint_16 mastering_white_y;
99
png_uint_32 mastering_maxDL;
/* cd/m2 (nits) * 10,000 */
100
png_uint_32 mastering_minDL;
101
#endif
102
103
#ifdef PNG_TEXT_SUPPORTED
104
/* The tEXt, and zTXt chunks contain human-readable textual data in
105
* uncompressed, compressed, and optionally compressed forms, respectively.
106
* The data in "text" is an array of pointers to uncompressed,
107
* null-terminated C strings. Each chunk has a keyword that describes the
108
* textual data contained in that chunk. Keywords are not required to be
109
* unique, and the text string may be empty. Any number of text chunks may
110
* be in an image.
111
*/
112
int
num_text;
/* number of comments read or comments to write */
113
int
max_text;
/* current size of text array */
114
png_textp text;
/* array of comments read or comments to write */
115
#endif
/* TEXT */
116
117
#ifdef PNG_tIME_SUPPORTED
118
/* The tIME chunk holds the last time the displayed image data was
119
* modified. See the png_time struct for the contents of this struct.
120
*/
121
png_time mod_time;
122
#endif
123
124
#ifdef PNG_sBIT_SUPPORTED
125
/* The sBIT chunk specifies the number of significant high-order bits
126
* in the pixel data. Values are in the range [1, bit_depth], and are
127
* only specified for the channels in the pixel data. The contents of
128
* the low-order bits is not specified. Data is valid if
129
* (valid & PNG_INFO_sBIT) is non-zero.
130
*/
131
png_color_8 sig_bit;
/* significant bits in color channels */
132
#endif
133
134
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
135
defined(PNG_READ_BACKGROUND_SUPPORTED)
136
/* The tRNS chunk supplies transparency data for paletted images and
137
* other image types that don't need a full alpha channel. There are
138
* "num_trans" transparency values for a paletted image, stored in the
139
* same order as the palette colors, starting from index 0. Values
140
* for the data are in the range [0, 255], ranging from fully transparent
141
* to fully opaque, respectively. For non-paletted images, there is a
142
* single color specified that should be treated as fully transparent.
143
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
144
*/
145
png_bytep trans_alpha;
/* alpha values for paletted image */
146
png_color_16 trans_color;
/* transparent color for non-palette image */
147
#endif
148
149
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
150
/* The bKGD chunk gives the suggested image background color if the
151
* display program does not have its own background color and the image
152
* is needs to composited onto a background before display. The colors
153
* in "background" are normally in the same color space/depth as the
154
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
155
*/
156
png_color_16 background;
157
#endif
158
159
#ifdef PNG_oFFs_SUPPORTED
160
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
161
* and downwards from the top-left corner of the display, page, or other
162
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
163
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
164
*/
165
png_int_32 x_offset;
/* x offset on page */
166
png_int_32 y_offset;
/* y offset on page */
167
png_byte offset_unit_type;
/* offset units type */
168
#endif
169
170
#ifdef PNG_pHYs_SUPPORTED
171
/* The pHYs chunk gives the physical pixel density of the image for
172
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
173
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
174
*/
175
png_uint_32 x_pixels_per_unit;
/* horizontal pixel density */
176
png_uint_32 y_pixels_per_unit;
/* vertical pixel density */
177
png_byte phys_unit_type;
/* resolution type (see PNG_RESOLUTION_ below) */
178
#endif
179
180
#ifdef PNG_eXIf_SUPPORTED
181
png_uint_32 num_exif;
/* Added at libpng-1.6.31 */
182
png_bytep exif;
183
#endif
184
185
#ifdef PNG_hIST_SUPPORTED
186
/* The hIST chunk contains the relative frequency or importance of the
187
* various palette entries, so that a viewer can intelligently select a
188
* reduced-color palette, if required. Data is an array of "num_palette"
189
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
190
* is non-zero.
191
*/
192
png_uint_16p hist;
193
#endif
194
195
#ifdef PNG_pCAL_SUPPORTED
196
/* The pCAL chunk describes a transformation between the stored pixel
197
* values and original physical data values used to create the image.
198
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
199
* range given by [pcal_X0, pcal_X1], and are further transformed by a
200
* (possibly non-linear) transformation function given by "pcal_type"
201
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
202
* defines below, and the PNG-Group's PNG extensions document for a
203
* complete description of the transformations and how they should be
204
* implemented, and for a description of the ASCII parameter strings.
205
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
206
*/
207
png_charp pcal_purpose;
/* pCAL chunk description string */
208
png_int_32 pcal_X0;
/* minimum value */
209
png_int_32 pcal_X1;
/* maximum value */
210
png_charp pcal_units;
/* Latin-1 string giving physical units */
211
png_charpp pcal_params;
/* ASCII strings containing parameter values */
212
png_byte pcal_type;
/* equation type (see PNG_EQUATION_ below) */
213
png_byte pcal_nparams;
/* number of parameters given in pcal_params */
214
#endif
215
216
/* New members added in libpng-1.0.6 */
217
png_uint_32 free_me;
/* flags items libpng is responsible for freeing */
218
219
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
220
/* Storage for unknown chunks that the library doesn't recognize. */
221
png_unknown_chunkp unknown_chunks;
222
223
/* The type of this field is limited by the type of
224
* png_struct::user_chunk_cache_max, else overflow can occur.
225
*/
226
int
unknown_chunks_num;
227
#endif
228
229
#ifdef PNG_sPLT_SUPPORTED
230
/* Data on sPLT chunks (there may be more than one). */
231
png_sPLT_tp splt_palettes;
232
int
splt_palettes_num;
/* Match type returned by png_get API */
233
#endif
234
235
#ifdef PNG_sCAL_SUPPORTED
236
/* The sCAL chunk describes the actual physical dimensions of the
237
* subject matter of the graphic. The chunk contains a unit specification
238
* a byte value, and two ASCII strings representing floating-point
239
* values. The values are width and height corresponding to one pixel
240
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
241
* non-zero.
242
*/
243
png_byte scal_unit;
/* unit of physical scale */
244
png_charp scal_s_width;
/* string containing height */
245
png_charp scal_s_height;
/* string containing width */
246
#endif
247
248
#ifdef PNG_INFO_IMAGE_SUPPORTED
249
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
250
non-zero */
251
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
252
png_bytepp row_pointers;
/* the image bits */
253
#endif
254
255
#ifdef PNG_cHRM_SUPPORTED
256
png_xy
cHRM;
257
#endif
258
259
#ifdef PNG_gAMA_SUPPORTED
260
png_fixed_point gamma;
261
#endif
262
263
#ifdef PNG_sRGB_SUPPORTED
264
int
rendering_intent;
265
#endif
266
};
267
#endif
/* PNGINFO_H */
png_info_def
Definition
pnginfo.h:36
png_xy
Definition
pngstruct.h:79
libpng
pnginfo.h
Generated by
1.18.0