Path: blob/master/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
41155 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/* pnginfo.h - header file for PNG reference library25*26* This file is available under and governed by the GNU General Public27* License version 2 only, as published by the Free Software Foundation.28* However, the following notice accompanied the original version of this29* file and, per its terms, should not be removed:30*31* Copyright (c) 2018 Cosmin Truta32* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson33* Copyright (c) 1996-1997 Andreas Dilger34* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.35*36* This code is released under the libpng license.37* For conditions of distribution and use, see the disclaimer38* and license in png.h39*/4041/* png_info is a structure that holds the information in a PNG file so42* that the application can find out the characteristics of the image.43* If you are reading the file, this structure will tell you what is44* in the PNG file. If you are writing the file, fill in the information45* you want to put into the PNG file, using png_set_*() functions, then46* call png_write_info().47*48* The names chosen should be very close to the PNG specification, so49* consult that document for information about the meaning of each field.50*51* With libpng < 0.95, it was only possible to directly set and read the52* the values in the png_info_struct, which meant that the contents and53* order of the values had to remain fixed. With libpng 0.95 and later,54* however, there are now functions that abstract the contents of55* png_info_struct from the application, so this makes it easier to use56* libpng with dynamic libraries, and even makes it possible to use57* libraries that don't have all of the libpng ancillary chunk-handing58* functionality. In libpng-1.5.0 this was moved into a separate private59* file that is not visible to applications.60*61* The following members may have allocated storage attached that should be62* cleaned up before the structure is discarded: palette, trans, text,63* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,64* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these65* are automatically freed when the info structure is deallocated, if they were66* allocated internally by libpng. This behavior can be changed by means67* of the png_data_freer() function.68*69* More allocation details: all the chunk-reading functions that70* change these members go through the corresponding png_set_*71* functions. A function to clear these members is available: see72* png_free_data(). The png_set_* functions do not depend on being73* able to point info structure members to any of the storage they are74* passed (they make their own copies), EXCEPT that the png_set_text75* functions use the same storage passed to them in the text_ptr or76* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns77* functions do not make their own copies.78*/79#ifndef PNGINFO_H80#define PNGINFO_H8182struct png_info_def83{84/* The following are necessary for every PNG file */85png_uint_32 width; /* width of image in pixels (from IHDR) */86png_uint_32 height; /* height of image in pixels (from IHDR) */87png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */88size_t rowbytes; /* bytes needed to hold an untransformed row */89png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */90png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */91png_uint_16 num_trans; /* number of transparent palette color (tRNS) */92png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */93png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */94/* The following three should have been named *_method not *_type */95png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */96png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */97png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */9899/* The following are set by png_set_IHDR, called from the application on100* write, but the are never actually used by the write code.101*/102png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */103png_byte pixel_depth; /* number of bits per pixel */104png_byte spare_byte; /* to align the data, and for future use */105106#ifdef PNG_READ_SUPPORTED107/* This is never set during write */108png_byte signature[8]; /* magic bytes read by libpng from start of file */109#endif110111/* The rest of the data is optional. If you are reading, check the112* valid field to see if the information in these are valid. If you113* are writing, set the valid field to those chunks you want written,114* and initialize the appropriate fields below.115*/116117#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)118/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are119* defined. When COLORSPACE is switched on all the colorspace-defining120* chunks should be enabled, when GAMMA is switched on all the gamma-defining121* chunks should be enabled. If this is not done it becomes possible to read122* inconsistent PNG files and assign a probably incorrect interpretation to123* the information. (In other words, by carefully choosing which chunks to124* recognize the system configuration can select an interpretation for PNG125* files containing ambiguous data and this will result in inconsistent126* behavior between different libpng builds!)127*/128png_colorspace colorspace;129#endif130131#ifdef PNG_iCCP_SUPPORTED132/* iCCP chunk data. */133png_charp iccp_name; /* profile name */134png_bytep iccp_profile; /* International Color Consortium profile data */135png_uint_32 iccp_proflen; /* ICC profile data length */136#endif137138#ifdef PNG_TEXT_SUPPORTED139/* The tEXt, and zTXt chunks contain human-readable textual data in140* uncompressed, compressed, and optionally compressed forms, respectively.141* The data in "text" is an array of pointers to uncompressed,142* null-terminated C strings. Each chunk has a keyword that describes the143* textual data contained in that chunk. Keywords are not required to be144* unique, and the text string may be empty. Any number of text chunks may145* be in an image.146*/147int num_text; /* number of comments read or comments to write */148int max_text; /* current size of text array */149png_textp text; /* array of comments read or comments to write */150#endif /* TEXT */151152#ifdef PNG_tIME_SUPPORTED153/* The tIME chunk holds the last time the displayed image data was154* modified. See the png_time struct for the contents of this struct.155*/156png_time mod_time;157#endif158159#ifdef PNG_sBIT_SUPPORTED160/* The sBIT chunk specifies the number of significant high-order bits161* in the pixel data. Values are in the range [1, bit_depth], and are162* only specified for the channels in the pixel data. The contents of163* the low-order bits is not specified. Data is valid if164* (valid & PNG_INFO_sBIT) is non-zero.165*/166png_color_8 sig_bit; /* significant bits in color channels */167#endif168169#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \170defined(PNG_READ_BACKGROUND_SUPPORTED)171/* The tRNS chunk supplies transparency data for paletted images and172* other image types that don't need a full alpha channel. There are173* "num_trans" transparency values for a paletted image, stored in the174* same order as the palette colors, starting from index 0. Values175* for the data are in the range [0, 255], ranging from fully transparent176* to fully opaque, respectively. For non-paletted images, there is a177* single color specified that should be treated as fully transparent.178* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.179*/180png_bytep trans_alpha; /* alpha values for paletted image */181png_color_16 trans_color; /* transparent color for non-palette image */182#endif183184#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)185/* The bKGD chunk gives the suggested image background color if the186* display program does not have its own background color and the image187* is needs to composited onto a background before display. The colors188* in "background" are normally in the same color space/depth as the189* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.190*/191png_color_16 background;192#endif193194#ifdef PNG_oFFs_SUPPORTED195/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards196* and downwards from the top-left corner of the display, page, or other197* application-specific co-ordinate space. See the PNG_OFFSET_ defines198* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.199*/200png_int_32 x_offset; /* x offset on page */201png_int_32 y_offset; /* y offset on page */202png_byte offset_unit_type; /* offset units type */203#endif204205#ifdef PNG_pHYs_SUPPORTED206/* The pHYs chunk gives the physical pixel density of the image for207* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_208* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.209*/210png_uint_32 x_pixels_per_unit; /* horizontal pixel density */211png_uint_32 y_pixels_per_unit; /* vertical pixel density */212png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */213#endif214215#ifdef PNG_eXIf_SUPPORTED216int num_exif; /* Added at libpng-1.6.31 */217png_bytep exif;218# ifdef PNG_READ_eXIf_SUPPORTED219png_bytep eXIf_buf; /* Added at libpng-1.6.32 */220# endif221#endif222223#ifdef PNG_hIST_SUPPORTED224/* The hIST chunk contains the relative frequency or importance of the225* various palette entries, so that a viewer can intelligently select a226* reduced-color palette, if required. Data is an array of "num_palette"227* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)228* is non-zero.229*/230png_uint_16p hist;231#endif232233#ifdef PNG_pCAL_SUPPORTED234/* The pCAL chunk describes a transformation between the stored pixel235* values and original physical data values used to create the image.236* The integer range [0, 2^bit_depth - 1] maps to the floating-point237* range given by [pcal_X0, pcal_X1], and are further transformed by a238* (possibly non-linear) transformation function given by "pcal_type"239* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_240* defines below, and the PNG-Group's PNG extensions document for a241* complete description of the transformations and how they should be242* implemented, and for a description of the ASCII parameter strings.243* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.244*/245png_charp pcal_purpose; /* pCAL chunk description string */246png_int_32 pcal_X0; /* minimum value */247png_int_32 pcal_X1; /* maximum value */248png_charp pcal_units; /* Latin-1 string giving physical units */249png_charpp pcal_params; /* ASCII strings containing parameter values */250png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */251png_byte pcal_nparams; /* number of parameters given in pcal_params */252#endif253254/* New members added in libpng-1.0.6 */255png_uint_32 free_me; /* flags items libpng is responsible for freeing */256257#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED258/* Storage for unknown chunks that the library doesn't recognize. */259png_unknown_chunkp unknown_chunks;260261/* The type of this field is limited by the type of262* png_struct::user_chunk_cache_max, else overflow can occur.263*/264int unknown_chunks_num;265#endif266267#ifdef PNG_sPLT_SUPPORTED268/* Data on sPLT chunks (there may be more than one). */269png_sPLT_tp splt_palettes;270int splt_palettes_num; /* Match type returned by png_get API */271#endif272273#ifdef PNG_sCAL_SUPPORTED274/* The sCAL chunk describes the actual physical dimensions of the275* subject matter of the graphic. The chunk contains a unit specification276* a byte value, and two ASCII strings representing floating-point277* values. The values are width and height corresponding to one pixel278* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is279* non-zero.280*/281png_byte scal_unit; /* unit of physical scale */282png_charp scal_s_width; /* string containing height */283png_charp scal_s_height; /* string containing width */284#endif285286#ifdef PNG_INFO_IMAGE_SUPPORTED287/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)288non-zero */289/* Data valid if (valid & PNG_INFO_IDAT) non-zero */290png_bytepp row_pointers; /* the image bits */291#endif292293};294#endif /* PNGINFO_H */295296297