CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/ext/libpng17/pnginfo.h
Views: 1401
1/* pnginfo.h - header file for PNG reference library2*3* Last changed in libpng 1.6.1 [March 28, 2013]4* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson5* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)6* (Version 0.88 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 disclaimer10* and license in png.h11*/1213/* png_info is a structure that holds the information in a PNG file so14* that the application can find out the characteristics of the image.15* If you are reading the file, this structure will tell you what is16* in the PNG file. If you are writing the file, fill in the information17* you want to put into the PNG file, using png_set_*() functions, then18* call png_write_info().19*20* The names chosen should be very close to the PNG specification, so21* consult that document for information about the meaning of each field.22*23* With libpng < 0.95, it was only possible to directly set and read the24* the values in the png_info_struct, which meant that the contents and25* order of the values had to remain fixed. With libpng 0.95 and later,26* however, there are now functions that abstract the contents of27* png_info_struct from the application, so this makes it easier to use28* libpng with dynamic libraries, and even makes it possible to use29* libraries that don't have all of the libpng ancillary chunk-handing30* functionality. In libpng-1.5.0 this was moved into a separate private31* file that is not visible to applications.32*33* The following members may have allocated storage attached that should be34* cleaned up before the structure is discarded: palette, trans, text,35* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,36* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these37* are automatically freed when the info structure is deallocated, if they were38* allocated internally by libpng. This behavior can be changed by means39* of the png_data_freer() function.40*41* More allocation details: all the chunk-reading functions that42* change these members go through the corresponding png_set_*43* functions. A function to clear these members is available: see44* png_free_data(). The png_set_* functions do not depend on being45* able to point info structure members to any of the storage they are46* passed (they make their own copies), EXCEPT that the png_set_text47* functions use the same storage passed to them in the text_ptr or48* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns49* functions do not make their own copies.50*/51#ifndef PNGINFO_H52#define PNGINFO_H5354struct png_info_def55{56/* The following are necessary for every PNG file */57png_uint_32 width; /* width of image in pixels (from IHDR) */58png_uint_32 height; /* height of image in pixels (from IHDR) */59unsigned int valid; /* valid chunk data (see PNG_INFO_ in png.h) */60png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */61unsigned int num_palette:9; /* number of color entries in "palette" (PLTE) */62unsigned int num_trans:9; /* number of transparent palette color (tRNS) */63unsigned int bit_depth:6; /* 1, 2, 4, 8, 16 or 32 bits/channel */64unsigned int format:PNG_RF_BITS; /* row format; see png_struct.h */65/* The following three should have been named *_method not *_type */66png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */67png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */68png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */6970#ifdef PNG_READ_SUPPORTED71/* This is never set during write */72png_byte signature[8]; /* magic bytes read by libpng from start of file */73#endif7475/* The rest of the data is optional. If you are reading, check the76* valid field to see if the information in these are valid. If you77* are writing, set the valid field to those chunks you want written,78* and initialize the appropriate fields below.79*/8081#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)82/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are83* defined. When COLORSPACE is switched on all the colorspace-defining84* chunks should be enabled, when GAMMA is switched on all the gamma-defining85* chunks should be enabled. If this is not done it becomes possible to read86* inconsistent PNG files and assign a probably incorrect interpretation to87* the information. (In other words, by carefully choosing which chunks to88* recognize the system configuration can select an interpretation for PNG89* files containing ambiguous data and this will result in inconsistent90* behavior between different libpng builds!)91*/92png_colorspace colorspace;93#endif9495#ifdef PNG_iCCP_SUPPORTED96/* iCCP chunk data. */97png_charp iccp_name; /* profile name */98png_bytep iccp_profile; /* International Color Consortium profile data */99#endif100101#ifdef PNG_TEXT_SUPPORTED102/* The tEXt, and zTXt chunks contain human-readable textual data in103* uncompressed, compressed, and optionally compressed forms, respectively.104* The data in "text" is an array of pointers to uncompressed,105* null-terminated C strings. Each chunk has a keyword that describes the106* textual data contained in that chunk. Keywords are not required to be107* unique, and the text string may be empty. Any number of text chunks may108* be in an image.109*/110int num_text; /* number of comments read or comments to write */111int max_text; /* current size of text array */112png_textp text; /* array of comments read or comments to write */113#endif /* TEXT */114115#ifdef PNG_tIME_SUPPORTED116/* The tIME chunk holds the last time the displayed image data was117* modified. See the png_time struct for the contents of this struct.118*/119png_time mod_time;120png_byte time_location;121#endif122123#ifdef PNG_sBIT_SUPPORTED124/* The sBIT chunk specifies the number of significant high-order bits125* in the pixel data. Values are in the range [1, bit_depth], and are126* only specified for the channels in the pixel data. The contents of127* the low-order bits is not specified. Data is valid if128* (valid & PNG_INFO_sBIT) is non-zero.129*/130png_color_8 sig_bit; /* significant bits in color channels */131#endif132133#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \134defined(PNG_READ_BACKGROUND_SUPPORTED)135/* The tRNS chunk supplies transparency data for paletted images and136* other image types that don't need a full alpha channel. There are137* "num_trans" transparency values for a paletted image, stored in the138* same order as the palette colors, starting from index 0. Values139* for the data are in the range [0, 255], ranging from fully transparent140* to fully opaque, respectively. For non-paletted images, there is a141* single color specified that should be treated as fully transparent.142* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.143*/144png_bytep trans_alpha; /* alpha values for paletted image */145png_color_16 trans_color; /* transparent color for non-palette image */146#endif147148#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)149/* The bKGD chunk gives the suggested image background color if the150* display program does not have its own background color and the image151* is needs to composited onto a background before display. The colors152* in "background" are normally in the same color space/depth as the153* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.154*/155png_color_16 background;156#endif157158#ifdef PNG_oFFs_SUPPORTED159/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards160* and downwards from the top-left corner of the display, page, or other161* application-specific co-ordinate space. See the PNG_OFFSET_ defines162* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.163*/164png_int_32 x_offset; /* x offset on page */165png_int_32 y_offset; /* y offset on page */166png_byte offset_unit_type; /* offset units type */167#endif168169#ifdef PNG_pHYs_SUPPORTED170/* The pHYs chunk gives the physical pixel density of the image for171* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_172* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.173*/174png_uint_32 x_pixels_per_unit; /* horizontal pixel density */175png_uint_32 y_pixels_per_unit; /* vertical pixel density */176png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */177#endif178179#ifdef PNG_hIST_SUPPORTED180/* The hIST chunk contains the relative frequency or importance of the181* various palette entries, so that a viewer can intelligently select a182* reduced-color palette, if required. Data is an array of "num_palette"183* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)184* is non-zero.185*/186png_uint_16p hist;187#endif188189#ifdef PNG_pCAL_SUPPORTED190/* The pCAL chunk describes a transformation between the stored pixel191* values and original physical data values used to create the image.192* The integer range [0, 2^bit_depth - 1] maps to the floating-point193* range given by [pcal_X0, pcal_X1], and are further transformed by a194* (possibly non-linear) transformation function given by "pcal_type"195* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_196* defines below, and the PNG-Group's PNG extensions document for a197* complete description of the transformations and how they should be198* implemented, and for a description of the ASCII parameter strings.199* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.200*/201png_charp pcal_purpose; /* pCAL chunk description string */202png_int_32 pcal_X0; /* minimum value */203png_int_32 pcal_X1; /* maximum value */204png_charp pcal_units; /* Latin-1 string giving physical units */205png_charpp pcal_params; /* ASCII strings containing parameter values */206png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */207png_byte pcal_nparams; /* number of parameters given in pcal_params */208#endif209210/* New members added in libpng-1.0.6 */211png_uint_32 free_me; /* flags items libpng is responsible for freeing */212213#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED214/* Storage for unknown chunks that the library doesn't recognize. */215png_unknown_chunkp unknown_chunks;216217/* The type of this field is limited by the type of218* png_struct::user_chunk_cache_max, else overflow can occur.219*/220int unknown_chunks_num;221#endif222223#ifdef PNG_sPLT_SUPPORTED224/* Data on sPLT chunks (there may be more than one). */225png_sPLT_tp splt_palettes;226int splt_palettes_num; /* Match type returned by png_get API */227#endif228229#ifdef PNG_sCAL_SUPPORTED230/* The sCAL chunk describes the actual physical dimensions of the231* subject matter of the graphic. The chunk contains a unit specification232* a byte value, and two ASCII strings representing floating-point233* values. The values are width and height corresponsing to one pixel234* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is235* non-zero.236*/237png_byte scal_unit; /* unit of physical scale */238png_charp scal_s_width; /* string containing height */239png_charp scal_s_height; /* string containing width */240#endif241242#ifdef PNG_INFO_IMAGE_SUPPORTED243/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)244non-zero */245/* Data valid if (valid & PNG_INFO_IDAT) non-zero */246png_bytepp row_pointers; /* the image bits */247#endif248249};250#endif /* PNGINFO_H */251252253