📄 png.h
字号:
/* png.h - header file for PNG reference library * * libpng 1.0.2 - June 14, 1998 * For conditions of distribution and use, see the COPYRIGHT NOTICE below. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998 Glenn Randers-Pehrson * * Note about libpng version numbers: * * Due to various miscommunications, unforeseen code incompatibilities * and occasional factors outside the authors' control, version numbering * on the library has not always been consistent and straightforward. * The following table summarizes matters since version 0.89c, which was * the first widely used release: * * source png.h png.h shared-lib * version string int version * ------- ------ ----- ---------- * 0.89c ("1.0 beta 3") 0.89 89 1.0.89 * 0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90] * 0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95] * 0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96] * 0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97] * 0.97c 0.97 97 2.0.97 * 0.98 0.98 98 2.0.98 * 0.99 0.99 98 2.0.99 * 0.99a-m 0.99 99 2.0.99 * 1.00 1.00 100 2.1.0 [int should be 10000] * 1.0.0 1.0.0 100 2.1.0 [int should be 10000] * 1.0.1 1.0.1 10001 2.1.0 * 1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e * * Henceforth the source version will match the shared-library minor * and patch numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The * PNG_PNGLIB_VER macro, which is not used within libpng but is available * for applications, is an unsigned integer of the form xyyzz corresponding * to the source version x.y.z (leading zeros in y and z). * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> * and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html> * * Contributing Authors: * John Bowler * Kevin Bracey * Sam Bushell * Andreas Dilger * Magnus Holmgren * Tom Lane * Dave Martindale * Glenn Randers-Pehrson * Greg Roelofs * Guy Eric Schalnat * Paul Schmidt * Tom Tanner * Willem van Schaik * Tim Wegner * * The contributing authors would like to thank all those who helped * with testing, bug fixes, and patience. This wouldn't have been * possible without all of you. * * Thanks to Frank J. T. Wojcik for helping with the documentation. * * COPYRIGHT NOTICE: * * The PNG Reference Library is supplied "AS IS". The Contributing Authors * and Group 42, Inc. disclaim all warranties, expressed or implied, * including, without limitation, the warranties of merchantability and of * fitness for any purpose. The Contributing Authors and Group 42, Inc. * assume no liability for direct, indirect, incidental, special, exemplary, * or consequential damages, which may result from the use of the PNG * Reference Library, even if advised of the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * 1. The origin of this source code must not be misrepresented. * 2. Altered versions must be plainly marked as such and must not be * misrepresented as being the original source. * 3. This Copyright notice may not be removed or altered from any source or * altered source distribution. * * The Contributing Authors and Group 42, Inc. specifically permit, without * fee, and encourage the use of this source code as a component to * supporting the PNG file format in commercial products. If you use this * source code in a product, acknowledgment is not required but would be * appreciated. */#ifndef _PNG_H#define _PNG_H#ifdef __cplusplusextern "C" {#endif /* __cplusplus *//* This is not the place to learn how to use libpng. The file libpng.txt * describes how to use libpng, and the file example.c summarizes it * with some code on which to build. This file is useful for looking * at the actual function definitions and structure components. *//* include the compression library's header */#include "../zlib/zlib.h"/* include all user configurable info */#include "pngconf.h"/* This file is arranged in several sections. The first section contains * structure and type definitions. The second section contains the external * library functions, while the third has the internal library functions, * which applications aren't expected to use directly. *//* Version information for png.h - this should match the version in png.c */#define PNG_LIBPNG_VER_STRING "1.0.2"/* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */#define PNG_LIBPNG_VER 10002 /* 1.0.2 *//* variables declared in png.c - only it needs to define PNG_NO_EXTERN */#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)/* Version information for C files, stored in png.c. This had better match * the version above. */extern char png_libpng_ver[12]; /* need room for 99.99.99aa *//* Structures to facilitate easy interlacing. See png.c for more details */extern int FARDATA png_pass_start[7];extern int FARDATA png_pass_inc[7];extern int FARDATA png_pass_ystart[7];extern int FARDATA png_pass_yinc[7];extern int FARDATA png_pass_mask[7];extern int FARDATA png_pass_dsp_mask[7];#endif /* PNG_NO_EXTERN *//* Three color definitions. The order of the red, green, and blue, (and the * exact size) is not important, although the size of the fields need to * be png_byte or png_uint_16 (as defined below). */typedef struct png_color_struct{ png_byte red; png_byte green; png_byte blue;} png_color;typedef png_color FAR * png_colorp;typedef png_color FAR * FAR * png_colorpp;typedef struct png_color_16_struct{ png_byte index; /* used for palette files */ png_uint_16 red; /* for use in red green blue files */ png_uint_16 green; png_uint_16 blue; png_uint_16 gray; /* for use in grayscale files */} png_color_16;typedef png_color_16 FAR * png_color_16p;typedef png_color_16 FAR * FAR * png_color_16pp;typedef struct png_color_8_struct{ png_byte red; /* for use in red green blue files */ png_byte green; png_byte blue; png_byte gray; /* for use in grayscale files */ png_byte alpha; /* for alpha channel files */} png_color_8;typedef png_color_8 FAR * png_color_8p;typedef png_color_8 FAR * FAR * png_color_8pp;/* png_text holds the text in a PNG file, and whether they are compressed in the PNG file or not. The "text" field points to a regular C string. */typedef struct png_text_struct{ int compression; /* compression value, see PNG_TEXT_COMPRESSION_ */ png_charp key; /* keyword, 1-79 character description of "text" */ png_charp text; /* comment, may be an empty string (ie "") */ png_size_t text_length; /* length of "text" field */} png_text;typedef png_text FAR * png_textp;typedef png_text FAR * FAR * png_textpp;/* Supported compression types for text in PNG files (tEXt, and zTXt). * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */#define PNG_TEXT_COMPRESSION_NONE_WR -3#define PNG_TEXT_COMPRESSION_zTXt_WR -2#define PNG_TEXT_COMPRESSION_NONE -1#define PNG_TEXT_COMPRESSION_zTXt 0#define PNG_TEXT_COMPRESSION_LAST 1 /* Not a valid value *//* png_time is a way to hold the time in an machine independent way. * Two conversions are provided, both from time_t and struct tm. There * is no portable way to convert to either of these structures, as far * as I know. If you know of a portable way, send it to me. As a side * note - PNG is Year 2000 compliant! */typedef struct png_time_struct{ png_uint_16 year; /* full year, as in, 1995 */ png_byte month; /* month of year, 1 - 12 */ png_byte day; /* day of month, 1 - 31 */ png_byte hour; /* hour of day, 0 - 23 */ png_byte minute; /* minute of hour, 0 - 59 */ png_byte second; /* second of minute, 0 - 60 (for leap seconds) */} png_time;typedef png_time FAR * png_timep;typedef png_time FAR * FAR * png_timepp;/* 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, 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 any case, the order of the parameters in png_info_struct should NOT * be changed for as long as possible to keep compatibility with applications * that use the old direct-access method with png_info_struct. */typedef struct png_info_struct{ /* the following are necessary for every PNG file */ png_uint_32 width; /* width of image in pixels (from IHDR) */ png_uint_32 height; /* height of image in pixels (from IHDR) */ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */ png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */ png_uint_16 num_trans; /* number of transparent palette color (tRNS) */ png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */ png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */ png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ /* The following is informational only on read, and not used on writes. */ png_byte channels; /* number of data channels per pixel (1, 3, 4)*/ png_byte pixel_depth; /* number of bits per pixel */ png_byte spare_byte; /* to align the data, and for future use */ png_byte signature[8]; /* magic bytes read by libpng from start of file */ /* 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. */#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED) || \ defined(PNG_READ_GAMMA_SUPPORTED) /* The gAMA chunk describes the gamma characteristics of the system * on which the image was created, normally in the range [1.0, 2.5].
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -