media/libpng/pnginfo.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libpng/pnginfo.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,273 @@
     1.4 +
     1.5 +/* pnginfo.h - header file for PNG reference library
     1.6 + *
     1.7 + * Copyright (c) 1998-2013 Glenn Randers-Pehrson
     1.8 + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
     1.9 + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
    1.10 + *
    1.11 + * Last changed in libpng 1.6.1 [March 28, 2013]
    1.12 + *
    1.13 + * This code is released under the libpng license.
    1.14 + * For conditions of distribution and use, see the disclaimer
    1.15 + * and license in png.h
    1.16 + */
    1.17 +
    1.18 + /* png_info is a structure that holds the information in a PNG file so
    1.19 + * that the application can find out the characteristics of the image.
    1.20 + * If you are reading the file, this structure will tell you what is
    1.21 + * in the PNG file.  If you are writing the file, fill in the information
    1.22 + * you want to put into the PNG file, using png_set_*() functions, then
    1.23 + * call png_write_info().
    1.24 + *
    1.25 + * The names chosen should be very close to the PNG specification, so
    1.26 + * consult that document for information about the meaning of each field.
    1.27 + *
    1.28 + * With libpng < 0.95, it was only possible to directly set and read the
    1.29 + * the values in the png_info_struct, which meant that the contents and
    1.30 + * order of the values had to remain fixed.  With libpng 0.95 and later,
    1.31 + * however, there are now functions that abstract the contents of
    1.32 + * png_info_struct from the application, so this makes it easier to use
    1.33 + * libpng with dynamic libraries, and even makes it possible to use
    1.34 + * libraries that don't have all of the libpng ancillary chunk-handing
    1.35 + * functionality.  In libpng-1.5.0 this was moved into a separate private
    1.36 + * file that is not visible to applications.
    1.37 + *
    1.38 + * The following members may have allocated storage attached that should be
    1.39 + * cleaned up before the structure is discarded: palette, trans, text,
    1.40 + * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
    1.41 + * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
    1.42 + * are automatically freed when the info structure is deallocated, if they were
    1.43 + * allocated internally by libpng.  This behavior can be changed by means
    1.44 + * of the png_data_freer() function.
    1.45 + *
    1.46 + * More allocation details: all the chunk-reading functions that
    1.47 + * change these members go through the corresponding png_set_*
    1.48 + * functions.  A function to clear these members is available: see
    1.49 + * png_free_data().  The png_set_* functions do not depend on being
    1.50 + * able to point info structure members to any of the storage they are
    1.51 + * passed (they make their own copies), EXCEPT that the png_set_text
    1.52 + * functions use the same storage passed to them in the text_ptr or
    1.53 + * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
    1.54 + * functions do not make their own copies.
    1.55 + */
    1.56 +#ifndef PNGINFO_H
    1.57 +#define PNGINFO_H
    1.58 +
    1.59 +struct png_info_def
    1.60 +{
    1.61 +   /* The following are necessary for every PNG file */
    1.62 +   png_uint_32 width;  /* width of image in pixels (from IHDR) */
    1.63 +   png_uint_32 height; /* height of image in pixels (from IHDR) */
    1.64 +   png_uint_32 valid;  /* valid chunk data (see PNG_INFO_ below) */
    1.65 +   png_size_t rowbytes; /* bytes needed to hold an untransformed row */
    1.66 +   png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
    1.67 +   png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
    1.68 +   png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
    1.69 +   png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
    1.70 +   png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
    1.71 +   /* The following three should have been named *_method not *_type */
    1.72 +   png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
    1.73 +   png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
    1.74 +   png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
    1.75 +
    1.76 +   /* The following are set by png_set_IHDR, called from the application on
    1.77 +    * write, but the are never actually used by the write code.
    1.78 +    */
    1.79 +   png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */
    1.80 +   png_byte pixel_depth;    /* number of bits per pixel */
    1.81 +   png_byte spare_byte;     /* to align the data, and for future use */
    1.82 +
    1.83 +#ifdef PNG_READ_SUPPORTED
    1.84 +   /* This is never set during write */
    1.85 +   png_byte signature[8];   /* magic bytes read by libpng from start of file */
    1.86 +#endif
    1.87 +
    1.88 +   /* The rest of the data is optional.  If you are reading, check the
    1.89 +    * valid field to see if the information in these are valid.  If you
    1.90 +    * are writing, set the valid field to those chunks you want written,
    1.91 +    * and initialize the appropriate fields below.
    1.92 +    */
    1.93 +
    1.94 +#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
    1.95 +   /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
    1.96 +    * defined.  When COLORSPACE is switched on all the colorspace-defining
    1.97 +    * chunks should be enabled, when GAMMA is switched on all the gamma-defining
    1.98 +    * chunks should be enabled.  If this is not done it becomes possible to read
    1.99 +    * inconsistent PNG files and assign a probably incorrect interpretation to
   1.100 +    * the information.  (In other words, by carefully choosing which chunks to
   1.101 +    * recognize the system configuration can select an interpretation for PNG
   1.102 +    * files containing ambiguous data and this will result in inconsistent
   1.103 +    * behavior between different libpng builds!)
   1.104 +    */
   1.105 +   png_colorspace colorspace;
   1.106 +#endif
   1.107 +
   1.108 +#ifdef PNG_iCCP_SUPPORTED
   1.109 +   /* iCCP chunk data. */
   1.110 +   png_charp iccp_name;     /* profile name */
   1.111 +   png_bytep iccp_profile;  /* International Color Consortium profile data */
   1.112 +   png_uint_32 iccp_proflen;  /* ICC profile data length */
   1.113 +#endif
   1.114 +
   1.115 +#ifdef PNG_TEXT_SUPPORTED
   1.116 +   /* The tEXt, and zTXt chunks contain human-readable textual data in
   1.117 +    * uncompressed, compressed, and optionally compressed forms, respectively.
   1.118 +    * The data in "text" is an array of pointers to uncompressed,
   1.119 +    * null-terminated C strings. Each chunk has a keyword that describes the
   1.120 +    * textual data contained in that chunk.  Keywords are not required to be
   1.121 +    * unique, and the text string may be empty.  Any number of text chunks may
   1.122 +    * be in an image.
   1.123 +    */
   1.124 +   int num_text; /* number of comments read or comments to write */
   1.125 +   int max_text; /* current size of text array */
   1.126 +   png_textp text; /* array of comments read or comments to write */
   1.127 +#endif /* PNG_TEXT_SUPPORTED */
   1.128 +
   1.129 +#ifdef PNG_tIME_SUPPORTED
   1.130 +   /* The tIME chunk holds the last time the displayed image data was
   1.131 +    * modified.  See the png_time struct for the contents of this struct.
   1.132 +    */
   1.133 +   png_time mod_time;
   1.134 +#endif
   1.135 +
   1.136 +#ifdef PNG_sBIT_SUPPORTED
   1.137 +   /* The sBIT chunk specifies the number of significant high-order bits
   1.138 +    * in the pixel data.  Values are in the range [1, bit_depth], and are
   1.139 +    * only specified for the channels in the pixel data.  The contents of
   1.140 +    * the low-order bits is not specified.  Data is valid if
   1.141 +    * (valid & PNG_INFO_sBIT) is non-zero.
   1.142 +    */
   1.143 +   png_color_8 sig_bit; /* significant bits in color channels */
   1.144 +#endif
   1.145 +
   1.146 +#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
   1.147 +defined(PNG_READ_BACKGROUND_SUPPORTED)
   1.148 +   /* The tRNS chunk supplies transparency data for paletted images and
   1.149 +    * other image types that don't need a full alpha channel.  There are
   1.150 +    * "num_trans" transparency values for a paletted image, stored in the
   1.151 +    * same order as the palette colors, starting from index 0.  Values
   1.152 +    * for the data are in the range [0, 255], ranging from fully transparent
   1.153 +    * to fully opaque, respectively.  For non-paletted images, there is a
   1.154 +    * single color specified that should be treated as fully transparent.
   1.155 +    * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
   1.156 +    */
   1.157 +   png_bytep trans_alpha;    /* alpha values for paletted image */
   1.158 +   png_color_16 trans_color; /* transparent color for non-palette image */
   1.159 +#endif
   1.160 +
   1.161 +#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
   1.162 +   /* The bKGD chunk gives the suggested image background color if the
   1.163 +    * display program does not have its own background color and the image
   1.164 +    * is needs to composited onto a background before display.  The colors
   1.165 +    * in "background" are normally in the same color space/depth as the
   1.166 +    * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
   1.167 +    */
   1.168 +   png_color_16 background;
   1.169 +#endif
   1.170 +
   1.171 +#ifdef PNG_oFFs_SUPPORTED
   1.172 +   /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
   1.173 +    * and downwards from the top-left corner of the display, page, or other
   1.174 +    * application-specific co-ordinate space.  See the PNG_OFFSET_ defines
   1.175 +    * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.
   1.176 +    */
   1.177 +   png_int_32 x_offset; /* x offset on page */
   1.178 +   png_int_32 y_offset; /* y offset on page */
   1.179 +   png_byte offset_unit_type; /* offset units type */
   1.180 +#endif
   1.181 +
   1.182 +#ifdef PNG_pHYs_SUPPORTED
   1.183 +   /* The pHYs chunk gives the physical pixel density of the image for
   1.184 +    * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
   1.185 +    * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
   1.186 +    */
   1.187 +   png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
   1.188 +   png_uint_32 y_pixels_per_unit; /* vertical pixel density */
   1.189 +   png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
   1.190 +#endif
   1.191 +
   1.192 +#ifdef PNG_hIST_SUPPORTED
   1.193 +   /* The hIST chunk contains the relative frequency or importance of the
   1.194 +    * various palette entries, so that a viewer can intelligently select a
   1.195 +    * reduced-color palette, if required.  Data is an array of "num_palette"
   1.196 +    * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
   1.197 +    * is non-zero.
   1.198 +    */
   1.199 +   png_uint_16p hist;
   1.200 +#endif
   1.201 +
   1.202 +#ifdef PNG_pCAL_SUPPORTED
   1.203 +   /* The pCAL chunk describes a transformation between the stored pixel
   1.204 +    * values and original physical data values used to create the image.
   1.205 +    * The integer range [0, 2^bit_depth - 1] maps to the floating-point
   1.206 +    * range given by [pcal_X0, pcal_X1], and are further transformed by a
   1.207 +    * (possibly non-linear) transformation function given by "pcal_type"
   1.208 +    * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_
   1.209 +    * defines below, and the PNG-Group's PNG extensions document for a
   1.210 +    * complete description of the transformations and how they should be
   1.211 +    * implemented, and for a description of the ASCII parameter strings.
   1.212 +    * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
   1.213 +    */
   1.214 +   png_charp pcal_purpose;  /* pCAL chunk description string */
   1.215 +   png_int_32 pcal_X0;      /* minimum value */
   1.216 +   png_int_32 pcal_X1;      /* maximum value */
   1.217 +   png_charp pcal_units;    /* Latin-1 string giving physical units */
   1.218 +   png_charpp pcal_params;  /* ASCII strings containing parameter values */
   1.219 +   png_byte pcal_type;      /* equation type (see PNG_EQUATION_ below) */
   1.220 +   png_byte pcal_nparams;   /* number of parameters given in pcal_params */
   1.221 +#endif
   1.222 +
   1.223 +/* New members added in libpng-1.0.6 */
   1.224 +   png_uint_32 free_me;     /* flags items libpng is responsible for freeing */
   1.225 +
   1.226 +#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
   1.227 +   /* Storage for unknown chunks that the library doesn't recognize. */
   1.228 +   png_unknown_chunkp unknown_chunks;
   1.229 +
   1.230 +   /* The type of this field is limited by the type of 
   1.231 +    * png_struct::user_chunk_cache_max, else overflow can occur.
   1.232 +    */
   1.233 +   int                unknown_chunks_num;
   1.234 +#endif
   1.235 +
   1.236 +#ifdef PNG_sPLT_SUPPORTED
   1.237 +   /* Data on sPLT chunks (there may be more than one). */
   1.238 +   png_sPLT_tp splt_palettes;
   1.239 +   int         splt_palettes_num; /* Match type returned by png_get API */
   1.240 +#endif
   1.241 +
   1.242 +#ifdef PNG_sCAL_SUPPORTED
   1.243 +   /* The sCAL chunk describes the actual physical dimensions of the
   1.244 +    * subject matter of the graphic.  The chunk contains a unit specification
   1.245 +    * a byte value, and two ASCII strings representing floating-point
   1.246 +    * values.  The values are width and height corresponsing to one pixel
   1.247 +    * in the image.  Data values are valid if (valid & PNG_INFO_sCAL) is
   1.248 +    * non-zero.
   1.249 +    */
   1.250 +   png_byte scal_unit;         /* unit of physical scale */
   1.251 +   png_charp scal_s_width;     /* string containing height */
   1.252 +   png_charp scal_s_height;    /* string containing width */
   1.253 +#endif
   1.254 +
   1.255 +#ifdef PNG_INFO_IMAGE_SUPPORTED
   1.256 +   /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
   1.257 +      non-zero */
   1.258 +   /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
   1.259 +   png_bytepp row_pointers;        /* the image bits */
   1.260 +#endif
   1.261 +
   1.262 +#ifdef PNG_APNG_SUPPORTED
   1.263 +   png_uint_32 num_frames; /* including default image */
   1.264 +   png_uint_32 num_plays;
   1.265 +   png_uint_32 next_frame_width;
   1.266 +   png_uint_32 next_frame_height;
   1.267 +   png_uint_32 next_frame_x_offset;
   1.268 +   png_uint_32 next_frame_y_offset;
   1.269 +   png_uint_16 next_frame_delay_num;
   1.270 +   png_uint_16 next_frame_delay_den;
   1.271 +   png_byte next_frame_dispose_op;
   1.272 +   png_byte next_frame_blend_op;
   1.273 +#endif
   1.274 +
   1.275 +};
   1.276 +#endif /* PNGINFO_H */

mercurial