Rev 1897 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1897 | Rev 3928 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* pnginfo.h - header file for PNG reference library |
1 | /* pnginfo.h - header file for PNG reference library |
2 | * |
2 | * |
3 | * Copyright (c) 1998-2011 Glenn Randers-Pehrson |
3 | * Copyright (c) 1998-2013 Glenn Randers-Pehrson |
4 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
4 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
5 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
5 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
6 | * |
6 | * |
7 | * Last changed in libpng 1.5.0 [January 6, 2011] |
7 | * Last changed in libpng 1.6.1 [March 28, 2013] |
8 | * |
8 | * |
9 | * This code is released under the libpng license. |
9 | * This code is released under the libpng license. |
10 | * For conditions of distribution and use, see the disclaimer |
10 | * For conditions of distribution and use, see the disclaimer |
11 | * and license in png.h |
11 | * and license in png.h |
12 | */ |
12 | */ |
Line 53... | Line 53... | ||
53 | #define PNGINFO_H |
53 | #define PNGINFO_H |
54 | 54 | ||
Line 55... | Line 55... | ||
55 | struct png_info_def |
55 | struct png_info_def |
56 | { |
56 | { |
57 | /* the following are necessary for every PNG file */ |
57 | /* The following are necessary for every PNG file */ |
58 | png_uint_32 width; /* width of image in pixels (from IHDR) */ |
58 | png_uint_32 width; /* width of image in pixels (from IHDR) */ |
59 | png_uint_32 height; /* height of image in pixels (from IHDR) */ |
59 | png_uint_32 height; /* height of image in pixels (from IHDR) */ |
60 | png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ |
60 | png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ |
61 | png_size_t rowbytes; /* bytes needed to hold an untransformed row */ |
61 | png_size_t rowbytes; /* bytes needed to hold an untransformed row */ |
62 | png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ |
62 | png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ |
Line 68... | Line 68... | ||
68 | png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ |
68 | png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ |
69 | png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ |
69 | png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ |
70 | png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ |
70 | png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ |
71 | 71 | ||
Line 72... | Line 72... | ||
72 | /* The following is informational only on read, and not used on writes. */ |
72 | /* The following are set by png_set_IHDR, called from the application on |
- | 73 | * write, but the are never actually used by the write code. |
|
- | 74 | */ |
|
73 | png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */ |
75 | png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */ |
74 | png_byte pixel_depth; /* number of bits per pixel */ |
76 | png_byte pixel_depth; /* number of bits per pixel */ |
75 | png_byte spare_byte; /* to align the data, and for future use */ |
77 | png_byte spare_byte; /* to align the data, and for future use */ |
- | 78 | ||
- | 79 | #ifdef PNG_READ_SUPPORTED |
|
- | 80 | /* This is never set during write */ |
|
76 | png_byte signature[8]; /* magic bytes read by libpng from start of file */ |
81 | png_byte signature[8]; /* magic bytes read by libpng from start of file */ |
- | 82 | #endif |
|
Line 77... | Line 83... | ||
77 | 83 | ||
78 | /* The rest of the data is optional. If you are reading, check the |
84 | /* The rest of the data is optional. If you are reading, check the |
79 | * valid field to see if the information in these are valid. If you |
85 | * valid field to see if the information in these are valid. If you |
80 | * are writing, set the valid field to those chunks you want written, |
86 | * are writing, set the valid field to those chunks you want written, |
81 | * and initialize the appropriate fields below. |
87 | * and initialize the appropriate fields below. |
Line 82... | Line 88... | ||
82 | */ |
88 | */ |
- | 89 | ||
- | 90 | #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED) |
|
- | 91 | /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are |
|
83 | 92 | * defined. When COLORSPACE is switched on all the colorspace-defining |
|
- | 93 | * chunks should be enabled, when GAMMA is switched on all the gamma-defining |
|
- | 94 | * chunks should be enabled. If this is not done it becomes possible to read |
|
84 | #if defined(PNG_gAMA_SUPPORTED) |
95 | * inconsistent PNG files and assign a probably incorrect interpretation to |
85 | /* The gAMA chunk describes the gamma characteristics of the system |
96 | * the information. (In other words, by carefully choosing which chunks to |
- | 97 | * recognize the system configuration can select an interpretation for PNG |
|
86 | * on which the image was created, normally in the range [1.0, 2.5]. |
98 | * files containing ambiguous data and this will result in inconsistent |
87 | * Data is valid if (valid & PNG_INFO_gAMA) is non-zero. |
99 | * behavior between different libpng builds!) |
88 | */ |
100 | */ |
Line 89... | Line 101... | ||
89 | png_fixed_point gamma; |
101 | png_colorspace colorspace; |
90 | #endif |
102 | #endif |
91 | 103 | ||
92 | #ifdef PNG_sRGB_SUPPORTED |
104 | #ifdef PNG_iCCP_SUPPORTED |
- | 105 | /* iCCP chunk data. */ |
|
93 | /* GR-P, 0.96a */ |
106 | png_charp iccp_name; /* profile name */ |
Line 94... | Line 107... | ||
94 | /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */ |
107 | png_bytep iccp_profile; /* International Color Consortium profile data */ |
95 | png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */ |
108 | png_uint_32 iccp_proflen; /* ICC profile data length */ |
96 | #endif |
109 | #endif |
Line 136... | Line 149... | ||
136 | * to fully opaque, respectively. For non-paletted images, there is a |
149 | * to fully opaque, respectively. For non-paletted images, there is a |
137 | * single color specified that should be treated as fully transparent. |
150 | * single color specified that should be treated as fully transparent. |
138 | * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. |
151 | * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. |
139 | */ |
152 | */ |
140 | png_bytep trans; /* alpha values for paletted image */ |
153 | png_bytep trans_alpha; /* alpha values for paletted image */ |
141 | png_bytep trans_alpha; /* alpha values for paletted image */ |
- | |
142 | png_color_16 trans_color; /* transparent color for non-palette image */ |
154 | png_color_16 trans_color; /* transparent color for non-palette image */ |
143 | #endif |
155 | #endif |
144 | 156 | ||
Line 145... | Line 157... | ||
145 | #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) |
157 | #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) |
Line 182... | Line 194... | ||
182 | */ |
194 | */ |
183 | png_uint_16p hist; |
195 | png_uint_16p hist; |
184 | #endif |
196 | #endif |
185 | 197 | ||
Line 186... | Line -... | ||
186 | #ifdef PNG_cHRM_SUPPORTED |
- | |
187 | /* The cHRM chunk describes the CIE color characteristics of the monitor |
- | |
188 | * on which the PNG was created. This data allows the viewer to do gamut |
- | |
189 | * mapping of the input image to ensure that the viewer sees the same |
- | |
190 | * colors in the image as the creator. Values are in the range |
- | |
191 | * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero. |
- | |
192 | */ |
- | |
193 | png_fixed_point x_white; |
- | |
194 | png_fixed_point y_white; |
- | |
195 | png_fixed_point x_red; |
- | |
196 | png_fixed_point y_red; |
- | |
197 | png_fixed_point x_green; |
- | |
198 | png_fixed_point y_green; |
- | |
199 | png_fixed_point x_blue; |
- | |
200 | png_fixed_point y_blue; |
- | |
201 | #endif |
- | |
202 | - | ||
203 | #ifdef PNG_pCAL_SUPPORTED |
198 | #ifdef PNG_pCAL_SUPPORTED |
204 | /* The pCAL chunk describes a transformation between the stored pixel |
199 | /* The pCAL chunk describes a transformation between the stored pixel |
205 | * values and original physical data values used to create the image. |
200 | * values and original physical data values used to create the image. |
206 | * The integer range [0, 2^bit_depth - 1] maps to the floating-point |
201 | * The integer range [0, 2^bit_depth - 1] maps to the floating-point |
207 | * range given by [pcal_X0, pcal_X1], and are further transformed by a |
202 | * range given by [pcal_X0, pcal_X1], and are further transformed by a |
Line 223... | Line 218... | ||
223 | 218 | ||
Line 224... | Line 219... | ||
224 | /* New members added in libpng-1.0.6 */ |
219 | /* New members added in libpng-1.0.6 */ |
225 | png_uint_32 free_me; /* flags items libpng is responsible for freeing */ |
220 | png_uint_32 free_me; /* flags items libpng is responsible for freeing */ |
Line 226... | Line 221... | ||
226 | 221 | ||
227 | #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \ |
- | |
228 | defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) |
222 | #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED |
229 | /* Storage for unknown chunks that the library doesn't recognize. */ |
223 | /* Storage for unknown chunks that the library doesn't recognize. */ |
230 | png_unknown_chunkp unknown_chunks; |
- | |
231 | int unknown_chunks_num; |
- | |
Line 232... | Line -... | ||
232 | #endif |
- | |
233 | - | ||
234 | #ifdef PNG_iCCP_SUPPORTED |
224 | png_unknown_chunkp unknown_chunks; |
235 | /* iCCP chunk data. */ |
225 | |
236 | png_charp iccp_name; /* profile name */ |
226 | /* The type of this field is limited by the type of |
237 | png_bytep iccp_profile; /* International Color Consortium profile data */ |
227 | * png_struct::user_chunk_cache_max, else overflow can occur. |
238 | png_uint_32 iccp_proflen; /* ICC profile data length */ |
228 | */ |
Line 239... | Line 229... | ||
239 | png_byte iccp_compression; /* Always zero */ |
229 | int unknown_chunks_num; |
240 | #endif |
230 | #endif |
241 | 231 | ||
242 | #ifdef PNG_sPLT_SUPPORTED |
232 | #ifdef PNG_sPLT_SUPPORTED |
243 | /* Data on sPLT chunks (there may be more than one). */ |
233 | /* Data on sPLT chunks (there may be more than one). */ |
Line 244... | Line 234... | ||
244 | png_sPLT_tp splt_palettes; |
234 | png_sPLT_tp splt_palettes; |
245 | png_uint_32 splt_palettes_num; |
235 | int splt_palettes_num; /* Match type returned by png_get API */ |
246 | #endif |
236 | #endif |