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