File size: 16,685 Bytes
9375c9a |
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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - pnginfo.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.6.1 [March 28, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/</font>
<font color='#009900'>/* png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, using png_set_*() functions, then
* call png_write_info().
*
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality. In libpng-1.5.0 this was moved into a separate private
* file that is not visible to applications.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
* are automatically freed when the info structure is deallocated, if they were
* allocated internally by libpng. This behavior can be changed by means
* of the png_data_freer() function.
*
* More allocation details: all the chunk-reading functions that
* change these members go through the corresponding png_set_*
* functions. A function to clear these members is available: see
* png_free_data(). The png_set_* functions do not depend on being
* able to point info structure members to any of the storage they are
* passed (they make their own copies), EXCEPT that the png_set_text
* functions use the same storage passed to them in the text_ptr or
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/</font>
<font color='#0000FF'>#ifndef</font> PNGINFO_H
<font color='#0000FF'>#define</font> PNGINFO_H
<font color='#0000FF'>struct</font> <b><a name='png_info_def'></a>png_info_def</b>
<b>{</b>
<font color='#009900'>/* The following are necessary for every PNG file */</font>
png_uint_32 width; <font color='#009900'>/* width of image in pixels (from IHDR) */</font>
png_uint_32 height; <font color='#009900'>/* height of image in pixels (from IHDR) */</font>
png_uint_32 valid; <font color='#009900'>/* valid chunk data (see PNG_INFO_ below) */</font>
png_size_t rowbytes; <font color='#009900'>/* bytes needed to hold an untransformed row */</font>
png_colorp palette; <font color='#009900'>/* array of color values (valid & PNG_INFO_PLTE) */</font>
png_uint_16 num_palette; <font color='#009900'>/* number of color entries in "palette" (PLTE) */</font>
png_uint_16 num_trans; <font color='#009900'>/* number of transparent palette color (tRNS) */</font>
png_byte bit_depth; <font color='#009900'>/* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */</font>
png_byte color_type; <font color='#009900'>/* see PNG_COLOR_TYPE_ below (from IHDR) */</font>
<font color='#009900'>/* The following three should have been named *_method not *_type */</font>
png_byte compression_type; <font color='#009900'>/* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */</font>
png_byte filter_type; <font color='#009900'>/* must be PNG_FILTER_TYPE_BASE (from IHDR) */</font>
png_byte interlace_type; <font color='#009900'>/* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */</font>
<font color='#009900'>/* The following are set by png_set_IHDR, called from the application on
* write, but the are never actually used by the write code.
*/</font>
png_byte channels; <font color='#009900'>/* number of data channels per pixel (1, 2, 3, 4) */</font>
png_byte pixel_depth; <font color='#009900'>/* number of bits per pixel */</font>
png_byte spare_byte; <font color='#009900'>/* to align the data, and for future use */</font>
<font color='#0000FF'>#ifdef</font> PNG_READ_SUPPORTED
<font color='#009900'>/* This is never set during write */</font>
png_byte signature[<font color='#979000'>8</font>]; <font color='#009900'>/* magic bytes read by libpng from start of file */</font>
<font color='#0000FF'>#endif</font>
<font color='#009900'>/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
* are writing, set the valid field to those chunks you want written,
* and initialize the appropriate fields below.
*/</font>
<font color='#0000FF'>#if</font> defined<font face='Lucida Console'>(</font>PNG_COLORSPACE_SUPPORTED<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> defined<font face='Lucida Console'>(</font>PNG_GAMMA_SUPPORTED<font face='Lucida Console'>)</font>
<font color='#009900'>/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
* defined. When COLORSPACE is switched on all the colorspace-defining
* chunks should be enabled, when GAMMA is switched on all the gamma-defining
* chunks should be enabled. If this is not done it becomes possible to read
* inconsistent PNG files and assign a probably incorrect interpretation to
* the information. (In other words, by carefully choosing which chunks to
* recognize the system configuration can select an interpretation for PNG
* files containing ambiguous data and this will result in inconsistent
* behavior between different libpng builds!)
*/</font>
png_colorspace colorspace;
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_iCCP_SUPPORTED
<font color='#009900'>/* iCCP chunk data. */</font>
png_charp iccp_name; <font color='#009900'>/* profile name */</font>
png_bytep iccp_profile; <font color='#009900'>/* International Color Consortium profile data */</font>
png_uint_32 iccp_proflen; <font color='#009900'>/* ICC profile data length */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_TEXT_SUPPORTED
<font color='#009900'>/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
* null-terminated C strings. Each chunk has a keyword that describes the
* textual data contained in that chunk. Keywords are not required to be
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/</font>
<font color='#0000FF'><u>int</u></font> num_text; <font color='#009900'>/* number of comments read or comments to write */</font>
<font color='#0000FF'><u>int</u></font> max_text; <font color='#009900'>/* current size of text array */</font>
png_textp text; <font color='#009900'>/* array of comments read or comments to write */</font>
<font color='#0000FF'>#endif</font> <font color='#009900'>/* PNG_TEXT_SUPPORTED */</font>
<font color='#0000FF'>#ifdef</font> PNG_tIME_SUPPORTED
<font color='#009900'>/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/</font>
png_time mod_time;
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_sBIT_SUPPORTED
<font color='#009900'>/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/</font>
png_color_8 sig_bit; <font color='#009900'>/* significant bits in color channels */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#if</font> defined<font face='Lucida Console'>(</font>PNG_tRNS_SUPPORTED<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> defined<font face='Lucida Console'>(</font>PNG_READ_EXPAND_SUPPORTED<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> \
<b><a name='defined'></a>defined</b><font face='Lucida Console'>(</font>PNG_READ_BACKGROUND_SUPPORTED<font face='Lucida Console'>)</font>
<font color='#009900'>/* The tRNS chunk supplies transparency data for paletted images and
* other image types that don't need a full alpha channel. There are
* "num_trans" transparency values for a paletted image, stored in the
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/</font>
png_bytep trans_alpha; <font color='#009900'>/* alpha values for paletted image */</font>
png_color_16 trans_color; <font color='#009900'>/* transparent color for non-palette image */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#if</font> defined<font face='Lucida Console'>(</font>PNG_bKGD_SUPPORTED<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> defined<font face='Lucida Console'>(</font>PNG_READ_BACKGROUND_SUPPORTED<font face='Lucida Console'>)</font>
<font color='#009900'>/* The bKGD chunk gives the suggested image background color if the
* display program does not have its own background color and the image
* is needs to composited onto a background before display. The colors
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/</font>
png_color_16 background;
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_oFFs_SUPPORTED
<font color='#009900'>/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/</font>
png_int_32 x_offset; <font color='#009900'>/* x offset on page */</font>
png_int_32 y_offset; <font color='#009900'>/* y offset on page */</font>
png_byte offset_unit_type; <font color='#009900'>/* offset units type */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_pHYs_SUPPORTED
<font color='#009900'>/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/</font>
png_uint_32 x_pixels_per_unit; <font color='#009900'>/* horizontal pixel density */</font>
png_uint_32 y_pixels_per_unit; <font color='#009900'>/* vertical pixel density */</font>
png_byte phys_unit_type; <font color='#009900'>/* resolution type (see PNG_RESOLUTION_ below) */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_hIST_SUPPORTED
<font color='#009900'>/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/</font>
png_uint_16p hist;
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_pCAL_SUPPORTED
<font color='#009900'>/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
* range given by [pcal_X0, pcal_X1], and are further transformed by a
* (possibly non-linear) transformation function given by "pcal_type"
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
* defines below, and the PNG-Group's PNG extensions document for a
* complete description of the transformations and how they should be
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/</font>
png_charp pcal_purpose; <font color='#009900'>/* pCAL chunk description string */</font>
png_int_32 pcal_X0; <font color='#009900'>/* minimum value */</font>
png_int_32 pcal_X1; <font color='#009900'>/* maximum value */</font>
png_charp pcal_units; <font color='#009900'>/* Latin-1 string giving physical units */</font>
png_charpp pcal_params; <font color='#009900'>/* ASCII strings containing parameter values */</font>
png_byte pcal_type; <font color='#009900'>/* equation type (see PNG_EQUATION_ below) */</font>
png_byte pcal_nparams; <font color='#009900'>/* number of parameters given in pcal_params */</font>
<font color='#0000FF'>#endif</font>
<font color='#009900'>/* New members added in libpng-1.0.6 */</font>
png_uint_32 free_me; <font color='#009900'>/* flags items libpng is responsible for freeing */</font>
<font color='#0000FF'>#ifdef</font> PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
<font color='#009900'>/* Storage for unknown chunks that the library doesn't recognize. */</font>
png_unknown_chunkp unknown_chunks;
<font color='#009900'>/* The type of this field is limited by the type of
* png_struct::user_chunk_cache_max, else overflow can occur.
*/</font>
<font color='#0000FF'><u>int</u></font> unknown_chunks_num;
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_sPLT_SUPPORTED
<font color='#009900'>/* Data on sPLT chunks (there may be more than one). */</font>
png_sPLT_tp splt_palettes;
<font color='#0000FF'><u>int</u></font> splt_palettes_num; <font color='#009900'>/* Match type returned by png_get API */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_sCAL_SUPPORTED
<font color='#009900'>/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height corresponsing to one pixel
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/</font>
png_byte scal_unit; <font color='#009900'>/* unit of physical scale */</font>
png_charp scal_s_width; <font color='#009900'>/* string containing height */</font>
png_charp scal_s_height; <font color='#009900'>/* string containing width */</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#ifdef</font> PNG_INFO_IMAGE_SUPPORTED
<font color='#009900'>/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
non-zero */</font>
<font color='#009900'>/* Data valid if (valid & PNG_INFO_IDAT) non-zero */</font>
png_bytepp row_pointers; <font color='#009900'>/* the image bits */</font>
<font color='#0000FF'>#endif</font>
<b>}</b>;
<font color='#0000FF'>#endif</font> <font color='#009900'>/* PNGINFO_H */</font>
</pre></body></html> |