Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 2 | /* png.h - header file for PNG reference library |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 3 | * |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame^] | 4 | * libpng 0.97 beta |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 5 | * For conditions of distribution and use, see copyright notice in png.h |
| 6 | * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. |
| 7 | * Copyright (c) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame^] | 8 | * Copyright (c) 1998 Glenn Randers-Pehrson |
| 9 | * January 7, 1998 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 10 | * |
| 11 | * BETA NOTICE: |
| 12 | * This is a beta version. It reads and writes valid files on the |
| 13 | * platforms I have, and has had a wide testing program. You may |
| 14 | * have to modify the includes below to get it to work on your |
| 15 | * system, and you may have to supply the correct compiler flags in |
| 16 | * the makefile if you can't find a makefile suitable for your |
| 17 | * operating system/compiler combination. Read libpng.txt for more |
| 18 | * information, including how to contact the authors if you have any |
| 19 | * problems, or if you want your compiler/platform to be supported in |
| 20 | * the next official libpng release. |
| 21 | * |
| 22 | * See libpng.txt for more information. The PNG specification is available |
| 23 | * as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> |
| 24 | * and as a W3C Recommendation <http://www.w3.org/pub/WWW/TR/REC.png.html> |
| 25 | * |
| 26 | * Contributing Authors: |
| 27 | * John Bowler |
| 28 | * Sam Bushell |
| 29 | * Kevin Bracey |
| 30 | * Andreas Dilger |
| 31 | * Magnus Holmgren |
| 32 | * Tom Lane |
| 33 | * Dave Martindale |
| 34 | * Glenn Randers-Pehrson |
| 35 | * Greg Roelofs |
| 36 | * Guy Eric Schalnat |
| 37 | * Paul Schmidt |
| 38 | * Tom Tanner |
| 39 | * Tim Wegner |
| 40 | * |
| 41 | * The contributing authors would like to thank all those who helped |
| 42 | * with testing, bug fixes, and patience. This wouldn't have been |
| 43 | * possible without all of you. |
| 44 | * |
| 45 | * Thanks to Frank J. T. Wojcik for helping with the documentation. |
| 46 | * |
| 47 | * The PNG Reference Library is supplied "AS IS". The Contributing Authors |
| 48 | * and Group 42, Inc. disclaim all warranties, expressed or implied, |
| 49 | * including, without limitation, the warranties of merchantability and of |
| 50 | * fitness for any purpose. The Contributing Authors and Group 42, Inc. |
| 51 | * assume no liability for direct, indirect, incidental, special, exemplary, |
| 52 | * or consequential damages, which may result from the use of the PNG |
| 53 | * Reference Library, even if advised of the possibility of such damage. |
| 54 | * |
| 55 | * Permission is hereby granted to use, copy, modify, and distribute this |
| 56 | * source code, or portions hereof, for any purpose, without fee, subject |
| 57 | * to the following restrictions: |
| 58 | * 1. The origin of this source code must not be misrepresented. |
| 59 | * 2. Altered versions must be plainly marked as such and must not be |
| 60 | * misrepresented as being the original source. |
| 61 | * 3. This Copyright notice may not be removed or altered from any source or |
| 62 | * altered source distribution. |
| 63 | * |
| 64 | * The Contributing Authors and Group 42, Inc. specifically permit, without |
| 65 | * fee, and encourage the use of this source code as a component to |
| 66 | * supporting the PNG file format in commercial products. If you use this |
| 67 | * source code in a product, acknowledgment is not required but would be |
| 68 | * appreciated. |
| 69 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 70 | |
| 71 | #ifndef _PNG_H |
| 72 | #define _PNG_H |
| 73 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 74 | #ifdef __cplusplus |
| 75 | extern "C" { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 76 | #endif /* __cplusplus */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 77 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 78 | /* This is not the place to learn how to use libpng. The file libpng.txt |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 79 | * describes how to use libpng, and the file example.c summarizes it |
| 80 | * with some code on which to build. This file is useful for looking |
| 81 | * at the actual function definitions and structure components. |
| 82 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 83 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 84 | /* include the compression library's header */ |
| 85 | #include "zlib.h" |
| 86 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 87 | /* include all user configurable info */ |
| 88 | #include "pngconf.h" |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 89 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 90 | /* This file is arranged in several sections. The first section contains |
| 91 | * structure and type definitions. The second section contains the external |
| 92 | * library functions, while the third has the internal library functions, |
| 93 | * which applications aren't expected to use directly. |
| 94 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 95 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 96 | /* Version information for png.h - this should match the version in png.c */ |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame^] | 97 | #define PNG_LIBPNG_VER_STRING "0.97" |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 98 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 99 | /* careful here. At one time, I wanted to use 082, but that would be octal. |
| 100 | * Version 1.0 will be 100 here, etc. |
| 101 | */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 102 | #define PNG_LIBPNG_VER 97 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 103 | |
| 104 | /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 105 | #ifndef PNG_NO_EXTERN |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 106 | /* Version information for C files, stored in png.c. This had better match |
| 107 | * the version above. |
| 108 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 109 | extern char png_libpng_ver[]; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 110 | |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame^] | 111 | /* |
| 112 | * Note about libpng version numbers: |
| 113 | * |
| 114 | * Due to various miscommunications, unforeseen code incompatibilities |
| 115 | * and occasional factors outside the authors' control, version numbering |
| 116 | * on the library has not always been consistent and straightforward. |
| 117 | * The following table summarizes matters since version 0.89c, which was |
| 118 | * the first widely used release: |
| 119 | * |
| 120 | * source png.h shared-lib |
| 121 | * version string version |
| 122 | * ------- ------ ---------- |
| 123 | * 0.89c ("1.0 beta 3") 0.89 1.0.89 |
| 124 | * 0.90 ("1.0 beta 4") 0.90 0.90 [should have been 2.0.90] |
| 125 | * 0.95 ("1.0 beta 5") 0.95 0.95 [should have been 2.0.95] |
| 126 | * 0.96 ("1.0 beta 6") 0.96 0.96 [should have been 2.0.96] |
| 127 | * 0.97b ("1.00.97 beta 7") 1.00.97 1.0.0 [should have been 2.0.97] |
| 128 | * 0.97c 0.97 2.0.97 |
| 129 | * 0.98 0.98 2.0.98 |
| 130 | * 0.99 0.99 2.0.99 |
| 131 | * 1.0 1.00 2.1.0 |
| 132 | * |
| 133 | * Henceforth the source version will match the shared-library minor |
| 134 | * and patch numbers; the shared-library major version number will be |
| 135 | * used for changes in backward compatibility, as it is intended. |
| 136 | */ |
| 137 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 138 | /* Structures to facilitate easy interlacing. See png.c for more details */ |
| 139 | extern int FARDATA png_pass_start[]; |
| 140 | extern int FARDATA png_pass_inc[]; |
| 141 | extern int FARDATA png_pass_ystart[]; |
| 142 | extern int FARDATA png_pass_yinc[]; |
| 143 | extern int FARDATA png_pass_mask[]; |
| 144 | extern int FARDATA png_pass_dsp_mask[]; |
| 145 | /* These aren't currently used. If you need them, see png.c for more details |
| 146 | extern int FARDATA png_pass_width[]; |
| 147 | extern int FARDATA png_pass_height[]; |
| 148 | */ |
| 149 | #endif /* PNG_NO_EXTERN */ |
| 150 | |
| 151 | /* Three color definitions. The order of the red, green, and blue, (and the |
| 152 | * exact size) is not important, although the size of the fields need to |
| 153 | * be png_byte or png_uint_16 (as defined below). |
| 154 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 155 | typedef struct png_color_struct |
| 156 | { |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 157 | png_byte red; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 158 | png_byte green; |
| 159 | png_byte blue; |
| 160 | } png_color; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 161 | typedef png_color FAR * png_colorp; |
| 162 | typedef png_color FAR * FAR * png_colorpp; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 163 | |
| 164 | typedef struct png_color_16_struct |
| 165 | { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 166 | png_byte index; /* used for palette files */ |
| 167 | png_uint_16 red; /* for use in red green blue files */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 168 | png_uint_16 green; |
| 169 | png_uint_16 blue; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 170 | png_uint_16 gray; /* for use in grayscale files */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 171 | } png_color_16; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 172 | typedef png_color_16 FAR * png_color_16p; |
| 173 | typedef png_color_16 FAR * FAR * png_color_16pp; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 174 | |
| 175 | typedef struct png_color_8_struct |
| 176 | { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 177 | png_byte red; /* for use in red green blue files */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 178 | png_byte green; |
| 179 | png_byte blue; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 180 | png_byte gray; /* for use in grayscale files */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 181 | png_byte alpha; /* for alpha channel files */ |
| 182 | } png_color_8; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 183 | typedef png_color_8 FAR * png_color_8p; |
| 184 | typedef png_color_8 FAR * FAR * png_color_8pp; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 185 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 186 | /* png_text holds the text in a PNG file, and whether they are compressed |
| 187 | in the PNG file or not. The "text" field points to a regular C string. */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 188 | typedef struct png_text_struct |
| 189 | { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 190 | int compression; /* compression value, see PNG_TEXT_COMPRESSION_ */ |
| 191 | png_charp key; /* keyword, 1-79 character description of "text" */ |
| 192 | png_charp text; /* comment, may be an empty string (ie "") */ |
| 193 | png_size_t text_length; /* length of "text" field */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 194 | } png_text; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 195 | typedef png_text FAR * png_textp; |
| 196 | typedef png_text FAR * FAR * png_textpp; |
| 197 | |
| 198 | /* Supported compression types for text in PNG files (tEXt, and zTXt). |
| 199 | * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ |
| 200 | #define PNG_TEXT_COMPRESSION_NONE_WR -3 |
| 201 | #define PNG_TEXT_COMPRESSION_zTXt_WR -2 |
| 202 | #define PNG_TEXT_COMPRESSION_NONE -1 |
| 203 | #define PNG_TEXT_COMPRESSION_zTXt 0 |
| 204 | #define PNG_TEXT_COMPRESSION_LAST 1 /* Not a valid value */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 205 | |
| 206 | /* png_time is a way to hold the time in an machine independent way. |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 207 | * Two conversions are provided, both from time_t and struct tm. There |
| 208 | * is no portable way to convert to either of these structures, as far |
| 209 | * as I know. If you know of a portable way, send it to me. As a side |
| 210 | * note - PNG is Year 2000 compliant! |
| 211 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 212 | typedef struct png_time_struct |
| 213 | { |
| 214 | png_uint_16 year; /* full year, as in, 1995 */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 215 | png_byte month; /* month of year, 1 - 12 */ |
| 216 | png_byte day; /* day of month, 1 - 31 */ |
| 217 | png_byte hour; /* hour of day, 0 - 23 */ |
| 218 | png_byte minute; /* minute of hour, 0 - 59 */ |
| 219 | png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 220 | } png_time; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 221 | typedef png_time FAR * png_timep; |
| 222 | typedef png_time FAR * FAR * png_timepp; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 223 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 224 | /* png_info is a structure that holds the information in a PNG file so |
| 225 | * that the application can find out the characteristics of the image. |
| 226 | * If you are reading the file, this structure will tell you what is |
| 227 | * in the PNG file. If you are writing the file, fill in the information |
| 228 | * you want to put into the PNG file, then call png_write_info(). |
| 229 | * The names chosen should be very close to the PNG specification, so |
| 230 | * consult that document for information about the meaning of each field. |
| 231 | * |
| 232 | * With libpng < 0.95, it was only possible to directly set and read the |
| 233 | * the values in the png_info_struct, which meant that the contents and |
| 234 | * order of the values had to remain fixed. With libpng 0.95 and later, |
| 235 | * however, * there are now functions which abstract the contents of |
| 236 | * png_info_struct from the application, so this makes it easier to use |
| 237 | * libpng with dynamic libraries, and even makes it possible to use |
| 238 | * libraries that don't have all of the libpng ancillary chunk-handing |
| 239 | * functionality. |
| 240 | * |
| 241 | * In any case, the order of the parameters in png_info_struct should NOT |
| 242 | * be changed for as long as possible to keep compatibility with applications |
| 243 | * that use the old direct-access method with png_info_struct. |
| 244 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 245 | typedef struct png_info_struct |
| 246 | { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 247 | /* the following are necessary for every PNG file */ |
| 248 | png_uint_32 width; /* width of image in pixels (from IHDR) */ |
| 249 | png_uint_32 height; /* height of image in pixels (from IHDR) */ |
| 250 | png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ |
| 251 | png_size_t rowbytes; /* bytes needed to hold an untransformed row */ |
| 252 | png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ |
| 253 | png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */ |
| 254 | png_uint_16 num_trans; /* number of transparent palette color (tRNS) */ |
| 255 | png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */ |
| 256 | png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */ |
| 257 | png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ |
| 258 | png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ |
| 259 | png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 260 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 261 | /* The following is informational only on read, and not used on writes. */ |
| 262 | png_byte channels; /* number of data channels per pixel (1, 3, 4)*/ |
| 263 | png_byte pixel_depth; /* number of bits per pixel */ |
| 264 | png_byte spare_byte; /* to align the data, and for future use */ |
| 265 | png_byte signature[8]; /* magic bytes read by libpng from start of file */ |
| 266 | |
| 267 | /* The rest of the data is optional. If you are reading, check the |
| 268 | * valid field to see if the information in these are valid. If you |
| 269 | * are writing, set the valid field to those chunks you want written, |
| 270 | * and initialize the appropriate fields below. |
| 271 | */ |
| 272 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 273 | #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 274 | /* The gAMA chunk describes the gamma characteristics of the system |
| 275 | * on which the image was created, normally in the range [1.0, 2.5]. |
| 276 | * Data is valid if (valid & PNG_INFO_gAMA) is non-zero. |
| 277 | */ |
| 278 | float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */ |
| 279 | #endif /* PNG_READ_gAMA_SUPPORTED || PNG_WRITE_gAMA_SUPPORTED */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 280 | |
| 281 | #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) |
| 282 | /* GR-P, 0.96a */ |
| 283 | /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */ |
| 284 | png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */ |
| 285 | #endif /* PNG_READ_sRGB_SUPPORTED || PNG_WRITE_sRGB_SUPPORTED */ |
| 286 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 287 | #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ |
| 288 | defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 289 | /* The tEXt and zTXt chunks contain human-readable textual data in |
| 290 | * uncompressed and compressed forms, respectively. The data in "text" |
| 291 | * is an array of pointers to uncompressed, null-terminated C strings. |
| 292 | * Each chunk has a keyword which describes the textual data contained |
| 293 | * in that chunk. Keywords are not required to be unique, and the text |
| 294 | * string may be empty. Any number of text chunks may be in an image. |
| 295 | */ |
| 296 | int num_text; /* number of comments read/to write */ |
| 297 | int max_text; /* current size of text array */ |
| 298 | png_textp text; /* array of comments read/to write */ |
| 299 | #endif /* PNG_READ_tEXt/zTXt_SUPPORTED || PNG_WRITE_tEXt/zTXt_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 300 | #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 301 | /* The tIME chunk holds the last time the displayed image data was |
| 302 | * modified. See the png_time struct for the contents of this struct. |
| 303 | */ |
| 304 | png_time mod_time; |
| 305 | #endif /* PNG_READ_tIME_SUPPORTED || PNG_WRITE_tIME_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 306 | #if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 307 | /* The sBIT chunk specifies the number of significant high-order bits |
| 308 | * in the pixel data. Values are in the range [1, bit_depth], and are |
| 309 | * only specified for the channels in the pixel data. The contents of |
| 310 | * the low-order bits is not specified. Data is valid if |
| 311 | * (valid & PNG_INFO_sBIT) is non-zero. |
| 312 | */ |
| 313 | png_color_8 sig_bit; /* significant bits in color channels */ |
| 314 | #endif /* PNG_READ_sBIT_SUPPORTED || PNG_WRITE_sBIT_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 315 | #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 316 | /* The tRNS chunk supplies transparency data for paletted images and |
| 317 | * other image types that don't need a full alpha channel. There are |
| 318 | * "num_trans" transparency values for a paletted image, stored in the |
| 319 | * same order as the palette colors, starting from index 0. Values |
| 320 | * for the data are in the range [0, 255], ranging from fully transparent |
| 321 | * to fully opaque, respectively. For non-paletted images, there is a |
| 322 | * single color specified which should be treated as fully transparent. |
| 323 | * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. |
| 324 | */ |
| 325 | png_bytep trans; /* transparent values for paletted image */ |
| 326 | png_color_16 trans_values; /* transparent color for non-palette image */ |
| 327 | #endif /* PNG_READ_tRNS_SUPPORTED || PNG_WRITE_tRNS_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 328 | #if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 329 | /* The bKGD chunk gives the suggested image background color if the |
| 330 | * display program does not have its own background color and the image |
| 331 | * is needs to composited onto a background before display. The colors |
| 332 | * in "background" are normally in the same color space/depth as the |
| 333 | * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero. |
| 334 | */ |
| 335 | png_color_16 background; |
| 336 | #endif /* PNG_READ_bKGD_SUPPORTED || PNG_WRITE_bKGD_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 337 | #if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 338 | /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards |
| 339 | * and downwards from the top-left corner of the display, page, or other |
| 340 | * application-specific co-ordinate space. See the PNG_OFFSET_ defines |
| 341 | * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero. |
| 342 | */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 343 | png_uint_32 x_offset; /* x offset on page */ |
| 344 | png_uint_32 y_offset; /* y offset on page */ |
| 345 | png_byte offset_unit_type; /* offset units type */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 346 | #endif /* PNG_READ_oFFs_SUPPORTED || PNG_WRITE_oFFs_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 347 | #if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 348 | /* The pHYs chunk gives the physical pixel density of the image for |
| 349 | * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_ |
| 350 | * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero. |
| 351 | */ |
| 352 | png_uint_32 x_pixels_per_unit; /* horizontal pixel density */ |
| 353 | png_uint_32 y_pixels_per_unit; /* vertical pixel density */ |
| 354 | png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ |
| 355 | #endif /* PNG_READ_pHYs_SUPPORTED || PNG_WRITE_pHYs_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 356 | #if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 357 | /* The hIST chunk contains the relative frequency or importance of the |
| 358 | * various palette entries, so that a viewer can intelligently select a |
| 359 | * reduced-color palette, if required. Data is an array of "num_palette" |
| 360 | * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST) |
| 361 | * is non-zero. |
| 362 | */ |
| 363 | png_uint_16p hist; |
| 364 | #endif /* PNG_READ_hIST_SUPPORTED || PNG_WRITE_hIST_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 365 | #if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 366 | /* The cHRM chunk describes the CIE color characteristics of the monitor |
| 367 | * on which the PNG was created. This data allows the viewer to do gamut |
| 368 | * mapping of the input image to ensure that the viewer sees the same |
| 369 | * colors in the image as the creator. Values are in the range |
| 370 | * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero. |
| 371 | */ |
| 372 | float x_white; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 373 | float y_white; |
| 374 | float x_red; |
| 375 | float y_red; |
| 376 | float x_green; |
| 377 | float y_green; |
| 378 | float x_blue; |
| 379 | float y_blue; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 380 | #endif /* PNG_READ_cHRM_SUPPORTED || PNG_WRITE_cHRM_SUPPORTED */ |
| 381 | #if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) |
| 382 | /* The pCAL chunk describes a transformation between the stored pixel |
| 383 | * values and original physcical data values used to create the image. |
| 384 | * The integer range [0, 2^bit_depth - 1] maps to the floating-point |
| 385 | * range given by [pcal_X0, pcal_X1], and are further transformed by a |
| 386 | * (possibly non-linear) transformation function given by "pcal_type" |
| 387 | * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_ |
| 388 | * defines below, and the PNG-Group's Scientific Visualization extension |
| 389 | * chunks document png-scivis-19970203 for a complete description of the |
| 390 | * transformations and how they should be implemented, as well as the |
| 391 | * png-extensions document for a description of the ASCII parameter |
| 392 | * strings. Data values are valid if (valid & PNG_INFO_pCAL) non-zero. |
| 393 | */ |
| 394 | png_charp pcal_purpose; /* pCAL chunk description string */ |
| 395 | png_int_32 pcal_X0; /* minimum value */ |
| 396 | png_int_32 pcal_X1; /* maximum value */ |
| 397 | png_charp pcal_units; /* Latin-1 string giving physical units */ |
| 398 | png_charpp pcal_params; /* ASCII strings containing parameter values */ |
| 399 | png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */ |
| 400 | png_byte pcal_nparams; /* number of parameters given in pcal_params */ |
| 401 | #endif /* PNG_READ_pCAL_SUPPORTED || PNG_WRITE_pCAL_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 402 | } png_info; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 403 | typedef png_info FAR * png_infop; |
| 404 | typedef png_info FAR * FAR * png_infopp; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 405 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 406 | /* These describe the color_type field in png_info. */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 407 | /* color type masks */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 408 | #define PNG_COLOR_MASK_PALETTE 1 |
| 409 | #define PNG_COLOR_MASK_COLOR 2 |
| 410 | #define PNG_COLOR_MASK_ALPHA 4 |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 411 | |
| 412 | /* color types. Note that not all combinations are legal */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 413 | #define PNG_COLOR_TYPE_GRAY 0 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 414 | #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) |
| 415 | #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) |
| 416 | #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 417 | #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) |
| 418 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 419 | /* This is for compression type. PNG 1.0 only defines the single type. */ |
| 420 | #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ |
| 421 | #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE |
| 422 | |
| 423 | /* This is for filter type. PNG 1.0 only defines the single type. */ |
| 424 | #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ |
| 425 | #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE |
| 426 | |
| 427 | /* These are for the interlacing type. These values should NOT be changed. */ |
| 428 | #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ |
| 429 | #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ |
| 430 | #define PNG_INTERLACE_LAST 2 /* Not a valid value */ |
| 431 | |
| 432 | /* These are for the oFFs chunk. These values should NOT be changed. */ |
| 433 | #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ |
| 434 | #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ |
| 435 | #define PNG_OFFSET_LAST 2 /* Not a valid value */ |
| 436 | |
| 437 | /* These are for the pCAL chunk. These values should NOT be changed. */ |
| 438 | #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ |
| 439 | #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ |
| 440 | #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ |
| 441 | #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ |
| 442 | #define PNG_EQUATION_LAST 4 /* Not a valid value */ |
| 443 | |
| 444 | /* These are for the pHYs chunk. These values should NOT be changed. */ |
| 445 | #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ |
| 446 | #define PNG_RESOLUTION_METER 1 /* pixels/meter */ |
| 447 | #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ |
| 448 | |
| 449 | /* These determine if an ancillary chunk's data has been successfully read |
| 450 | * from the PNG header, or if the application has filled in the corresponding |
| 451 | * data in the info_struct to be written into the output file. The values |
| 452 | * of the PNG_INFO_<chunk> defines should NOT be changed. |
| 453 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 454 | #define PNG_INFO_gAMA 0x0001 |
| 455 | #define PNG_INFO_sBIT 0x0002 |
| 456 | #define PNG_INFO_cHRM 0x0004 |
| 457 | #define PNG_INFO_PLTE 0x0008 |
| 458 | #define PNG_INFO_tRNS 0x0010 |
| 459 | #define PNG_INFO_bKGD 0x0020 |
| 460 | #define PNG_INFO_hIST 0x0040 |
| 461 | #define PNG_INFO_pHYs 0x0080 |
| 462 | #define PNG_INFO_oFFs 0x0100 |
| 463 | #define PNG_INFO_tIME 0x0200 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 464 | #define PNG_INFO_pCAL 0x0400 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 465 | #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 466 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 467 | /* This is used for the transformation routines, as some of them |
| 468 | * change these values for the row. It also should enable using |
| 469 | * the routines for other purposes. |
| 470 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 471 | typedef struct png_row_info_struct |
| 472 | { |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 473 | png_uint_32 width; /* width of row */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 474 | png_size_t rowbytes; /* number of bytes in row */ |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 475 | png_byte color_type; /* color type of row */ |
| 476 | png_byte bit_depth; /* bit depth of row */ |
| 477 | png_byte channels; /* number of channels (1, 2, 3, or 4) */ |
| 478 | png_byte pixel_depth; /* bits per pixel (depth * channels) */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 479 | } png_row_info; |
| 480 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 481 | typedef png_row_info FAR * png_row_infop; |
| 482 | typedef png_row_info FAR * FAR * png_row_infopp; |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 483 | |
| 484 | /* These are the function types for the I/O functions, and the functions which |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 485 | * modify the default I/O functions to user I/O functions. The png_error_ptr |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 486 | * type should match that of user supplied warning and error functions, while |
| 487 | * the png_rw_ptr type should match that of the user read/write data functions. |
| 488 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 489 | typedef struct png_struct_def png_struct; |
| 490 | typedef png_struct FAR * png_structp; |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 491 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 492 | typedef void (*png_error_ptr) PNGARG((png_structp, png_const_charp)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 493 | typedef void (*png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 494 | typedef void (*png_flush_ptr) PNGARG((png_structp)); |
Guy Schalnat | 69b1448 | 1996-01-10 02:56:49 -0600 | [diff] [blame] | 495 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 496 | typedef void (*png_progressive_info_ptr) PNGARG((png_structp, png_infop)); |
| 497 | typedef void (*png_progressive_end_ptr) PNGARG((png_structp, png_infop)); |
| 498 | typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 499 | png_uint_32, int)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 500 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 501 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 502 | /* The structure that holds the information to read and write PNG files. |
| 503 | * The only people who need to care about what is inside of this are the |
| 504 | * people who will be modifying the library for their own special needs. |
| 505 | * It should NOT be accessed directly by an application, except to store |
| 506 | * the jmp_buf. |
| 507 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 508 | |
Guy Schalnat | 69b1448 | 1996-01-10 02:56:49 -0600 | [diff] [blame] | 509 | struct png_struct_def |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 510 | { |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 511 | jmp_buf jmpbuf; /* used in png_error */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 512 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 513 | png_error_ptr error_fn; /* function for printing errors and aborting */ |
| 514 | png_error_ptr warning_fn; /* function for printing warnings */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 515 | png_voidp error_ptr; /* user supplied struct for error functions */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 516 | png_rw_ptr write_data_fn; /* function for writing output data */ |
| 517 | png_rw_ptr read_data_fn; /* function for reading input data */ |
| 518 | png_voidp io_ptr; /* ptr to application struct for I/O functions*/ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 519 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 520 | png_uint_32 mode; /* tells us whre we are in the PNG file */ |
| 521 | png_uint_32 flags; /* flags indicating various things to libpng */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 522 | png_uint_32 transformations; /* which transformations to perform */ |
| 523 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 524 | z_stream zstream; /* pointer to decompression structure (below) */ |
| 525 | png_bytep zbuf; /* buffer for zlib */ |
| 526 | png_size_t zbuf_size; /* size of zbuf */ |
| 527 | int zlib_level; /* holds zlib compression level */ |
| 528 | int zlib_method; /* holds zlib compression method */ |
| 529 | int zlib_window_bits; /* holds zlib compression window bits */ |
| 530 | int zlib_mem_level; /* holds zlib compression memory level */ |
| 531 | int zlib_strategy; /* holds zlib compression strategy */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 532 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 533 | png_uint_32 width; /* width of image in pixels */ |
| 534 | png_uint_32 height; /* height of image in pixels */ |
| 535 | png_uint_32 num_rows; /* number of rows in current pass */ |
| 536 | png_uint_32 usr_width; /* width of row at start of write */ |
| 537 | png_size_t rowbytes; /* size of row in bytes */ |
| 538 | png_size_t irowbytes; /* size of current interlaced row in bytes */ |
| 539 | png_uint_32 iwidth; /* width of current interlaced row in pixels */ |
| 540 | png_uint_32 row_number; /* current row in interlace pass */ |
| 541 | png_bytep prev_row; /* buffer to save previous (unfiltered) row */ |
| 542 | png_bytep row_buf; /* buffer to save current (unfiltered) row */ |
| 543 | png_bytep sub_row; /* buffer to save "sub" row when filtering */ |
| 544 | png_bytep up_row; /* buffer to save "up" row when filtering */ |
| 545 | png_bytep avg_row; /* buffer to save "avg" row when filtering */ |
| 546 | png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ |
| 547 | png_row_info row_info; /* used for transformation routines */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 548 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 549 | png_uint_32 idat_size; /* current IDAT size for read */ |
| 550 | png_uint_32 crc; /* current chunk CRC value */ |
| 551 | png_colorp palette; /* palette from the input file */ |
| 552 | png_uint_16 num_palette; /* number of color entries in palette */ |
| 553 | png_uint_16 num_trans; /* number of transparency values */ |
| 554 | png_byte chunk_name[5]; /* null-terminated name of current chunk */ |
| 555 | png_byte compression; /* file compression type (always 0) */ |
| 556 | png_byte filter; /* file filter type (always 0) */ |
| 557 | png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ |
| 558 | png_byte pass; /* current interlace pass (0 - 6) */ |
| 559 | png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ |
| 560 | png_byte color_type; /* color type of file */ |
| 561 | png_byte bit_depth; /* bit depth of file */ |
| 562 | png_byte usr_bit_depth; /* bit depth of users row */ |
| 563 | png_byte pixel_depth; /* number of bits per pixel */ |
| 564 | png_byte channels; /* number of channels in file */ |
| 565 | png_byte usr_channels; /* channels at start of write */ |
| 566 | png_byte sig_bytes; /* magic bytes read/written from start of file */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 567 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 568 | #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 569 | png_byte filler; /* filler byte for 24->32-bit pixel expansion */ |
| 570 | #endif /* PNG_READ_FILLER_SUPPORTED */ |
| 571 | #if defined(PNG_READ_bKGD_SUPPORTED) |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 572 | png_byte background_gamma_type; |
| 573 | float background_gamma; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 574 | png_color_16 background; /* background color in screen gamma space */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 575 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
| 576 | png_color_16 background_1; /* background normalized to gamma 1.0 */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 577 | #endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */ |
| 578 | #endif /* PNG_READ_bKGD_SUPPORTED */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 579 | #if defined(PNG_WRITE_FLUSH_SUPPORTED) |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 580 | png_flush_ptr output_flush_fn;/* Function for flushing output */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 581 | png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ |
| 582 | png_uint_32 flush_rows; /* number of rows written since last flush */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 583 | #endif /* PNG_WRITE_FLUSH_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 584 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 585 | int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ |
| 586 | float gamma; /* file gamma value */ |
| 587 | float display_gamma; /* display gamma value */ |
| 588 | #endif /* PNG_READ_GAMMA_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 589 | #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 590 | png_bytep gamma_table; /* gamma table for 8 bit depth files */ |
| 591 | png_bytep gamma_from_1; /* converts from 1.0 to screen */ |
| 592 | png_bytep gamma_to_1; /* converts from file to 1.0 */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 593 | png_uint_16pp gamma_16_table; /* gamma table for 16 bit depth files */ |
| 594 | png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ |
| 595 | png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 596 | #endif /* PNG_READ_GAMMA_SUPPORTED || PNG_WRITE_GAMMA_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 597 | #if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 598 | png_color_8 sig_bit; /* significant bits in each available channel */ |
| 599 | #endif /* PNG_READ_GAMMA_SUPPORTED || PNG_READ_sBIT_SUPPORTED */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 600 | #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 601 | png_color_8 shift; /* shift for significant bit tranformation */ |
| 602 | #endif /* PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED */ |
| 603 | #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) |
| 604 | png_bytep trans; /* transparency values for paletted files */ |
| 605 | png_color_16 trans_values; /* transparency values for non-paletted files */ |
| 606 | #endif /* PNG_READ_tRNS_SUPPORTED || PNG_READ_BACKGROUND_SUPPORTED */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 607 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 608 | png_progressive_info_ptr info_fn; /* called after header data fully read */ |
| 609 | png_progressive_row_ptr row_fn; /* called after each row is decoded */ |
| 610 | png_progressive_end_ptr end_fn; /* called after image is complete */ |
| 611 | png_bytep save_buffer_ptr; /* current location in save_buffer */ |
| 612 | png_bytep save_buffer; /* buffer for previously read data */ |
| 613 | png_bytep current_buffer_ptr; /* current location in current_buffer */ |
| 614 | png_bytep current_buffer; /* buffer for recently used data */ |
| 615 | png_uint_32 push_length; /* size of current input chunk */ |
| 616 | png_uint_32 skip_length; /* bytes to skip in input data */ |
| 617 | png_size_t save_buffer_size; /* amount of data now in save_buffer */ |
| 618 | png_size_t save_buffer_max; /* total size of save_buffer */ |
| 619 | png_size_t buffer_size; /* total amount of available input data */ |
| 620 | png_size_t current_buffer_size; /* amount of data now in current_buffer */ |
| 621 | int process_mode; /* what push library is currently doing */ |
| 622 | int cur_palette; /* current push library palette index */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 623 | #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 624 | png_size_t current_text_size; /* current size of text input data */ |
| 625 | png_size_t current_text_left; /* how much text left to read in input */ |
| 626 | png_charp current_text; /* current text chunk buffer */ |
| 627 | png_charp current_text_ptr; /* current location in current_text */ |
| 628 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_READ_tEXt/zTXt_SUPPORTED */ |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 629 | #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) |
| 630 | /* for the Borland special 64K segment handler */ |
| 631 | png_bytepp offset_table_ptr; |
| 632 | png_bytep offset_table; |
| 633 | png_uint_16 offset_table_number; |
| 634 | png_uint_16 offset_table_count; |
| 635 | png_uint_16 offset_table_count_free; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 636 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED&&__TURBOC__&&!_Windows&&!__FLAT__ */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 637 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 638 | #if defined(PNG_READ_DITHER_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 639 | png_bytep palette_lookup; /* lookup table for dithering */ |
| 640 | png_bytep dither_index; /* index translation for palette files */ |
| 641 | png_uint_16p hist; /* histogram */ |
| 642 | #endif /* PNG_READ_DITHER_SUPPORTED */ |
| 643 | #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) |
| 644 | png_byte heuristic_method; /* heuristic for row filter selection */ |
| 645 | png_byte num_prev_filters; /* number of weights for previous rows */ |
| 646 | png_bytep prev_filters; /* filter type(s) of previous row(s) */ |
| 647 | png_uint_16p filter_weights; /* weight(s) for previous line(s) */ |
| 648 | png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ |
| 649 | png_uint_16p filter_costs; /* relative filter calculation cost */ |
| 650 | png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ |
| 651 | #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 652 | #if defined(PNG_TIME_RFC1152_SUPPORTED) |
| 653 | png_charp time_buffer; /* String to hold RFC 1152 time text */ |
| 654 | #endif /* PNG_TIME_RFC1152_SUPPORTED */ |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 655 | }; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 656 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 657 | typedef png_struct FAR * FAR * png_structpp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 658 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 659 | /* Here are the function definitions most commonly used. This is not |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 660 | * the place to find out how to use libpng. See libpng.txt for the |
| 661 | * full explanation, see example.c for the summary. This just provides |
| 662 | * a simple one line of the use of each function. |
| 663 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 664 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 665 | /* Tell lib we have already handled the first <num_bytes> magic bytes. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 666 | * Handling more than 8 bytes from the beginning of the file is an error. |
| 667 | */ |
| 668 | extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, |
| 669 | int num_bytes)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 670 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 671 | /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a |
| 672 | * PNG file. Returns zero if the supplied bytes match the 8-byte PNG |
| 673 | * signature, and non-zero otherwise. Having num_to_check == 0 or |
| 674 | * start > 7 will always fail (ie return non-zero). |
| 675 | */ |
| 676 | extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, |
| 677 | png_size_t num_to_check)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 678 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 679 | /* Simple signature checking function. This is the same as calling |
| 680 | * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). |
| 681 | */ |
| 682 | extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 683 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 684 | /* Allocate and initialize png_ptr struct for reading, and any other memory. */ |
| 685 | extern PNG_EXPORT(png_structp,png_create_read_struct) |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 686 | PNGARG((png_const_charp user_png_ver, voidp error_ptr, |
| 687 | png_error_ptr error_fn, png_error_ptr warn_fn)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 688 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 689 | /* Allocate and initialize png_ptr struct for reading, and any other memory */ |
| 690 | extern PNG_EXPORT(png_structp,png_create_write_struct) |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 691 | PNGARG((png_const_charp user_png_ver, voidp error_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 692 | png_error_ptr error_fn, png_error_ptr warn_fn)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 693 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 694 | /* Allocate and initialize the info structure */ |
| 695 | extern PNG_EXPORT(png_infop,png_create_info_struct) |
| 696 | PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 697 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 698 | /* Initialize the info structure (old interface - NOT DLL EXPORTED) */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 699 | extern void png_info_init PNGARG((png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 700 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 701 | /* Writes all the PNG information before the image. */ |
| 702 | extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, |
| 703 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 704 | |
| 705 | /* read the information before the actual image data. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 706 | extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, |
| 707 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 708 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 709 | #if defined(PNG_TIME_RFC1152_SUPPORTED) |
| 710 | extern PNG_EXPORT(png_charp,png_convert_to_rfc1152) |
| 711 | PNGARG((png_structp png_ptr, png_timep ptime)); |
| 712 | #endif /* PNG_TIME_RFC1152_SUPPORTED */ |
| 713 | |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 714 | #if defined(PNG_WRITE_tIME_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 715 | /* convert from a struct tm to png_time */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 716 | extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 717 | struct tm FAR * ttime)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 718 | |
| 719 | /* convert from time_t to png_time. Uses gmtime() */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 720 | extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, |
| 721 | time_t ttime)); |
| 722 | #endif /* PNG_WRITE_tIME_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 723 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 724 | #if defined(PNG_READ_EXPAND_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 725 | /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha if available. */ |
| 726 | extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); |
| 727 | #endif /* PNG_READ_EXPAND_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 728 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 729 | #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 730 | /* Use blue, green, red order for pixels. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 731 | extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); |
| 732 | #endif /* PNG_READ_BGR_SUPPORTED || PNG_WRITE_BGR_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 733 | |
Guy Schalnat | 69b1448 | 1996-01-10 02:56:49 -0600 | [diff] [blame] | 734 | #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) |
| 735 | /* Expand the grayscale to 24 bit RGB if necessary. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 736 | extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); |
| 737 | #endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED */ |
Guy Schalnat | 69b1448 | 1996-01-10 02:56:49 -0600 | [diff] [blame] | 738 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 739 | #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) |
| 740 | /* Reduce RGB to grayscale. (Not yet implemented) */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 741 | extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr)); |
| 742 | #endif /* PNG_READ_RGB_TO_GRAY_SUPPORTED */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 743 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 744 | extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 745 | png_colorp palette)); |
| 746 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 747 | #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) |
| 748 | extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); |
| 749 | #endif /* PNG_READ_STRIP_ALPHA_SUPPORTED */ |
| 750 | |
| 751 | #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ |
| 752 | defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) |
| 753 | extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); |
| 754 | #endif /* PNG_READ_SWAP_ALPHA_SUPPORTED || PNG_WRITE_SWAP_ALPHA_SUPPORTED */ |
| 755 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 756 | #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 757 | /* Add a filler byte to 24-bit RGB images. */ |
| 758 | extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, |
| 759 | png_uint_32 filler, int flags)); |
| 760 | |
| 761 | /* The values of the PNG_FILLER_ defines should NOT be changed */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 762 | #define PNG_FILLER_BEFORE 0 |
| 763 | #define PNG_FILLER_AFTER 1 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 764 | #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 765 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 766 | #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 767 | /* Swap bytes in 16 bit depth files. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 768 | extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); |
| 769 | #endif /* PNG_READ_SWAP_SUPPORTED || PNG_WRITE_SWAP_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 770 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 771 | #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 772 | /* Use 1 byte per pixel in 1, 2, or 4 bit depth files. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 773 | extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); |
| 774 | #endif /* PNG_READ_PACK_SUPPORTED || PNG_WRITE_PACK_SUPPORTED */ |
| 775 | |
| 776 | #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPOR) |
| 777 | /* Swap packing order of pixels in bytes. */ |
| 778 | extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); |
| 779 | #endif /* PNG_READ_PACKSWAP_SUPPORTED || PNG_WRITE_PACKSWAP_SUPPOR */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 780 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 781 | #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 782 | /* Converts files to legal bit depths. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 783 | extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 784 | png_color_8p true_bits)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 785 | #endif /* PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 786 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 787 | #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ |
| 788 | defined(PNG_WRITE_INTERLACING_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 789 | /* Have the code handle the interlacing. Returns the number of passes. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 790 | extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); |
| 791 | #endif /* PNG_READ_INTERLACING_SUPPORTED || PNG_WRITE_INTERLACING_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 792 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 793 | #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 794 | /* Invert monocrome files */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 795 | extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); |
| 796 | #endif /* PNG_READ_INVERT_SUPPORTED || PNG_WRITE_INVERT_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 797 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 798 | #if defined(PNG_READ_BACKGROUND_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 799 | /* Handle alpha and tRNS by replacing with a background color. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 800 | extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, |
| 801 | png_color_16p background_color, int background_gamma_code, |
| 802 | int need_expand, double background_gamma)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 803 | #define PNG_BACKGROUND_GAMMA_UNKNOWN 0 |
| 804 | #define PNG_BACKGROUND_GAMMA_SCREEN 1 |
| 805 | #define PNG_BACKGROUND_GAMMA_FILE 2 |
| 806 | #define PNG_BACKGROUND_GAMMA_UNIQUE 3 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 807 | #endif /* PNG_READ_BACKGROUND_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 808 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 809 | #if defined(PNG_READ_16_TO_8_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 810 | /* strip the second byte of information from a 16 bit depth file. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 811 | extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); |
| 812 | #endif /* PNG_READ_16_TO_8_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 813 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 814 | #if defined(PNG_READ_DITHER_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 815 | /* Turn on dithering, and reduce the palette to the number of colors available. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 816 | extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, |
| 817 | png_colorp palette, int num_palette, int maximum_colors, |
| 818 | png_uint_16p histogram, int full_dither)); |
| 819 | #endif /* PNG_READ_DITHER_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 820 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 821 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 822 | /* Handle gamma correction. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 823 | extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, |
| 824 | double screen_gamma, double default_file_gamma)); |
| 825 | #endif /* PNG_READ_GAMMA_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 826 | |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 827 | #if defined(PNG_WRITE_FLUSH_SUPPORTED) |
| 828 | /* Set how many lines between output flushes - 0 for no flushing */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 829 | extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 830 | |
| 831 | /* Flush the current PNG output buffer */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 832 | extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 833 | #endif /* PNG_WRITE_FLUSH_SUPPORTED */ |
| 834 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 835 | /* optional update palette with requested transformations */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 836 | extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 837 | |
| 838 | /* optional call to update the users info structure */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 839 | extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 840 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 841 | |
| 842 | /* read a one or more rows of image data.*/ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 843 | extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, |
| 844 | png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 845 | |
| 846 | /* read a row of data.*/ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 847 | extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 848 | png_bytep row, |
| 849 | png_bytep display_row)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 850 | |
| 851 | /* read the whole image into memory at once. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 852 | extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 853 | png_bytepp image)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 854 | |
| 855 | /* write a row of image data */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 856 | extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 857 | png_bytep row)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 858 | |
| 859 | /* write a few rows of image data */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 860 | extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, |
| 861 | png_bytepp row, png_uint_32 num_rows)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 862 | |
| 863 | /* write the image data */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 864 | extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, |
| 865 | png_bytepp image)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 866 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 867 | /* writes the end of the PNG file. */ |
| 868 | extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, |
| 869 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 870 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 871 | /* read the end of the PNG file. */ |
| 872 | extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, |
| 873 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 874 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 875 | /* free any memory associated with the png_info_struct */ |
| 876 | extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 877 | png_infopp info_ptr_ptr)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 878 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 879 | /* free any memory associated with the png_struct and the png_info_structs */ |
| 880 | extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp |
| 881 | png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 882 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 883 | /* free all memory used by the read (old method - NOT DLL EXPORTED) */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 884 | extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 885 | png_infop end_info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 886 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 887 | /* free any memory associated with the png_struct and the png_info_structs */ |
| 888 | extern PNG_EXPORT(void,png_destroy_write_struct) |
| 889 | PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 890 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 891 | /* free any memory used in info_ptr struct (old method - NOT DLL EXPORTED) */ |
| 892 | extern void png_write_destroy_info PNGARG((png_infop info_ptr)); |
| 893 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 894 | /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 895 | extern void png_write_destroy PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 896 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 897 | /* set the libpng method of handling chunk CRC errors */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 898 | extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, |
| 899 | int crit_action, int ancil_action)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 900 | |
| 901 | /* Values for png_set_crc_action() to say how to handle CRC errors in |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 902 | * ancillary and critical chunks, and whether to use the data contained |
| 903 | * therein. Note that it is impossible to "discard" data in a critical |
| 904 | * chunk. For versions prior to 0.90, the action was always error/quit, |
| 905 | * whereas in version 0.90 and later, the action for CRC errors in ancillary |
| 906 | * chunks is warn/discard. These values should NOT be changed. |
| 907 | * |
| 908 | * value action:critical action:ancillary |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 909 | */ |
| 910 | #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ |
| 911 | #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ |
| 912 | #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ |
| 913 | #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ |
| 914 | #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ |
| 915 | #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ |
| 916 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 917 | /* These functions give the user control over the scan-line filtering in |
| 918 | * libpng and the compression methods used by zlib. These functions are |
| 919 | * mainly useful for testing, as the defaults should work with most users. |
| 920 | * Those users who are tight on memory or want faster performance at the |
| 921 | * expense of compression can modify them. See the compression library |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 922 | * header file (zlib.h) for an explination of the compression functions. |
| 923 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 924 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 925 | /* set the filtering method(s) used by libpng. Currently, the only valid |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 926 | * value for "method" is 0. |
| 927 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 928 | extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 929 | int filters)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 930 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 931 | /* Flags for png_set_filter() to say which filters to use. The flags |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 932 | * are chosen so that they don't conflict with real filter types |
| 933 | * below, in case they are supplied instead of the #defined constants. |
| 934 | * These values should NOT be changed. |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 935 | */ |
| 936 | #define PNG_NO_FILTERS 0x00 |
| 937 | #define PNG_FILTER_NONE 0x08 |
| 938 | #define PNG_FILTER_SUB 0x10 |
| 939 | #define PNG_FILTER_UP 0x20 |
| 940 | #define PNG_FILTER_AVG 0x40 |
| 941 | #define PNG_FILTER_PAETH 0x80 |
| 942 | #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ |
| 943 | PNG_FILTER_AVG | PNG_FILTER_PAETH) |
| 944 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 945 | /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. |
| 946 | * These defines should NOT be changed. |
| 947 | */ |
| 948 | #define PNG_FILTER_VALUE_NONE 0 |
| 949 | #define PNG_FILTER_VALUE_SUB 1 |
| 950 | #define PNG_FILTER_VALUE_UP 2 |
| 951 | #define PNG_FILTER_VALUE_AVG 3 |
| 952 | #define PNG_FILTER_VALUE_PAETH 4 |
| 953 | #define PNG_FILTER_VALUE_LAST 5 |
| 954 | |
| 955 | #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ |
| 956 | /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ |
| 957 | * defines, either the default (minimum-sum-of-absolute-differences), or |
| 958 | * the experimental method (weighted-minimum-sum-of-absolute-differences). |
| 959 | * |
| 960 | * Weights are factors >= 1.0, indicating how important it is to keep the |
| 961 | * filter type consistent between rows. Larger numbers mean the current |
| 962 | * filter is that many times as likely to be the same as the "num_weights" |
| 963 | * previous filters. This is cumulative for each previous row with a weight. |
| 964 | * There needs to be "num_weights" values in "filter_weights", or it can be |
| 965 | * NULL if the weights aren't being specified. Weights have no influence on |
| 966 | * the selection of the first row filter. Well chosen weights can (in theory) |
| 967 | * improve the compression for a given image. |
| 968 | * |
| 969 | * Costs are factors >= 1.0 indicating the relative decoding costs of a |
| 970 | * filter type. Higher costs indicate more decoding expense, and are |
| 971 | * therefore less likely to be selected over a filter with lower computational |
| 972 | * costs. There needs to be a value in "filter_costs" for each valid filter |
| 973 | * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't |
| 974 | * setting the costs. Costs try to improve the speed of decompression without |
| 975 | * unduly increasing the compressed image size. |
| 976 | * |
| 977 | * A negative weight or cost indicates the default value is to be used, and |
| 978 | * values in the range [0.0, 1.0) indicate the value is to remain unchanged. |
| 979 | * The default values for both weights and costs are currently 1.0, but may |
| 980 | * change if good general weighting/cost heuristics can be found. If both |
| 981 | * the weights and costs are set to 1.0, this degenerates the WEIGHTED method |
| 982 | * to the UNWEIGHTED method, but with added encoding time/computation. |
| 983 | */ |
| 984 | extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, |
| 985 | int heuristic_method, int num_weights, png_doublep filter_weights, |
| 986 | png_doublep filter_costs)); |
| 987 | #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ |
| 988 | |
| 989 | /* Heuristic used for row filter selection. These defines should NOT be |
| 990 | * changed. |
| 991 | */ |
| 992 | #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ |
| 993 | #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ |
| 994 | #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ |
| 995 | #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ |
| 996 | |
| 997 | /* Set the library compression level. Currently, valid values range from |
| 998 | * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 |
| 999 | * (0 - no compression, 9 - "maximal" compression). Note that tests have |
| 1000 | * shown that zlib compression levels 3-6 usually perform as well as level 9 |
| 1001 | * for PNG images, and do considerably fewer caclulations. In the future, |
| 1002 | * these values may not correspond directly to the zlib compression levels. |
| 1003 | */ |
| 1004 | extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1005 | int level)); |
| 1006 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1007 | extern PNG_EXPORT(void,png_set_compression_mem_level) |
| 1008 | PNGARG((png_structp png_ptr, int mem_level)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1009 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1010 | extern PNG_EXPORT(void,png_set_compression_strategy) |
| 1011 | PNGARG((png_structp png_ptr, int strategy)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1012 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1013 | extern PNG_EXPORT(void,png_set_compression_window_bits) |
| 1014 | PNGARG((png_structp png_ptr, int window_bits)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1015 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1016 | extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1017 | int method)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1018 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1019 | /* These next functions are called for input/output, memory, and error |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1020 | * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, |
| 1021 | * and call standard C I/O routines such as fread(), fwrite(), and |
| 1022 | * fprintf(). These functions can be made to use other I/O routines |
| 1023 | * at run time for those applications that need to handle I/O in a |
| 1024 | * different manner by calling png_set_???_fn(). See libpng.txt for |
| 1025 | * more information. |
| 1026 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1027 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 1028 | #if !defined(PNG_NO_STDIO) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1029 | /* Initialize the input/output for the PNG file to the default functions. */ |
| 1030 | extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, FILE *fp)); |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 1031 | #endif |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1032 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1033 | /* Replace the (error and abort), and warning functions with user |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1034 | * supplied functions. If no messages are to be printed you must still |
| 1035 | * write and use replacement functions. The replacement error_fn should |
| 1036 | * still do a longjmp to the last setjmp location if you are using this |
| 1037 | * method of error handling. If error_fn or warning_fn is NULL, the |
| 1038 | * default function will be used. |
| 1039 | */ |
| 1040 | extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, |
| 1041 | png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1042 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1043 | /* Return the user pointer associated with the error functions */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1044 | extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1045 | |
| 1046 | /* Replace the default data output functions with a user supplied one(s). |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1047 | * If buffered output is not used, then output_flush_fn can be set to NULL. |
| 1048 | * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time |
| 1049 | * output_flush_fn will be ignored (and thus can be NULL). |
| 1050 | */ |
| 1051 | extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, |
| 1052 | png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1053 | |
| 1054 | /* Replace the default data input function with a user supplied one. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1055 | extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, |
| 1056 | png_voidp io_ptr, png_rw_ptr read_data_fn)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1057 | |
| 1058 | /* Return the user pointer associated with the I/O functions */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1059 | extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1060 | |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1061 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1062 | /* Sets the function callbacks for the push reader, and a pointer to a |
| 1063 | * user-defined structure available to the callback functions. |
| 1064 | */ |
| 1065 | extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, |
| 1066 | png_voidp progressive_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1067 | png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, |
| 1068 | png_progressive_end_ptr end_fn)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1069 | |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1070 | /* returns the user pointer associated with the push read functions */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1071 | extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) |
| 1072 | PNGARG((png_structp png_ptr)); |
| 1073 | |
| 1074 | /* function to be called when data becomes available */ |
| 1075 | extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, |
| 1076 | png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); |
| 1077 | |
| 1078 | /* function which combines rows. Not very much different than the |
| 1079 | * png_combine_row() call. Is this even used????? |
| 1080 | */ |
| 1081 | extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, |
| 1082 | png_bytep old_row, png_bytep new_row)); |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1083 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1084 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1085 | extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1086 | png_uint_32 size)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1087 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1088 | /* frees a pointer allocated by png_malloc() */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1089 | extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1090 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1091 | #if defined(USE_FAR_KEYWORD) /* memory model conversion function */ |
| 1092 | extern void *far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,int check)); |
| 1093 | #endif /* USE_FAR_KEYWORD */ |
| 1094 | |
| 1095 | /* Fatal error in PNG image of libpng - can't continue */ |
| 1096 | extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, |
| 1097 | png_const_charp error)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1098 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 1099 | /* The same, but the chunk name is prepended to the error string. */ |
| 1100 | extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, |
| 1101 | png_const_charp error)); |
| 1102 | |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1103 | /* Non-fatal error in libpng. Can continue, but may have a problem. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1104 | extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, |
| 1105 | png_const_charp message)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1106 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 1107 | /* Non-fatal error in libpng, chunk name is prepended to message. */ |
| 1108 | extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, |
| 1109 | png_const_charp message)); |
| 1110 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1111 | /* The png_set_<chunk> functions are for storing values in the png_info_struct. |
| 1112 | * Similarly, the png_get_<chunk> calls are used to read values from the |
| 1113 | * png_info_struct, either storing the parameters in the passed variables, or |
| 1114 | * setting pointers into the png_info_struct where the data is stored. The |
| 1115 | * png_get_<chunk> functions return a non-zero value if the data was available |
| 1116 | * in info_ptr, or return zero and do not change any of the parameters if the |
| 1117 | * data was not available. |
| 1118 | * |
| 1119 | * These functions should be used instead of directly accessing png_info |
| 1120 | * to avoid problems with future changes in the size and internal layout of |
| 1121 | * png_info_struct. |
| 1122 | */ |
| 1123 | /* Returns "flag" if chunk data is valid in info_ptr */ |
| 1124 | extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, |
| 1125 | png_infop info_ptr, png_uint_32 flag)); |
| 1126 | |
| 1127 | /* Returns number of bytes needed to hold a transformed row */ |
| 1128 | extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, |
| 1129 | png_infop info_ptr)); |
| 1130 | |
| 1131 | /* Returns number of color channels in image */ |
| 1132 | extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, |
| 1133 | png_infop info_ptr)); |
| 1134 | |
| 1135 | /* Returns pointer to signature string read from PNG header */ |
| 1136 | extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, |
| 1137 | png_infop info_ptr)); |
| 1138 | |
| 1139 | #if defined(PNG_READ_bKGD_SUPPORTED) |
| 1140 | extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, |
| 1141 | png_infop info_ptr, png_color_16p *background)); |
| 1142 | #endif /* PNG_READ_bKGD_SUPPORTED */ |
| 1143 | |
| 1144 | #if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED) |
| 1145 | extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, |
| 1146 | png_infop info_ptr, png_color_16p background)); |
| 1147 | #endif /* PNG_READ_bKGD_SUPPORTED || PNG_WRITE_bKGD_SUPPORTED */ |
| 1148 | |
| 1149 | #if defined(PNG_READ_cHRM_SUPPORTED) |
| 1150 | extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, |
| 1151 | png_infop info_ptr, double *white_x, double *white_y, double *red_x, |
| 1152 | double *red_y, double *green_x, double *green_y, double *blue_x, |
| 1153 | double *blue_y)); |
| 1154 | #endif /* PNG_READ_cHRM_SUPPORTED */ |
| 1155 | |
| 1156 | #if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED) |
| 1157 | extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, |
| 1158 | png_infop info_ptr, double white_x, double white_y, double red_x, |
| 1159 | double red_y, double green_x, double green_y, double blue_x, double blue_y)); |
| 1160 | #endif /* PNG_READ_cHRM_SUPPORTED || PNG_WRITE_cHRM_SUPPORTED */ |
| 1161 | |
| 1162 | #if defined(PNG_READ_gAMA_SUPPORTED) |
| 1163 | extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, |
| 1164 | png_infop info_ptr, double *file_gamma)); |
| 1165 | #endif /* PNG_READ_gAMA_SUPPORTED */ |
| 1166 | |
| 1167 | #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED) |
| 1168 | extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, |
| 1169 | png_infop info_ptr, double file_gamma)); |
| 1170 | #endif /* PNG_READ_gAMA_SUPPORTED || PNG_WRITE_gAMA_SUPPORTED */ |
| 1171 | |
| 1172 | #if defined(PNG_READ_hIST_SUPPORTED) |
| 1173 | extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, |
| 1174 | png_infop info_ptr, png_uint_16p *hist)); |
| 1175 | #endif /* PNG_READ_hIST_SUPPORTED */ |
| 1176 | |
| 1177 | #if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED) |
| 1178 | extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, |
| 1179 | png_infop info_ptr, png_uint_16p hist)); |
| 1180 | #endif /* PNG_READ_hIST_SUPPORTED || PNG_WRITE_hIST_SUPPORTED */ |
| 1181 | |
| 1182 | extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, |
| 1183 | png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, |
| 1184 | int *bit_depth, int *color_type, int *interlace_type, |
| 1185 | int *compression_type, int *filter_type)); |
| 1186 | |
| 1187 | extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, |
| 1188 | png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, |
| 1189 | int color_type, int interlace_type, int compression_type, int filter_type)); |
| 1190 | |
| 1191 | #if defined(PNG_READ_oFFs_SUPPORTED) |
| 1192 | extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, |
| 1193 | png_infop info_ptr, png_uint_32 *offset_x, png_uint_32 *offset_y, |
| 1194 | int *unit_type)); |
| 1195 | #endif /* PNG_READ_oFFs_SUPPORTED */ |
| 1196 | |
| 1197 | #if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) |
| 1198 | extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, |
| 1199 | png_infop info_ptr, png_uint_32 offset_x, png_uint_32 offset_y, |
| 1200 | int unit_type)); |
| 1201 | #endif /* PNG_READ_oFFs_SUPPORTED || PNG_WRITE_oFFs_SUPPORTED */ |
| 1202 | |
| 1203 | #if defined(PNG_READ_pCAL_SUPPORTED) |
| 1204 | extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, |
| 1205 | png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, |
| 1206 | int *type, int *nparams, png_charp *units, png_charpp *params)); |
| 1207 | #endif /* PNG_READ_pCAL_SUPPORTED */ |
| 1208 | |
| 1209 | #if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) |
| 1210 | extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, |
| 1211 | png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, |
| 1212 | int type, int nparams, png_charp units, png_charpp params)); |
| 1213 | #endif /* PNG_READ_pCAL_SUPPORTED || PNG_WRITE_pCAL_SUPPORTED */ |
| 1214 | |
| 1215 | #if defined(PNG_READ_pHYs_SUPPORTED) |
| 1216 | extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, |
| 1217 | png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); |
| 1218 | #endif /* PNG_READ_pHYs_SUPPORTED */ |
| 1219 | |
| 1220 | #if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED) |
| 1221 | extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, |
| 1222 | png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); |
| 1223 | #endif /* PNG_READ_pHYs_SUPPORTED || PNG_WRITE_pHYs_SUPPORTED */ |
| 1224 | |
| 1225 | extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, |
| 1226 | png_infop info_ptr, png_colorp *palette, int *num_palette)); |
| 1227 | |
| 1228 | extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, |
| 1229 | png_infop info_ptr, png_colorp palette, int num_palette)); |
| 1230 | |
| 1231 | #if defined(PNG_READ_sBIT_SUPPORTED) |
| 1232 | extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, |
| 1233 | png_infop info_ptr, png_color_8p *sig_bit)); |
| 1234 | #endif /* PNG_READ_sBIT_SUPPORTED */ |
| 1235 | |
| 1236 | #if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED) |
| 1237 | extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, |
| 1238 | png_infop info_ptr, png_color_8p sig_bit)); |
| 1239 | #endif /* PNG_READ_sBIT_SUPPORTED || PNG_WRITE_sBIT_SUPPORTED */ |
| 1240 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1241 | #if defined(PNG_READ_sRGB_SUPPORTED) |
| 1242 | extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 1243 | png_infop info_ptr, png_bytep srgb_intent)); |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1244 | #endif /* PNG_READ_sRGB_SUPPORTED */ |
| 1245 | |
| 1246 | #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) |
| 1247 | extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, |
| 1248 | png_infop info_ptr, png_byte srgb_intent)); |
| 1249 | extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, |
| 1250 | png_infop info_ptr, png_byte srgb_intent)); |
| 1251 | #endif /* PNG_READ_sRGB_SUPPORTED || PNG_WRITE_sRGB_SUPPORTED */ |
| 1252 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1253 | #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED) |
| 1254 | /* png_get_text also returns the number of text chunks in text_ptr */ |
| 1255 | extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, |
| 1256 | png_infop info_ptr, png_textp *text_ptr, int *num_text)); |
| 1257 | #endif /* PNG_READ_tEXt_SUPPORTED || PNG_READ_zTXt_SUPPORTED */ |
| 1258 | |
| 1259 | #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ |
| 1260 | defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) |
| 1261 | extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, |
| 1262 | png_infop info_ptr, png_textp text_ptr, int num_text)); |
| 1263 | #endif /* PNG_READ_tEXt_SUPPORTED || PNG_WRITE_tEXt_SUPPORTED || |
| 1264 | PNG_READ_zTXt_SUPPORTED || PNG_WRITE_zTXt_SUPPORTED */ |
| 1265 | |
| 1266 | #if defined(PNG_READ_tIME_SUPPORTED) |
| 1267 | extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, |
| 1268 | png_infop info_ptr, png_timep *mod_time)); |
| 1269 | #endif /* PNG_READ_tIME_SUPPORTED */ |
| 1270 | |
| 1271 | #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED) |
| 1272 | extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, |
| 1273 | png_infop info_ptr, png_timep mod_time)); |
| 1274 | #endif /* PNG_READ_tIME_SUPPORTED || PNG_WRITE_tIME_SUPPORTED */ |
| 1275 | |
| 1276 | #if defined(PNG_READ_tRNS_SUPPORTED) |
| 1277 | extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, |
| 1278 | png_infop info_ptr, png_bytep *trans, int *num_trans, |
| 1279 | png_color_16p *trans_values)); |
| 1280 | #endif /* PNG_READ_tRNS_SUPPORTED */ |
| 1281 | |
| 1282 | #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED) |
| 1283 | extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, |
| 1284 | png_infop info_ptr, png_bytep trans, int num_trans, |
| 1285 | png_color_16p trans_values)); |
| 1286 | #endif /* PNG_READ_tRNS_SUPPORTED || PNG_WRITE_tRNS_SUPPORTED */ |
| 1287 | |
| 1288 | /* Define PNG_DEBUG at compile time for debugging information. Higher |
| 1289 | * numbers for PNG_DEBUG mean more debugging information. This has |
| 1290 | * only been added since version 0.95 so it is not implemented throughout |
| 1291 | * libpng yet, but more support will be added as needed. |
| 1292 | */ |
| 1293 | #if (PNG_DEBUG > 0) |
| 1294 | #ifndef PNG_DEBUG_FILE |
| 1295 | #define PNG_DEBUG_FILE stderr |
| 1296 | #endif /* PNG_DEBUG_FILE */ |
| 1297 | |
| 1298 | #define png_debug(l,m) if (PNG_DEBUG > l) \ |
| 1299 | fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ |
| 1300 | (l==2 ? "\t\t":(l==3 ? "\t\t\t":"")))) |
| 1301 | #define png_debug1(l,m,p1) if (PNG_DEBUG > l) \ |
| 1302 | fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ |
| 1303 | (l==2 ? "\t\t":(l==3 ? "\t\t\t":""))),p1) |
| 1304 | #define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) \ |
| 1305 | fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ |
| 1306 | (l==2 ? "\t\t":(l==3 ? "\t\t\t":""))),p1,p2) |
| 1307 | #else |
| 1308 | #define png_debug(l, m) |
| 1309 | #define png_debug1(l, m, p1) |
| 1310 | #define png_debug2(l, m, p1, p2) |
| 1311 | #endif /* (PNG_DEBUG > 0) */ |
| 1312 | |
| 1313 | /* These next functions are used internally in the code. They generally |
| 1314 | * shouldn't be used unless you are writing code to add or replace some |
| 1315 | * functionality in libpng. More information about most functions can |
| 1316 | * be found in the files where the functions are located. |
| 1317 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1318 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1319 | #if defined(PNG_INTERNAL) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1320 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1321 | /* Various modes of operation. Note that after an init, mode is set to |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1322 | * zero automatically when the structure is created. |
| 1323 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1324 | #define PNG_BEFORE_IHDR 0x00 |
| 1325 | #define PNG_HAVE_IHDR 0x01 |
| 1326 | #define PNG_HAVE_PLTE 0x02 |
| 1327 | #define PNG_HAVE_IDAT 0x04 |
| 1328 | #define PNG_AFTER_IDAT 0x08 |
| 1329 | #define PNG_HAVE_IEND 0x10 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1330 | #define PNG_HAVE_gAMA 0x20 |
| 1331 | #define PNG_HAVE_cHRM 0x40 |
| 1332 | #define PNG_HAVE_sRGB 0x80 |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1333 | |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1334 | /* push model modes */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1335 | #define PNG_READ_SIG_MODE 0 |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1336 | #define PNG_READ_CHUNK_MODE 1 |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1337 | #define PNG_READ_IDAT_MODE 2 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1338 | #define PNG_SKIP_MODE 3 |
| 1339 | #define PNG_READ_tEXt_MODE 4 |
| 1340 | #define PNG_READ_zTXt_MODE 5 |
| 1341 | #define PNG_READ_DONE_MODE 6 |
| 1342 | #define PNG_ERROR_MODE 7 |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1343 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1344 | /* flags for the transformations the PNG library does on the image data */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1345 | #define PNG_BGR 0x0001 |
| 1346 | #define PNG_INTERLACE 0x0002 |
| 1347 | #define PNG_PACK 0x0004 |
| 1348 | #define PNG_SHIFT 0x0008 |
| 1349 | #define PNG_SWAP_BYTES 0x0010 |
| 1350 | #define PNG_INVERT_MONO 0x0020 |
| 1351 | #define PNG_DITHER 0x0040 |
| 1352 | #define PNG_BACKGROUND 0x0080 |
| 1353 | #define PNG_BACKGROUND_EXPAND 0x0100 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1354 | #define PNG_RGB_TO_GRAY 0x0200 /* Not currently implemented */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1355 | #define PNG_16_TO_8 0x0400 |
| 1356 | #define PNG_RGBA 0x0800 |
| 1357 | #define PNG_EXPAND 0x1000 |
| 1358 | #define PNG_GAMMA 0x2000 |
| 1359 | #define PNG_GRAY_TO_RGB 0x4000 |
| 1360 | #define PNG_FILLER 0x8000 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1361 | #define PNG_PACKSWAP 0x10000 |
| 1362 | #define PNG_SWAP_ALPHA 0x20000 |
| 1363 | #define PNG_STRIP_ALPHA 0x40000 |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1364 | |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1365 | /* flags for png_create_struct */ |
| 1366 | #define PNG_STRUCT_PNG 0x0001 |
| 1367 | #define PNG_STRUCT_INFO 0x0002 |
| 1368 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1369 | /* Scaling factor for filter heuristic weighting calculations */ |
| 1370 | #define PNG_WEIGHT_SHIFT 8 |
| 1371 | #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) |
| 1372 | #define PNG_COST_SHIFT 3 |
| 1373 | #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) |
| 1374 | |
| 1375 | /* flags for the png_ptr->flags rather than declaring a byte for each one */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1376 | #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 |
| 1377 | #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 |
| 1378 | #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 |
| 1379 | #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 |
| 1380 | #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 |
| 1381 | #define PNG_FLAG_ZLIB_FINISHED 0x0020 |
| 1382 | #define PNG_FLAG_ROW_INIT 0x0040 |
| 1383 | #define PNG_FLAG_FILLER_AFTER 0x0080 |
| 1384 | #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 |
| 1385 | #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 |
| 1386 | #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 |
| 1387 | #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 |
| 1388 | #define PNG_FLAG_FREE_PALETTE 0x1000 |
| 1389 | #define PNG_FLAG_FREE_TRANS 0x2000 |
| 1390 | #define PNG_FLAG_FREE_HIST 0x4000 |
| 1391 | #define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000 |
| 1392 | #define PNG_FLAG_WROTE_tIME 0x10000 |
| 1393 | |
| 1394 | #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ |
| 1395 | PNG_FLAG_CRC_ANCILLARY_NOWARN) |
| 1396 | |
| 1397 | #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ |
| 1398 | PNG_FLAG_CRC_CRITICAL_IGNORE) |
| 1399 | |
| 1400 | #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ |
| 1401 | PNG_FLAG_CRC_CRITICAL_MASK) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1402 | |
| 1403 | /* save typing and make code easier to understand */ |
| 1404 | #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ |
| 1405 | abs((int)((c1).green) - (int)((c2).green)) + \ |
| 1406 | abs((int)((c1).blue) - (int)((c2).blue))) |
| 1407 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1408 | /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1409 | #ifndef PNG_NO_EXTERN |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1410 | /* place to hold the signiture string for a PNG file. */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1411 | extern png_byte FARDATA png_sig[]; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1412 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1413 | /* Constant strings for known chunk types. If you need to add a chunk, |
| 1414 | * add a string holding the name here. See png.c for more details. We |
| 1415 | * can't selectively include these, since we still check for chunk in the |
| 1416 | * wrong locations with these labels. |
| 1417 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1418 | extern png_byte FARDATA png_IHDR[]; |
| 1419 | extern png_byte FARDATA png_IDAT[]; |
| 1420 | extern png_byte FARDATA png_IEND[]; |
| 1421 | extern png_byte FARDATA png_PLTE[]; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1422 | extern png_byte FARDATA png_bKGD[]; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1423 | extern png_byte FARDATA png_cHRM[]; |
| 1424 | extern png_byte FARDATA png_gAMA[]; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1425 | extern png_byte FARDATA png_hIST[]; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1426 | extern png_byte FARDATA png_oFFs[]; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1427 | extern png_byte FARDATA png_pCAL[]; |
| 1428 | extern png_byte FARDATA png_pHYs[]; |
| 1429 | extern png_byte FARDATA png_sBIT[]; |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1430 | extern png_byte FARDATA png_sRGB[]; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1431 | extern png_byte FARDATA png_tEXt[]; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1432 | extern png_byte FARDATA png_tIME[]; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1433 | extern png_byte FARDATA png_tRNS[]; |
| 1434 | extern png_byte FARDATA png_zTXt[]; |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1435 | |
| 1436 | #endif /* PNG_NO_EXTERN */ |
| 1437 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1438 | /* Inline macros to do direct reads of bytes from the input buffer. These |
| 1439 | * require that you are using an architecture that uses PNG byte ordering |
| 1440 | * (MSB first) and supports unaligned data storage. I think that PowerPC |
| 1441 | * in big-endian mode and 680x0 are the only ones that will support this. |
| 1442 | * The x86 line of processors definitely do not. The png_get_int_32() |
| 1443 | * routine also assumes we are using two's complement format for negative |
| 1444 | * values, which is almost certainly true. |
| 1445 | */ |
| 1446 | #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) |
| 1447 | #if defined(PNG_READ_pCAL_SUPPORTED) |
| 1448 | #define png_get_int_32(buf) ( *((png_int_32p) (buf))) |
| 1449 | #endif /* PNG_READ_pCAL_SUPPORTED */ |
| 1450 | #define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) |
| 1451 | #define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) |
| 1452 | #else |
| 1453 | #if defined(PNG_READ_pCAL_SUPPORTED) |
| 1454 | PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf)); |
| 1455 | #endif /* PNG_READ_pCAL_SUPPORTED */ |
| 1456 | PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf)); |
| 1457 | PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); |
| 1458 | #endif /* PNG_BIG_ENDIAN_GET_SUPPORTED */ |
| 1459 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1460 | /* Initialize png_ptr struct for reading, and allocate any other memory. |
| 1461 | * (old interface - NOT DLL EXPORTED). |
| 1462 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1463 | extern void png_read_init PNGARG((png_structp png_ptr)); |
| 1464 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1465 | /* Initialize png_ptr struct for writing, and allocate any other memory. |
| 1466 | * (old interface - NOT DLL EXPORTED). |
| 1467 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1468 | extern void png_write_init PNGARG((png_structp png_ptr)); |
| 1469 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1470 | /* allocate memory for an internal libpng struct */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1471 | PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1472 | |
| 1473 | /* free memory from internal libpng struct */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1474 | PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1475 | |
| 1476 | /* free any memory that info_ptr points to and reset struct. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1477 | PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1478 | png_infop info_ptr)); |
| 1479 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1480 | /* Function to allocate memory for zlib. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1481 | PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1482 | |
| 1483 | /* function to free memory for zlib */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1484 | PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1485 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1486 | /* reset the CRC variable */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1487 | PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); |
| 1488 | |
| 1489 | /* Write the "data" buffer to whatever output you are using. */ |
| 1490 | PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, |
| 1491 | png_size_t length)); |
| 1492 | |
| 1493 | /* Read data from whatever input you are using into the "data" buffer */ |
| 1494 | PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, |
| 1495 | png_size_t length)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1496 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1497 | /* read bytes into buf, and update png_ptr->crc */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1498 | PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, |
| 1499 | png_size_t length)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1500 | |
| 1501 | /* read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1502 | PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1503 | |
| 1504 | /* read the CRC from the file and compare it to the libpng calculated CRC */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1505 | PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1506 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1507 | /* Calculate the CRC over a section of data. Note that we are only |
| 1508 | * passing a maximum of 64K on systems that have this as a memory limit, |
| 1509 | * since this is the maximum buffer size we can specify. |
| 1510 | */ |
| 1511 | PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, |
| 1512 | png_size_t length)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1513 | |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1514 | #if defined(PNG_WRITE_FLUSH_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1515 | PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1516 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1517 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1518 | /* Place a 32-bit number into a buffer in PNG byte order (big-endian). |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1519 | * The only currently known PNG chunk that uses signed numbers is |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1520 | * the ancillary extension chunk, pCAL. |
| 1521 | */ |
| 1522 | PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1523 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1524 | #if defined(PNG_WRITE_pCAL_SUPPORTED) |
| 1525 | PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i)); |
| 1526 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1527 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1528 | /* Place a 16 bit number into a buffer in PNG byte order. |
| 1529 | * The parameter is declared unsigned int, not png_uint_16, |
| 1530 | * just to avoid potential problems on pre-ANSI C compilers. |
| 1531 | */ |
| 1532 | PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1533 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1534 | /* Write a PNG chunk - size, type, (optional) data, CRC. */ |
| 1535 | PNG_EXTERN void png_write_chunk PNGARG((png_structp png_ptr, |
| 1536 | png_bytep chunk_name, png_bytep data, png_size_t length)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1537 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1538 | /* Write the start of a PNG chunk - length and chunk name. */ |
| 1539 | PNG_EXTERN void png_write_chunk_start PNGARG((png_structp png_ptr, |
| 1540 | png_bytep chunk_name, png_uint_32 length)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1541 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1542 | /* Write the data of a PNG chunk started with png_write_chunk_start(). */ |
| 1543 | PNG_EXTERN void png_write_chunk_data PNGARG((png_structp png_ptr, |
| 1544 | png_bytep data, png_size_t length)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1545 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1546 | /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ |
| 1547 | PNG_EXTERN void png_write_chunk_end PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1548 | |
| 1549 | /* simple function to write the signiture */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1550 | PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1551 | |
| 1552 | /* write various chunks */ |
| 1553 | |
| 1554 | /* Write the IHDR chunk, and update the png_struct with the necessary |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1555 | * information. |
| 1556 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1557 | PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1558 | png_uint_32 height, |
| 1559 | int bit_depth, int color_type, int compression_type, int filter_type, |
| 1560 | int interlace_type)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1561 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1562 | PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, |
| 1563 | png_uint_32 num_pal)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1564 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1565 | PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, |
| 1566 | png_size_t length)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1567 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1568 | PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1569 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1570 | #if defined(PNG_WRITE_gAMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1571 | PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1572 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1573 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1574 | #if defined(PNG_WRITE_sBIT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1575 | PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1576 | int color_type)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1577 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1578 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1579 | #if defined(PNG_WRITE_cHRM_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1580 | PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1581 | double white_x, double white_y, |
| 1582 | double red_x, double red_y, double green_x, double green_y, |
| 1583 | double blue_x, double blue_y)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1584 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1585 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1586 | #if defined(PNG_WRITE_sRGB_SUPPORTED) |
| 1587 | PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, |
| 1588 | png_byte srgb_intent)); |
| 1589 | #endif |
| 1590 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1591 | #if defined(PNG_WRITE_tRNS_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1592 | PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1593 | png_color_16p values, int number, int color_type)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1594 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1595 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1596 | #if defined(PNG_WRITE_bKGD_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1597 | PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, |
| 1598 | png_color_16p values, int color_type)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1599 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1600 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1601 | #if defined(PNG_WRITE_hIST_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1602 | PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, |
| 1603 | png_uint_32 num_hist)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1604 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1605 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1606 | #if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1607 | PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1608 | png_charp key, png_charpp new_key)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1609 | #endif |
| 1610 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1611 | #if defined(PNG_WRITE_tEXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1612 | PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, |
| 1613 | png_charp text, png_size_t text_len)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1614 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1615 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1616 | #if defined(PNG_WRITE_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1617 | PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, |
| 1618 | png_charp text, png_size_t text_len, int compression)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1619 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1620 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1621 | #if defined(PNG_WRITE_oFFs_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1622 | PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, |
| 1623 | png_uint_32 x_offset, png_uint_32 y_offset, int unit_type)); |
| 1624 | #endif |
| 1625 | |
| 1626 | #if defined(PNG_WRITE_pCAL_SUPPORTED) |
| 1627 | PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, |
| 1628 | png_int_32 X0, png_int_32 X1, int type, int nparams, |
| 1629 | png_charp units, png_charpp params)); |
| 1630 | #endif |
| 1631 | |
| 1632 | #if defined(PNG_WRITE_pHYs_SUPPORTED) |
| 1633 | PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, |
| 1634 | png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1635 | int unit_type)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1636 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1637 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1638 | #if defined(PNG_WRITE_tIME_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1639 | PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1640 | png_timep mod_time)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1641 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1642 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1643 | /* Called when finished processing a row of data */ |
| 1644 | PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1645 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1646 | /* Internal use only. Called before first row of data */ |
| 1647 | PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1648 | |
| 1649 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1650 | PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1651 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1652 | |
| 1653 | /* combine a row of data, dealing with alpha, etc. if requested */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1654 | PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1655 | int mask)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1656 | |
| 1657 | #if defined(PNG_READ_INTERLACING_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1658 | /* expand an interlaced row */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1659 | PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, |
| 1660 | png_bytep row, int pass, png_uint_32 transformations)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1661 | #endif |
| 1662 | |
| 1663 | #if defined(PNG_WRITE_INTERLACING_SUPPORTED) |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1664 | /* grab pixels out of a row for an interlaced pass */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1665 | PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1666 | png_bytep row, int pass)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1667 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1668 | |
| 1669 | /* unfilter a row */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1670 | PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1671 | png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1672 | |
| 1673 | /* Choose the best filter to use and filter the row data */ |
| 1674 | PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1675 | png_row_infop row_info)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1676 | |
| 1677 | /* Write out the filtered row. */ |
| 1678 | PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1679 | png_bytep filtered_row)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1680 | /* finish a row while reading, dealing with interlacing passes, etc. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1681 | PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); |
| 1682 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1683 | /* initialize the row buffers, etc. */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1684 | PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1685 | /* optional call to update the users info structure */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1686 | PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1687 | png_infop info_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1688 | |
| 1689 | /* these are the functions that do the transformations */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1690 | #if defined(PNG_READ_FILLER_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1691 | PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, |
| 1692 | png_bytep row, png_uint_32 filler, png_uint_32 flags)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1693 | #endif |
| 1694 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1695 | #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) |
| 1696 | PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, |
| 1697 | png_bytep row)); |
| 1698 | #endif |
| 1699 | |
| 1700 | #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) |
| 1701 | PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, |
| 1702 | png_bytep row)); |
| 1703 | #endif |
| 1704 | |
| 1705 | #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ |
| 1706 | defined(PNG_READ_STRIP_ALPHA_SUPPORTED) |
| 1707 | PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, |
| 1708 | png_bytep row, png_uint_32 flags)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1709 | #endif |
| 1710 | |
| 1711 | #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1712 | PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); |
| 1713 | #endif |
| 1714 | |
| 1715 | #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPOR) |
| 1716 | PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1717 | #endif |
| 1718 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1719 | #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1720 | PNG_EXTERN void png_do_rgb_to_gray PNGARG((png_row_infop row_info, |
| 1721 | png_bytep row)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1722 | #endif |
| 1723 | |
| 1724 | #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1725 | PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, |
| 1726 | png_bytep row)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1727 | #endif |
| 1728 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1729 | #if defined(PNG_READ_PACK_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1730 | PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1731 | #endif |
| 1732 | |
| 1733 | #if defined(PNG_READ_SHIFT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1734 | PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1735 | png_color_8p sig_bits)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1736 | #endif |
| 1737 | |
| 1738 | #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1739 | PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1740 | #endif |
| 1741 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1742 | #if defined(PNG_READ_16_TO_8_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1743 | PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1744 | #endif |
| 1745 | |
| 1746 | #if defined(PNG_READ_DITHER_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1747 | PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1748 | png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1749 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1750 | # if defined(PNG_CORRECT_PALETTE_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1751 | PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1752 | png_colorp palette, int num_palette)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1753 | # endif |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 1754 | #endif |
| 1755 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1756 | #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1757 | PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1758 | #endif |
| 1759 | |
| 1760 | #if defined(PNG_WRITE_PACK_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1761 | PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, |
| 1762 | png_bytep row, png_uint_32 bit_depth)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1763 | #endif |
| 1764 | |
| 1765 | #if defined(PNG_WRITE_SHIFT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1766 | PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1767 | png_color_8p bit_depth)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1768 | #endif |
| 1769 | |
| 1770 | #if defined(PNG_READ_BACKGROUND_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1771 | PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1772 | png_color_16p trans_values, png_color_16p background, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1773 | png_color_16p background_1, |
| 1774 | png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, |
| 1775 | png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, |
| 1776 | png_uint_16pp gamma_16_to_1, int gamma_shift)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1777 | #endif |
| 1778 | |
| 1779 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1780 | PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1781 | png_bytep gamma_table, png_uint_16pp gamma_16_table, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1782 | int gamma_shift)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1783 | #endif |
| 1784 | |
| 1785 | #if defined(PNG_READ_EXPAND_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1786 | PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1787 | png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1788 | PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1789 | png_bytep row, png_color_16p trans_value)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1790 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1791 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1792 | /* The following decodes the appropriate chunks, and does error correction, |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1793 | * then calls the appropriate callback for the chunk if it is valid. |
| 1794 | */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1795 | |
| 1796 | /* decode the IHDR chunk */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1797 | PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1798 | png_uint_32 length)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1799 | PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1800 | png_uint_32 length)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1801 | PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1802 | png_uint_32 length)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1803 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1804 | #if defined(PNG_READ_gAMA_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1805 | PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1806 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1807 | #endif |
| 1808 | |
| 1809 | #if defined(PNG_READ_sBIT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1810 | PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1811 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1812 | #endif |
| 1813 | |
| 1814 | #if defined(PNG_READ_cHRM_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1815 | PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1816 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1817 | #endif |
| 1818 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 1819 | #if defined(PNG_READ_sRGB_SUPPORTED) |
| 1820 | PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 1821 | png_uint_32 length)); |
| 1822 | #endif |
| 1823 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1824 | #if defined(PNG_READ_tRNS_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1825 | PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1826 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1827 | #endif |
| 1828 | |
| 1829 | #if defined(PNG_READ_bKGD_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1830 | PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1831 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1832 | #endif |
| 1833 | |
| 1834 | #if defined(PNG_READ_hIST_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1835 | PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1836 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1837 | #endif |
| 1838 | |
| 1839 | #if defined(PNG_READ_oFFs_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1840 | PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 1841 | png_uint_32 length)); |
| 1842 | #endif |
| 1843 | |
| 1844 | #if defined(PNG_READ_pCAL_SUPPORTED) |
| 1845 | PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 1846 | png_uint_32 length)); |
| 1847 | #endif |
| 1848 | |
| 1849 | #if defined(PNG_READ_pHYs_SUPPORTED) |
| 1850 | PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1851 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1852 | #endif |
| 1853 | |
| 1854 | #if defined(PNG_READ_tIME_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1855 | PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1856 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1857 | #endif |
| 1858 | |
| 1859 | #if defined(PNG_READ_tEXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1860 | PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1861 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1862 | #endif |
| 1863 | |
| 1864 | #if defined(PNG_READ_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1865 | PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1866 | png_uint_32 length)); |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1867 | #endif |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1868 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1869 | PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, |
| 1870 | png_infop info_ptr, png_uint_32 length)); |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1871 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1872 | PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1873 | png_bytep chunk_name)); |
| 1874 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1875 | /* handle the transformations for reading and writing */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1876 | PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); |
| 1877 | PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1878 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1879 | PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1880 | |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1881 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1882 | PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1883 | png_infop info_ptr)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1884 | PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, |
| 1885 | png_infop info_ptr)); |
| 1886 | PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); |
| 1887 | PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 1888 | png_uint_32 length)); |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1889 | PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); |
| 1890 | PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, |
| 1891 | png_bytep buffer, png_size_t length)); |
| 1892 | PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); |
| 1893 | PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, |
| 1894 | png_bytep buffer, png_size_t buffer_length)); |
| 1895 | PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); |
| 1896 | PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, |
| 1897 | png_bytep buffer, png_size_t buffer_length)); |
| 1898 | PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); |
| 1899 | PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, |
| 1900 | png_infop info_ptr, png_uint_32 length)); |
| 1901 | PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, |
| 1902 | png_infop info_ptr)); |
| 1903 | PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, |
| 1904 | png_infop info_ptr)); |
| 1905 | PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); |
| 1906 | PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, |
| 1907 | png_infop info_ptr)); |
| 1908 | PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, |
| 1909 | png_infop info_ptr)); |
| 1910 | PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); |
| 1911 | #if defined(PNG_READ_tEXt_SUPPORTED) |
| 1912 | PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, |
| 1913 | png_infop info_ptr, png_uint_32 length)); |
| 1914 | PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, |
| 1915 | png_infop info_ptr)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1916 | #endif |
| 1917 | #if defined(PNG_READ_zTXt_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 1918 | PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, |
| 1919 | png_infop info_ptr, png_uint_32 length)); |
| 1920 | PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, |
| 1921 | png_infop info_ptr)); |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 1922 | #endif |
| 1923 | |
| 1924 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1925 | |
| 1926 | #endif /* PNG_INTERNAL */ |
| 1927 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 1928 | #ifdef __cplusplus |
| 1929 | } |
| 1930 | #endif |
| 1931 | |
Guy Schalnat | 0d58058 | 1995-07-20 02:43:20 -0500 | [diff] [blame] | 1932 | /* do not put anything past this line */ |
| 1933 | #endif /* _PNG_H */ |