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