Eneboo - Documentación para desarrolladores
|
00001 /* png.h - header file for PNG reference library 00002 * 00003 * libpng version 1.2.5 - October 3, 2002 00004 * Copyright (c) 1998-2002 Glenn Randers-Pehrson 00005 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 00006 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 00007 * 00008 * Authors and maintainers: 00009 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat 00010 * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger 00011 * libpng versions 0.97, January 1998, through 1.2.5 - October 3, 2002: Glenn 00012 * See also "Contributing Authors", below. 00013 * 00014 * Note about libpng version numbers: 00015 * 00016 * Due to various miscommunications, unforeseen code incompatibilities 00017 * and occasional factors outside the authors' control, version numbering 00018 * on the library has not always been consistent and straightforward. 00019 * The following table summarizes matters since version 0.89c, which was 00020 * the first widely used release: 00021 * 00022 * source png.h png.h shared-lib 00023 * version string int version 00024 * ------- ------ ----- ---------- 00025 * 0.89c "1.0 beta 3" 0.89 89 1.0.89 00026 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] 00027 * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] 00028 * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] 00029 * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] 00030 * 0.97c 0.97 97 2.0.97 00031 * 0.98 0.98 98 2.0.98 00032 * 0.99 0.99 98 2.0.99 00033 * 0.99a-m 0.99 99 2.0.99 00034 * 1.00 1.00 100 2.1.0 [100 should be 10000] 00035 * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] 00036 * 1.0.1 png.h string is 10001 2.1.0 00037 * 1.0.1a-e identical to the 10002 from here on, the shared library 00038 * 1.0.2 source version) 10002 is 2.V where V is the source code 00039 * 1.0.2a-b 10003 version, except as noted. 00040 * 1.0.3 10003 00041 * 1.0.3a-d 10004 00042 * 1.0.4 10004 00043 * 1.0.4a-f 10005 00044 * 1.0.5 (+ 2 patches) 10005 00045 * 1.0.5a-d 10006 00046 * 1.0.5e-r 10100 (not source compatible) 00047 * 1.0.5s-v 10006 (not binary compatible) 00048 * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) 00049 * 1.0.6d-f 10007 (still binary incompatible) 00050 * 1.0.6g 10007 00051 * 1.0.6h 10007 10.6h (testing xy.z so-numbering) 00052 * 1.0.6i 10007 10.6i 00053 * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) 00054 * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) 00055 * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) 00056 * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) 00057 * 1.0.7 1 10007 (still compatible) 00058 * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 00059 * 1.0.8rc1 1 10008 2.1.0.8rc1 00060 * 1.0.8 1 10008 2.1.0.8 00061 * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 00062 * 1.0.9rc1 1 10009 2.1.0.9rc1 00063 * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 00064 * 1.0.9rc2 1 10009 2.1.0.9rc2 00065 * 1.0.9 1 10009 2.1.0.9 00066 * 1.0.10beta1 1 10010 2.1.0.10beta1 00067 * 1.0.10rc1 1 10010 2.1.0.10rc1 00068 * 1.0.10 1 10010 2.1.0.10 00069 * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 00070 * 1.0.11rc1 1 10011 2.1.0.11rc1 00071 * 1.0.11 1 10011 2.1.0.11 00072 * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 00073 * 1.0.12rc1 2 10012 2.1.0.12rc1 00074 * 1.0.12 2 10012 2.1.0.12 00075 * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) 00076 * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 00077 * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 00078 * 1.2.0rc1 3 10200 3.1.2.0rc1 00079 * 1.2.0 3 10200 3.1.2.0 00080 * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 00081 * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 00082 * 1.2.1 3 10201 3.1.2.1 00083 * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 00084 * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 00085 * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 00086 * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 00087 * 1.0.13 10 10013 10.so.0.1.0.13 00088 * 1.2.2 12 10202 12.so.0.1.2.2 00089 * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 00090 * 1.2.3 12 10203 12.so.0.1.2.3 00091 * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 00092 * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 00093 * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 00094 * 1.0.14 10 10014 10.so.0.1.0.14 00095 * 1.2.4 13 10204 12.so.0.1.2.4 00096 * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 00097 * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 00098 * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 00099 * 1.0.15 10 10015 10.so.0.1.0.15 00100 * 1.2.5 13 10205 12.so.0.1.2.5 00101 * 00102 * Henceforth the source version will match the shared-library major 00103 * and minor numbers; the shared-library major version number will be 00104 * used for changes in backward compatibility, as it is intended. The 00105 * PNG_LIBPNG_VER macro, which is not used within libpng but is available 00106 * for applications, is an unsigned integer of the form xyyzz corresponding 00107 * to the source version x.y.z (leading zeros in y and z). Beta versions 00108 * were given the previous public release number plus a letter, until 00109 * version 1.0.6j; from then on they were given the upcoming public 00110 * release number plus "betaNN" or "rcN". 00111 * 00112 * Binary incompatibility exists only when applications make direct access 00113 * to the info_ptr or png_ptr members through png.h, and the compiled 00114 * application is loaded with a different version of the library. 00115 * 00116 * DLLNUM will change each time there are forward or backward changes 00117 * in binary compatibility (e.g., when a new feature is added). 00118 * 00119 * See libpng.txt or libpng.3 for more information. The PNG specification 00120 * is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/> 00121 * and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html> 00122 */ 00123 00124 /* 00125 * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: 00126 * 00127 * If you modify libpng you may insert additional notices immediately following 00128 * this sentence. 00129 * 00130 * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are 00131 * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are 00132 * distributed according to the same disclaimer and license as libpng-1.0.6 00133 * with the following individuals added to the list of Contributing Authors 00134 * 00135 * Simon-Pierre Cadieux 00136 * Eric S. Raymond 00137 * Gilles Vollant 00138 * 00139 * and with the following additions to the disclaimer: 00140 * 00141 * There is no warranty against interference with your enjoyment of the 00142 * library or against infringement. There is no warranty that our 00143 * efforts or the library will fulfill any of your particular purposes 00144 * or needs. This library is provided with all faults, and the entire 00145 * risk of satisfactory quality, performance, accuracy, and effort is with 00146 * the user. 00147 * 00148 * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are 00149 * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson 00150 * Distributed according to the same disclaimer and license as libpng-0.96, 00151 * with the following individuals added to the list of Contributing Authors: 00152 * 00153 * Tom Lane 00154 * Glenn Randers-Pehrson 00155 * Willem van Schaik 00156 * 00157 * libpng versions 0.89, June 1996, through 0.96, May 1997, are 00158 * Copyright (c) 1996, 1997 Andreas Dilger 00159 * Distributed according to the same disclaimer and license as libpng-0.88, 00160 * with the following individuals added to the list of Contributing Authors: 00161 * 00162 * John Bowler 00163 * Kevin Bracey 00164 * Sam Bushell 00165 * Magnus Holmgren 00166 * Greg Roelofs 00167 * Tom Tanner 00168 * 00169 * libpng versions 0.5, May 1995, through 0.88, January 1996, are 00170 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. 00171 * 00172 * For the purposes of this copyright and license, "Contributing Authors" 00173 * is defined as the following set of individuals: 00174 * 00175 * Andreas Dilger 00176 * Dave Martindale 00177 * Guy Eric Schalnat 00178 * Paul Schmidt 00179 * Tim Wegner 00180 * 00181 * The PNG Reference Library is supplied "AS IS". The Contributing Authors 00182 * and Group 42, Inc. disclaim all warranties, expressed or implied, 00183 * including, without limitation, the warranties of merchantability and of 00184 * fitness for any purpose. The Contributing Authors and Group 42, Inc. 00185 * assume no liability for direct, indirect, incidental, special, exemplary, 00186 * or consequential damages, which may result from the use of the PNG 00187 * Reference Library, even if advised of the possibility of such damage. 00188 * 00189 * Permission is hereby granted to use, copy, modify, and distribute this 00190 * source code, or portions hereof, for any purpose, without fee, subject 00191 * to the following restrictions: 00192 * 00193 * 1. The origin of this source code must not be misrepresented. 00194 * 00195 * 2. Altered versions must be plainly marked as such and 00196 * must not be misrepresented as being the original source. 00197 * 00198 * 3. This Copyright notice may not be removed or altered from 00199 * any source or altered source distribution. 00200 * 00201 * The Contributing Authors and Group 42, Inc. specifically permit, without 00202 * fee, and encourage the use of this source code as a component to 00203 * supporting the PNG file format in commercial products. If you use this 00204 * source code in a product, acknowledgment is not required but would be 00205 * appreciated. 00206 */ 00207 00208 /* 00209 * A "png_get_copyright" function is available, for convenient use in "about" 00210 * boxes and the like: 00211 * 00212 * printf("%s",png_get_copyright(NULL)); 00213 * 00214 * Also, the PNG logo (in PNG format, of course) is supplied in the 00215 * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). 00216 */ 00217 00218 /* 00219 * Libpng is OSI Certified Open Source Software. OSI Certified is a 00220 * certification mark of the Open Source Initiative. 00221 */ 00222 00223 /* 00224 * The contributing authors would like to thank all those who helped 00225 * with testing, bug fixes, and patience. This wouldn't have been 00226 * possible without all of you. 00227 * 00228 * Thanks to Frank J. T. Wojcik for helping with the documentation. 00229 */ 00230 00231 /* 00232 * Y2K compliance in libpng: 00233 * ========================= 00234 * 00235 * October 3, 2002 00236 * 00237 * Since the PNG Development group is an ad-hoc body, we can't make 00238 * an official declaration. 00239 * 00240 * This is your unofficial assurance that libpng from version 0.71 and 00241 * upward through 1.2.5 are Y2K compliant. It is my belief that earlier 00242 * versions were also Y2K compliant. 00243 * 00244 * Libpng only has three year fields. One is a 2-byte unsigned integer 00245 * that will hold years up to 65535. The other two hold the date in text 00246 * format, and will hold years up to 9999. 00247 * 00248 * The integer is 00249 * "png_uint_16 year" in png_time_struct. 00250 * 00251 * The strings are 00252 * "png_charp time_buffer" in png_struct and 00253 * "near_time_buffer", which is a local character string in png.c. 00254 * 00255 * There are seven time-related functions: 00256 * png.c: png_convert_to_rfc_1123() in png.c 00257 * (formerly png_convert_to_rfc_1152() in error) 00258 * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c 00259 * png_convert_from_time_t() in pngwrite.c 00260 * png_get_tIME() in pngget.c 00261 * png_handle_tIME() in pngrutil.c, called in pngread.c 00262 * png_set_tIME() in pngset.c 00263 * png_write_tIME() in pngwutil.c, called in pngwrite.c 00264 * 00265 * All handle dates properly in a Y2K environment. The 00266 * png_convert_from_time_t() function calls gmtime() to convert from system 00267 * clock time, which returns (year - 1900), which we properly convert to 00268 * the full 4-digit year. There is a possibility that applications using 00269 * libpng are not passing 4-digit years into the png_convert_to_rfc_1123() 00270 * function, or that they are incorrectly passing only a 2-digit year 00271 * instead of "year - 1900" into the png_convert_from_struct_tm() function, 00272 * but this is not under our control. The libpng documentation has always 00273 * stated that it works with 4-digit years, and the APIs have been 00274 * documented as such. 00275 * 00276 * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned 00277 * integer to hold the year, and can hold years as large as 65535. 00278 * 00279 * zlib, upon which libpng depends, is also Y2K compliant. It contains 00280 * no date-related code. 00281 * 00282 * Glenn Randers-Pehrson 00283 * libpng maintainer 00284 * PNG Development Group 00285 */ 00286 00287 #ifndef PNG_H 00288 #define PNG_H 00289 00290 /* This is not the place to learn how to use libpng. The file libpng.txt 00291 * describes how to use libpng, and the file example.c summarizes it 00292 * with some code on which to build. This file is useful for looking 00293 * at the actual function definitions and structure components. 00294 */ 00295 00296 /* Version information for png.h - this should match the version in png.c */ 00297 #define PNG_LIBPNG_VER_STRING "1.2.5" 00298 00299 #define PNG_LIBPNG_VER_SONUM 0 00300 #define PNG_LIBPNG_VER_DLLNUM %DLLNUM% 00301 00302 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ 00303 #define PNG_LIBPNG_VER_MAJOR 1 00304 #define PNG_LIBPNG_VER_MINOR 2 00305 #define PNG_LIBPNG_VER_RELEASE 5 00306 /* This should match the numeric part of the final component of 00307 * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ 00308 00309 #define PNG_LIBPNG_VER_BUILD 0 00310 00311 #define PNG_LIBPNG_BUILD_ALPHA 1 00312 #define PNG_LIBPNG_BUILD_BETA 2 00313 #define PNG_LIBPNG_BUILD_RC 3 00314 #define PNG_LIBPNG_BUILD_STABLE 4 00315 #define PNG_LIBPNG_BUILD_TYPEMASK 7 00316 #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */ 00317 #define PNG_LIBPNG_BUILD_TYPE 4 00318 00319 /* Careful here. At one time, Guy wanted to use 082, but that would be octal. 00320 * We must not include leading zeros. 00321 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only 00322 * version 1.0.0 was mis-numbered 100 instead of 10000). From 00323 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ 00324 #define PNG_LIBPNG_VER 10205 /* 1.2.5 */ 00325 00326 #ifndef PNG_VERSION_INFO_ONLY 00327 00328 /* include the compression library's header */ 00329 #include "zlib.h" 00330 00331 /* include all user configurable info, including optional assembler routines */ 00332 #include "pngconf.h" 00333 00334 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ 00335 #ifdef __cplusplus 00336 extern "C" { 00337 #endif /* __cplusplus */ 00338 00339 /* This file is arranged in several sections. The first section contains 00340 * structure and type definitions. The second section contains the external 00341 * library functions, while the third has the internal library functions, 00342 * which applications aren't expected to use directly. 00343 */ 00344 00345 #ifndef PNG_NO_TYPECAST_NULL 00346 #define int_p_NULL (int *)NULL 00347 #define png_bytep_NULL (png_bytep)NULL 00348 #define png_bytepp_NULL (png_bytepp)NULL 00349 #define png_doublep_NULL (png_doublep)NULL 00350 #define png_error_ptr_NULL (png_error_ptr)NULL 00351 #define png_flush_ptr_NULL (png_flush_ptr)NULL 00352 #define png_free_ptr_NULL (png_free_ptr)NULL 00353 #define png_infopp_NULL (png_infopp)NULL 00354 #define png_malloc_ptr_NULL (png_malloc_ptr)NULL 00355 #define png_read_status_ptr_NULL (png_read_status_ptr)NULL 00356 #define png_rw_ptr_NULL (png_rw_ptr)NULL 00357 #define png_structp_NULL (png_structp)NULL 00358 #define png_uint_16p_NULL (png_uint_16p)NULL 00359 #define png_voidp_NULL (png_voidp)NULL 00360 #define png_write_status_ptr_NULL (png_write_status_ptr)NULL 00361 #else 00362 #define int_p_NULL NULL 00363 #define png_bytep_NULL NULL 00364 #define png_bytepp_NULL NULL 00365 #define png_doublep_NULL NULL 00366 #define png_error_ptr_NULL NULL 00367 #define png_flush_ptr_NULL NULL 00368 #define png_free_ptr_NULL NULL 00369 #define png_infopp_NULL NULL 00370 #define png_malloc_ptr_NULL NULL 00371 #define png_read_status_ptr_NULL NULL 00372 #define png_rw_ptr_NULL NULL 00373 #define png_structp_NULL NULL 00374 #define png_uint_16p_NULL NULL 00375 #define png_voidp_NULL NULL 00376 #define png_write_status_ptr_NULL NULL 00377 #endif 00378 00379 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ 00380 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) 00381 /* Version information for C files, stored in png.c. This had better match 00382 * the version above. 00383 */ 00384 #ifdef PNG_USE_GLOBAL_ARRAYS 00385 PNG_EXPORT_VAR (const char) png_libpng_ver[18]; 00386 /* need room for 99.99.99beta99z */ 00387 #else 00388 #define png_libpng_ver png_get_header_ver(NULL) 00389 #endif 00390 00391 #ifdef PNG_USE_GLOBAL_ARRAYS 00392 /* This was removed in version 1.0.5c */ 00393 /* Structures to facilitate easy interlacing. See png.c for more details */ 00394 PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7]; 00395 PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7]; 00396 PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7]; 00397 PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7]; 00398 PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7]; 00399 PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7]; 00400 #ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW 00401 PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7]; 00402 #endif 00403 /* This isn't currently used. If you need it, see png.c for more details. 00404 PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7]; 00405 */ 00406 #endif 00407 00408 #endif /* PNG_NO_EXTERN */ 00409 00410 /* Three color definitions. The order of the red, green, and blue, (and the 00411 * exact size) is not important, although the size of the fields need to 00412 * be png_byte or png_uint_16 (as defined below). 00413 */ 00414 typedef struct png_color_struct 00415 { 00416 png_byte red; 00417 png_byte green; 00418 png_byte blue; 00419 } png_color; 00420 typedef png_color FAR * png_colorp; 00421 typedef png_color FAR * FAR * png_colorpp; 00422 00423 typedef struct png_color_16_struct 00424 { 00425 png_byte index; /* used for palette files */ 00426 png_uint_16 red; /* for use in red green blue files */ 00427 png_uint_16 green; 00428 png_uint_16 blue; 00429 png_uint_16 gray; /* for use in grayscale files */ 00430 } png_color_16; 00431 typedef png_color_16 FAR * png_color_16p; 00432 typedef png_color_16 FAR * FAR * png_color_16pp; 00433 00434 typedef struct png_color_8_struct 00435 { 00436 png_byte red; /* for use in red green blue files */ 00437 png_byte green; 00438 png_byte blue; 00439 png_byte gray; /* for use in grayscale files */ 00440 png_byte alpha; /* for alpha channel files */ 00441 } png_color_8; 00442 typedef png_color_8 FAR * png_color_8p; 00443 typedef png_color_8 FAR * FAR * png_color_8pp; 00444 00445 /* 00446 * The following two structures are used for the in-core representation 00447 * of sPLT chunks. 00448 */ 00449 typedef struct png_sPLT_entry_struct 00450 { 00451 png_uint_16 red; 00452 png_uint_16 green; 00453 png_uint_16 blue; 00454 png_uint_16 alpha; 00455 png_uint_16 frequency; 00456 } png_sPLT_entry; 00457 typedef png_sPLT_entry FAR * png_sPLT_entryp; 00458 typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp; 00459 00460 /* When the depth of the sPLT palette is 8 bits, the color and alpha samples 00461 * occupy the LSB of their respective members, and the MSB of each member 00462 * is zero-filled. The frequency member always occupies the full 16 bits. 00463 */ 00464 00465 typedef struct png_sPLT_struct 00466 { 00467 png_charp name; /* palette name */ 00468 png_byte depth; /* depth of palette samples */ 00469 png_sPLT_entryp entries; /* palette entries */ 00470 png_int_32 nentries; /* number of palette entries */ 00471 } png_sPLT_t; 00472 typedef png_sPLT_t FAR * png_sPLT_tp; 00473 typedef png_sPLT_t FAR * FAR * png_sPLT_tpp; 00474 00475 #ifdef PNG_TEXT_SUPPORTED 00476 /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, 00477 * and whether that contents is compressed or not. The "key" field 00478 * points to a regular zero-terminated C string. The "text", "lang", and 00479 * "lang_key" fields can be regular C strings, empty strings, or NULL pointers. 00480 * However, the * structure returned by png_get_text() will always contain 00481 * regular zero-terminated C strings (possibly empty), never NULL pointers, 00482 * so they can be safely used in printf() and other string-handling functions. 00483 */ 00484 typedef struct png_text_struct 00485 { 00486 int compression; /* compression value: 00487 -1: tEXt, none 00488 0: zTXt, deflate 00489 1: iTXt, none 00490 2: iTXt, deflate */ 00491 png_charp key; /* keyword, 1-79 character description of "text" */ 00492 png_charp text; /* comment, may be an empty string (ie "") 00493 or a NULL pointer */ 00494 png_size_t text_length; /* length of the text string */ 00495 #ifdef PNG_iTXt_SUPPORTED 00496 png_size_t itxt_length; /* length of the itxt string */ 00497 png_charp lang; /* language code, 0-79 characters 00498 or a NULL pointer */ 00499 png_charp lang_key; /* keyword translated UTF-8 string, 0 or more 00500 chars or a NULL pointer */ 00501 #endif 00502 } png_text; 00503 typedef png_text FAR * png_textp; 00504 typedef png_text FAR * FAR * png_textpp; 00505 #endif 00506 00507 /* Supported compression types for text in PNG files (tEXt, and zTXt). 00508 * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ 00509 #define PNG_TEXT_COMPRESSION_NONE_WR -3 00510 #define PNG_TEXT_COMPRESSION_zTXt_WR -2 00511 #define PNG_TEXT_COMPRESSION_NONE -1 00512 #define PNG_TEXT_COMPRESSION_zTXt 0 00513 #define PNG_ITXT_COMPRESSION_NONE 1 00514 #define PNG_ITXT_COMPRESSION_zTXt 2 00515 #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ 00516 00517 /* png_time is a way to hold the time in an machine independent way. 00518 * Two conversions are provided, both from time_t and struct tm. There 00519 * is no portable way to convert to either of these structures, as far 00520 * as I know. If you know of a portable way, send it to me. As a side 00521 * note - PNG has always been Year 2000 compliant! 00522 */ 00523 typedef struct png_time_struct 00524 { 00525 png_uint_16 year; /* full year, as in, 1995 */ 00526 png_byte month; /* month of year, 1 - 12 */ 00527 png_byte day; /* day of month, 1 - 31 */ 00528 png_byte hour; /* hour of day, 0 - 23 */ 00529 png_byte minute; /* minute of hour, 0 - 59 */ 00530 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ 00531 } png_time; 00532 typedef png_time FAR * png_timep; 00533 typedef png_time FAR * FAR * png_timepp; 00534 00535 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 00536 /* png_unknown_chunk is a structure to hold queued chunks for which there is 00537 * no specific support. The idea is that we can use this to queue 00538 * up private chunks for output even though the library doesn't actually 00539 * know about their semantics. 00540 */ 00541 typedef struct png_unknown_chunk_t 00542 { 00543 png_byte name[5]; 00544 png_byte *data; 00545 png_size_t size; 00546 00547 /* libpng-using applications should NOT directly modify this byte. */ 00548 png_byte location; /* mode of operation at read time */ 00549 } 00550 png_unknown_chunk; 00551 typedef png_unknown_chunk FAR * png_unknown_chunkp; 00552 typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; 00553 #endif 00554 00555 /* png_info is a structure that holds the information in a PNG file so 00556 * that the application can find out the characteristics of the image. 00557 * If you are reading the file, this structure will tell you what is 00558 * in the PNG file. If you are writing the file, fill in the information 00559 * you want to put into the PNG file, then call png_write_info(). 00560 * The names chosen should be very close to the PNG specification, so 00561 * consult that document for information about the meaning of each field. 00562 * 00563 * With libpng < 0.95, it was only possible to directly set and read the 00564 * the values in the png_info_struct, which meant that the contents and 00565 * order of the values had to remain fixed. With libpng 0.95 and later, 00566 * however, there are now functions that abstract the contents of 00567 * png_info_struct from the application, so this makes it easier to use 00568 * libpng with dynamic libraries, and even makes it possible to use 00569 * libraries that don't have all of the libpng ancillary chunk-handing 00570 * functionality. 00571 * 00572 * In any case, the order of the parameters in png_info_struct should NOT 00573 * be changed for as long as possible to keep compatibility with applications 00574 * that use the old direct-access method with png_info_struct. 00575 * 00576 * The following members may have allocated storage attached that should be 00577 * cleaned up before the structure is discarded: palette, trans, text, 00578 * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile, 00579 * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these 00580 * are automatically freed when the info structure is deallocated, if they were 00581 * allocated internally by libpng. This behavior can be changed by means 00582 * of the png_data_freer() function. 00583 * 00584 * More allocation details: all the chunk-reading functions that 00585 * change these members go through the corresponding png_set_* 00586 * functions. A function to clear these members is available: see 00587 * png_free_data(). The png_set_* functions do not depend on being 00588 * able to point info structure members to any of the storage they are 00589 * passed (they make their own copies), EXCEPT that the png_set_text 00590 * functions use the same storage passed to them in the text_ptr or 00591 * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns 00592 * functions do not make their own copies. 00593 */ 00594 typedef struct png_info_struct 00595 { 00596 /* the following are necessary for every PNG file */ 00597 png_uint_32 width; /* width of image in pixels (from IHDR) */ 00598 png_uint_32 height; /* height of image in pixels (from IHDR) */ 00599 png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ 00600 png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */ 00601 png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ 00602 png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */ 00603 png_uint_16 num_trans; /* number of transparent palette color (tRNS) */ 00604 png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */ 00605 png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */ 00606 /* The following three should have been named *_method not *_type */ 00607 png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */ 00608 png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ 00609 png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ 00610 00611 /* The following is informational only on read, and not used on writes. */ 00612 png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */ 00613 png_byte pixel_depth; /* number of bits per pixel */ 00614 png_byte spare_byte; /* to align the data, and for future use */ 00615 png_byte signature[8]; /* magic bytes read by libpng from start of file */ 00616 00617 /* The rest of the data is optional. If you are reading, check the 00618 * valid field to see if the information in these are valid. If you 00619 * are writing, set the valid field to those chunks you want written, 00620 * and initialize the appropriate fields below. 00621 */ 00622 00623 #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) 00624 /* The gAMA chunk describes the gamma characteristics of the system 00625 * on which the image was created, normally in the range [1.0, 2.5]. 00626 * Data is valid if (valid & PNG_INFO_gAMA) is non-zero. 00627 */ 00628 float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */ 00629 #endif 00630 00631 #if defined(PNG_sRGB_SUPPORTED) 00632 /* GR-P, 0.96a */ 00633 /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */ 00634 png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */ 00635 #endif 00636 00637 #if defined(PNG_TEXT_SUPPORTED) 00638 /* The tEXt, and zTXt chunks contain human-readable textual data in 00639 * uncompressed, compressed, and optionally compressed forms, respectively. 00640 * The data in "text" is an array of pointers to uncompressed, 00641 * null-terminated C strings. Each chunk has a keyword that describes the 00642 * textual data contained in that chunk. Keywords are not required to be 00643 * unique, and the text string may be empty. Any number of text chunks may 00644 * be in an image. 00645 */ 00646 int num_text; /* number of comments read/to write */ 00647 int max_text; /* current size of text array */ 00648 png_textp text; /* array of comments read/to write */ 00649 #endif /* PNG_TEXT_SUPPORTED */ 00650 00651 #if defined(PNG_tIME_SUPPORTED) 00652 /* The tIME chunk holds the last time the displayed image data was 00653 * modified. See the png_time struct for the contents of this struct. 00654 */ 00655 png_time mod_time; 00656 #endif 00657 00658 #if defined(PNG_sBIT_SUPPORTED) 00659 /* The sBIT chunk specifies the number of significant high-order bits 00660 * in the pixel data. Values are in the range [1, bit_depth], and are 00661 * only specified for the channels in the pixel data. The contents of 00662 * the low-order bits is not specified. Data is valid if 00663 * (valid & PNG_INFO_sBIT) is non-zero. 00664 */ 00665 png_color_8 sig_bit; /* significant bits in color channels */ 00666 #endif 00667 00668 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \ 00669 defined(PNG_READ_BACKGROUND_SUPPORTED) 00670 /* The tRNS chunk supplies transparency data for paletted images and 00671 * other image types that don't need a full alpha channel. There are 00672 * "num_trans" transparency values for a paletted image, stored in the 00673 * same order as the palette colors, starting from index 0. Values 00674 * for the data are in the range [0, 255], ranging from fully transparent 00675 * to fully opaque, respectively. For non-paletted images, there is a 00676 * single color specified that should be treated as fully transparent. 00677 * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. 00678 */ 00679 png_bytep trans; /* transparent values for paletted image */ 00680 png_color_16 trans_values; /* transparent color for non-palette image */ 00681 #endif 00682 00683 #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 00684 /* The bKGD chunk gives the suggested image background color if the 00685 * display program does not have its own background color and the image 00686 * is needs to composited onto a background before display. The colors 00687 * in "background" are normally in the same color space/depth as the 00688 * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero. 00689 */ 00690 png_color_16 background; 00691 #endif 00692 00693 #if defined(PNG_oFFs_SUPPORTED) 00694 /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards 00695 * and downwards from the top-left corner of the display, page, or other 00696 * application-specific co-ordinate space. See the PNG_OFFSET_ defines 00697 * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero. 00698 */ 00699 png_int_32 x_offset; /* x offset on page */ 00700 png_int_32 y_offset; /* y offset on page */ 00701 png_byte offset_unit_type; /* offset units type */ 00702 #endif 00703 00704 #if defined(PNG_pHYs_SUPPORTED) 00705 /* The pHYs chunk gives the physical pixel density of the image for 00706 * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_ 00707 * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero. 00708 */ 00709 png_uint_32 x_pixels_per_unit; /* horizontal pixel density */ 00710 png_uint_32 y_pixels_per_unit; /* vertical pixel density */ 00711 png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ 00712 #endif 00713 00714 #if defined(PNG_hIST_SUPPORTED) 00715 /* The hIST chunk contains the relative frequency or importance of the 00716 * various palette entries, so that a viewer can intelligently select a 00717 * reduced-color palette, if required. Data is an array of "num_palette" 00718 * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST) 00719 * is non-zero. 00720 */ 00721 png_uint_16p hist; 00722 #endif 00723 00724 #ifdef PNG_cHRM_SUPPORTED 00725 /* The cHRM chunk describes the CIE color characteristics of the monitor 00726 * on which the PNG was created. This data allows the viewer to do gamut 00727 * mapping of the input image to ensure that the viewer sees the same 00728 * colors in the image as the creator. Values are in the range 00729 * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero. 00730 */ 00731 #ifdef PNG_FLOATING_POINT_SUPPORTED 00732 float x_white; 00733 float y_white; 00734 float x_red; 00735 float y_red; 00736 float x_green; 00737 float y_green; 00738 float x_blue; 00739 float y_blue; 00740 #endif 00741 #endif 00742 00743 #if defined(PNG_pCAL_SUPPORTED) 00744 /* The pCAL chunk describes a transformation between the stored pixel 00745 * values and original physical data values used to create the image. 00746 * The integer range [0, 2^bit_depth - 1] maps to the floating-point 00747 * range given by [pcal_X0, pcal_X1], and are further transformed by a 00748 * (possibly non-linear) transformation function given by "pcal_type" 00749 * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_ 00750 * defines below, and the PNG-Group's PNG extensions document for a 00751 * complete description of the transformations and how they should be 00752 * implemented, and for a description of the ASCII parameter strings. 00753 * Data values are valid if (valid & PNG_INFO_pCAL) non-zero. 00754 */ 00755 png_charp pcal_purpose; /* pCAL chunk description string */ 00756 png_int_32 pcal_X0; /* minimum value */ 00757 png_int_32 pcal_X1; /* maximum value */ 00758 png_charp pcal_units; /* Latin-1 string giving physical units */ 00759 png_charpp pcal_params; /* ASCII strings containing parameter values */ 00760 png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */ 00761 png_byte pcal_nparams; /* number of parameters given in pcal_params */ 00762 #endif 00763 00764 /* New members added in libpng-1.0.6 */ 00765 #ifdef PNG_FREE_ME_SUPPORTED 00766 png_uint_32 free_me; /* flags items libpng is responsible for freeing */ 00767 #endif 00768 00769 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 00770 /* storage for unknown chunks that the library doesn't recognize. */ 00771 png_unknown_chunkp unknown_chunks; 00772 png_size_t unknown_chunks_num; 00773 #endif 00774 00775 #if defined(PNG_iCCP_SUPPORTED) 00776 /* iCCP chunk data. */ 00777 png_charp iccp_name; /* profile name */ 00778 png_charp iccp_profile; /* International Color Consortium profile data */ 00779 /* Note to maintainer: should be png_bytep */ 00780 png_uint_32 iccp_proflen; /* ICC profile data length */ 00781 png_byte iccp_compression; /* Always zero */ 00782 #endif 00783 00784 #if defined(PNG_sPLT_SUPPORTED) 00785 /* data on sPLT chunks (there may be more than one). */ 00786 png_sPLT_tp splt_palettes; 00787 png_uint_32 splt_palettes_num; 00788 #endif 00789 00790 #if defined(PNG_sCAL_SUPPORTED) 00791 /* The sCAL chunk describes the actual physical dimensions of the 00792 * subject matter of the graphic. The chunk contains a unit specification 00793 * a byte value, and two ASCII strings representing floating-point 00794 * values. The values are width and height corresponsing to one pixel 00795 * in the image. This external representation is converted to double 00796 * here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero. 00797 */ 00798 png_byte scal_unit; /* unit of physical scale */ 00799 #ifdef PNG_FLOATING_POINT_SUPPORTED 00800 double scal_pixel_width; /* width of one pixel */ 00801 double scal_pixel_height; /* height of one pixel */ 00802 #endif 00803 #ifdef PNG_FIXED_POINT_SUPPORTED 00804 png_charp scal_s_width; /* string containing height */ 00805 png_charp scal_s_height; /* string containing width */ 00806 #endif 00807 #endif 00808 00809 #if defined(PNG_INFO_IMAGE_SUPPORTED) 00810 /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */ 00811 /* Data valid if (valid & PNG_INFO_IDAT) non-zero */ 00812 png_bytepp row_pointers; /* the image bits */ 00813 #endif 00814 00815 #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED) 00816 png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */ 00817 #endif 00818 00819 #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED) 00820 png_fixed_point int_x_white; 00821 png_fixed_point int_y_white; 00822 png_fixed_point int_x_red; 00823 png_fixed_point int_y_red; 00824 png_fixed_point int_x_green; 00825 png_fixed_point int_y_green; 00826 png_fixed_point int_x_blue; 00827 png_fixed_point int_y_blue; 00828 #endif 00829 00830 } png_info; 00831 00832 typedef png_info FAR * png_infop; 00833 typedef png_info FAR * FAR * png_infopp; 00834 00835 /* Maximum positive integer used in PNG is (2^31)-1 */ 00836 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) 00837 #define PNG_UINT_32_MAX (~((png_uint_32)0)) 00838 #define PNG_SIZE_MAX (~((png_size_t)0)) 00839 /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */ 00840 #define PNG_MAX_UINT PNG_UINT_31_MAX 00841 00842 /* These describe the color_type field in png_info. */ 00843 /* color type masks */ 00844 #define PNG_COLOR_MASK_PALETTE 1 00845 #define PNG_COLOR_MASK_COLOR 2 00846 #define PNG_COLOR_MASK_ALPHA 4 00847 00848 /* color types. Note that not all combinations are legal */ 00849 #define PNG_COLOR_TYPE_GRAY 0 00850 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) 00851 #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) 00852 #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) 00853 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) 00854 /* aliases */ 00855 #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA 00856 #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA 00857 00858 /* This is for compression type. PNG 1.0-1.2 only define the single type. */ 00859 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ 00860 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE 00861 00862 /* This is for filter type. PNG 1.0-1.2 only define the single type. */ 00863 #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ 00864 #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ 00865 #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE 00866 00867 /* These are for the interlacing type. These values should NOT be changed. */ 00868 #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ 00869 #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ 00870 #define PNG_INTERLACE_LAST 2 /* Not a valid value */ 00871 00872 /* These are for the oFFs chunk. These values should NOT be changed. */ 00873 #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ 00874 #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ 00875 #define PNG_OFFSET_LAST 2 /* Not a valid value */ 00876 00877 /* These are for the pCAL chunk. These values should NOT be changed. */ 00878 #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ 00879 #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ 00880 #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ 00881 #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ 00882 #define PNG_EQUATION_LAST 4 /* Not a valid value */ 00883 00884 /* These are for the sCAL chunk. These values should NOT be changed. */ 00885 #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ 00886 #define PNG_SCALE_METER 1 /* meters per pixel */ 00887 #define PNG_SCALE_RADIAN 2 /* radians per pixel */ 00888 #define PNG_SCALE_LAST 3 /* Not a valid value */ 00889 00890 /* These are for the pHYs chunk. These values should NOT be changed. */ 00891 #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ 00892 #define PNG_RESOLUTION_METER 1 /* pixels/meter */ 00893 #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ 00894 00895 /* These are for the sRGB chunk. These values should NOT be changed. */ 00896 #define PNG_sRGB_INTENT_PERCEPTUAL 0 00897 #define PNG_sRGB_INTENT_RELATIVE 1 00898 #define PNG_sRGB_INTENT_SATURATION 2 00899 #define PNG_sRGB_INTENT_ABSOLUTE 3 00900 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ 00901 00902 /* This is for text chunks */ 00903 #define PNG_KEYWORD_MAX_LENGTH 79 00904 00905 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */ 00906 #define PNG_MAX_PALETTE_LENGTH 256 00907 00908 /* These determine if an ancillary chunk's data has been successfully read 00909 * from the PNG header, or if the application has filled in the corresponding 00910 * data in the info_struct to be written into the output file. The values 00911 * of the PNG_INFO_<chunk> defines should NOT be changed. 00912 */ 00913 #define PNG_INFO_gAMA 0x0001 00914 #define PNG_INFO_sBIT 0x0002 00915 #define PNG_INFO_cHRM 0x0004 00916 #define PNG_INFO_PLTE 0x0008 00917 #define PNG_INFO_tRNS 0x0010 00918 #define PNG_INFO_bKGD 0x0020 00919 #define PNG_INFO_hIST 0x0040 00920 #define PNG_INFO_pHYs 0x0080 00921 #define PNG_INFO_oFFs 0x0100 00922 #define PNG_INFO_tIME 0x0200 00923 #define PNG_INFO_pCAL 0x0400 00924 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ 00925 #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ 00926 #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ 00927 #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ 00928 #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ 00929 00930 /* This is used for the transformation routines, as some of them 00931 * change these values for the row. It also should enable using 00932 * the routines for other purposes. 00933 */ 00934 typedef struct png_row_info_struct 00935 { 00936 png_uint_32 width; /* width of row */ 00937 png_uint_32 rowbytes; /* number of bytes in row */ 00938 png_byte color_type; /* color type of row */ 00939 png_byte bit_depth; /* bit depth of row */ 00940 png_byte channels; /* number of channels (1, 2, 3, or 4) */ 00941 png_byte pixel_depth; /* bits per pixel (depth * channels) */ 00942 } png_row_info; 00943 00944 typedef png_row_info FAR * png_row_infop; 00945 typedef png_row_info FAR * FAR * png_row_infopp; 00946 00947 /* These are the function types for the I/O functions and for the functions 00948 * that allow the user to override the default I/O functions with his or her 00949 * own. The png_error_ptr type should match that of user-supplied warning 00950 * and error functions, while the png_rw_ptr type should match that of the 00951 * user read/write data functions. 00952 */ 00953 typedef struct png_struct_def png_struct; 00954 typedef png_struct FAR * png_structp; 00955 00956 typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); 00957 typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); 00958 typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); 00959 typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, 00960 int)); 00961 typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, 00962 int)); 00963 00964 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 00965 typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); 00966 typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); 00967 typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, 00968 png_uint_32, int)); 00969 #endif 00970 00971 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 00972 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ 00973 defined(PNG_LEGACY_SUPPORTED) 00974 typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, 00975 png_row_infop, png_bytep)); 00976 #endif 00977 00978 #if defined(PNG_USER_CHUNKS_SUPPORTED) 00979 typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); 00980 #endif 00981 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 00982 typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); 00983 #endif 00984 00985 /* Transform masks for the high-level interface */ 00986 #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ 00987 #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ 00988 #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ 00989 #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ 00990 #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ 00991 #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ 00992 #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ 00993 #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ 00994 #define PNG_TRANSFORM_BGR 0x0080 /* read and write */ 00995 #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ 00996 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ 00997 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ 00998 #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ 00999 01000 /* Flags for MNG supported features */ 01001 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 01002 #define PNG_FLAG_MNG_FILTER_64 0x04 01003 #define PNG_ALL_MNG_FEATURES 0x05 01004 01005 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); 01006 typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); 01007 01008 /* The structure that holds the information to read and write PNG files. 01009 * The only people who need to care about what is inside of this are the 01010 * people who will be modifying the library for their own special needs. 01011 * It should NOT be accessed directly by an application, except to store 01012 * the jmp_buf. 01013 */ 01014 01015 struct png_struct_def 01016 { 01017 #ifdef PNG_SETJMP_SUPPORTED 01018 jmp_buf jmpbuf; /* used in png_error */ 01019 #endif 01020 png_error_ptr error_fn; /* function for printing errors and aborting */ 01021 png_error_ptr warning_fn; /* function for printing warnings */ 01022 png_voidp error_ptr; /* user supplied struct for error functions */ 01023 png_rw_ptr write_data_fn; /* function for writing output data */ 01024 png_rw_ptr read_data_fn; /* function for reading input data */ 01025 png_voidp io_ptr; /* ptr to application struct for I/O functions */ 01026 01027 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) 01028 png_user_transform_ptr read_user_transform_fn; /* user read transform */ 01029 #endif 01030 01031 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) 01032 png_user_transform_ptr write_user_transform_fn; /* user write transform */ 01033 #endif 01034 01035 /* These were added in libpng-1.0.2 */ 01036 #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) 01037 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 01038 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) 01039 png_voidp user_transform_ptr; /* user supplied struct for user transform */ 01040 png_byte user_transform_depth; /* bit depth of user transformed pixels */ 01041 png_byte user_transform_channels; /* channels in user transformed pixels */ 01042 #endif 01043 #endif 01044 01045 png_uint_32 mode; /* tells us where we are in the PNG file */ 01046 png_uint_32 flags; /* flags indicating various things to libpng */ 01047 png_uint_32 transformations; /* which transformations to perform */ 01048 01049 z_stream zstream; /* pointer to decompression structure (below) */ 01050 png_bytep zbuf; /* buffer for zlib */ 01051 png_size_t zbuf_size; /* size of zbuf */ 01052 int zlib_level; /* holds zlib compression level */ 01053 int zlib_method; /* holds zlib compression method */ 01054 int zlib_window_bits; /* holds zlib compression window bits */ 01055 int zlib_mem_level; /* holds zlib compression memory level */ 01056 int zlib_strategy; /* holds zlib compression strategy */ 01057 01058 png_uint_32 width; /* width of image in pixels */ 01059 png_uint_32 height; /* height of image in pixels */ 01060 png_uint_32 num_rows; /* number of rows in current pass */ 01061 png_uint_32 usr_width; /* width of row at start of write */ 01062 png_uint_32 rowbytes; /* size of row in bytes */ 01063 png_uint_32 irowbytes; /* size of current interlaced row in bytes */ 01064 png_uint_32 iwidth; /* width of current interlaced row in pixels */ 01065 png_uint_32 row_number; /* current row in interlace pass */ 01066 png_bytep prev_row; /* buffer to save previous (unfiltered) row */ 01067 png_bytep row_buf; /* buffer to save current (unfiltered) row */ 01068 png_bytep sub_row; /* buffer to save "sub" row when filtering */ 01069 png_bytep up_row; /* buffer to save "up" row when filtering */ 01070 png_bytep avg_row; /* buffer to save "avg" row when filtering */ 01071 png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ 01072 png_row_info row_info; /* used for transformation routines */ 01073 01074 png_uint_32 idat_size; /* current IDAT size for read */ 01075 png_uint_32 crc; /* current chunk CRC value */ 01076 png_colorp palette; /* palette from the input file */ 01077 png_uint_16 num_palette; /* number of color entries in palette */ 01078 png_uint_16 num_trans; /* number of transparency values */ 01079 png_byte chunk_name[5]; /* null-terminated name of current chunk */ 01080 png_byte compression; /* file compression type (always 0) */ 01081 png_byte filter; /* file filter type (always 0) */ 01082 png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ 01083 png_byte pass; /* current interlace pass (0 - 6) */ 01084 png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ 01085 png_byte color_type; /* color type of file */ 01086 png_byte bit_depth; /* bit depth of file */ 01087 png_byte usr_bit_depth; /* bit depth of users row */ 01088 png_byte pixel_depth; /* number of bits per pixel */ 01089 png_byte channels; /* number of channels in file */ 01090 png_byte usr_channels; /* channels at start of write */ 01091 png_byte sig_bytes; /* magic bytes read/written from start of file */ 01092 01093 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) 01094 #ifdef PNG_LEGACY_SUPPORTED 01095 png_byte filler; /* filler byte for pixel expansion */ 01096 #else 01097 png_uint_16 filler; /* filler bytes for pixel expansion */ 01098 #endif 01099 #endif 01100 01101 #if defined(PNG_bKGD_SUPPORTED) 01102 png_byte background_gamma_type; 01103 # ifdef PNG_FLOATING_POINT_SUPPORTED 01104 float background_gamma; 01105 # endif 01106 png_color_16 background; /* background color in screen gamma space */ 01107 #if defined(PNG_READ_GAMMA_SUPPORTED) 01108 png_color_16 background_1; /* background normalized to gamma 1.0 */ 01109 #endif 01110 #endif /* PNG_bKGD_SUPPORTED */ 01111 01112 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 01113 png_flush_ptr output_flush_fn;/* Function for flushing output */ 01114 png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ 01115 png_uint_32 flush_rows; /* number of rows written since last flush */ 01116 #endif 01117 01118 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 01119 int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ 01120 #ifdef PNG_FLOATING_POINT_SUPPORTED 01121 float gamma; /* file gamma value */ 01122 float screen_gamma; /* screen gamma value (display_exponent) */ 01123 #endif 01124 #endif 01125 01126 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 01127 png_bytep gamma_table; /* gamma table for 8-bit depth files */ 01128 png_bytep gamma_from_1; /* converts from 1.0 to screen */ 01129 png_bytep gamma_to_1; /* converts from file to 1.0 */ 01130 png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ 01131 png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ 01132 png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ 01133 #endif 01134 01135 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) 01136 png_color_8 sig_bit; /* significant bits in each available channel */ 01137 #endif 01138 01139 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) 01140 png_color_8 shift; /* shift for significant bit tranformation */ 01141 #endif 01142 01143 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ 01144 || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 01145 png_bytep trans; /* transparency values for paletted files */ 01146 png_color_16 trans_values; /* transparency values for non-paletted files */ 01147 #endif 01148 01149 png_read_status_ptr read_row_fn; /* called after each row is decoded */ 01150 png_write_status_ptr write_row_fn; /* called after each row is encoded */ 01151 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 01152 png_progressive_info_ptr info_fn; /* called after header data fully read */ 01153 png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ 01154 png_progressive_end_ptr end_fn; /* called after image is complete */ 01155 png_bytep save_buffer_ptr; /* current location in save_buffer */ 01156 png_bytep save_buffer; /* buffer for previously read data */ 01157 png_bytep current_buffer_ptr; /* current location in current_buffer */ 01158 png_bytep current_buffer; /* buffer for recently used data */ 01159 png_uint_32 push_length; /* size of current input chunk */ 01160 png_uint_32 skip_length; /* bytes to skip in input data */ 01161 png_size_t save_buffer_size; /* amount of data now in save_buffer */ 01162 png_size_t save_buffer_max; /* total size of save_buffer */ 01163 png_size_t buffer_size; /* total amount of available input data */ 01164 png_size_t current_buffer_size; /* amount of data now in current_buffer */ 01165 int process_mode; /* what push library is currently doing */ 01166 int cur_palette; /* current push library palette index */ 01167 01168 # if defined(PNG_TEXT_SUPPORTED) 01169 png_size_t current_text_size; /* current size of text input data */ 01170 png_size_t current_text_left; /* how much text left to read in input */ 01171 png_charp current_text; /* current text chunk buffer */ 01172 png_charp current_text_ptr; /* current location in current_text */ 01173 # endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ 01174 01175 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ 01176 01177 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) 01178 /* for the Borland special 64K segment handler */ 01179 png_bytepp offset_table_ptr; 01180 png_bytep offset_table; 01181 png_uint_16 offset_table_number; 01182 png_uint_16 offset_table_count; 01183 png_uint_16 offset_table_count_free; 01184 #endif 01185 01186 #if defined(PNG_READ_DITHER_SUPPORTED) 01187 png_bytep palette_lookup; /* lookup table for dithering */ 01188 png_bytep dither_index; /* index translation for palette files */ 01189 #endif 01190 01191 #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) 01192 png_uint_16p hist; /* histogram */ 01193 #endif 01194 01195 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) 01196 png_byte heuristic_method; /* heuristic for row filter selection */ 01197 png_byte num_prev_filters; /* number of weights for previous rows */ 01198 png_bytep prev_filters; /* filter type(s) of previous row(s) */ 01199 png_uint_16p filter_weights; /* weight(s) for previous line(s) */ 01200 png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ 01201 png_uint_16p filter_costs; /* relative filter calculation cost */ 01202 png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ 01203 #endif 01204 01205 #if defined(PNG_TIME_RFC1123_SUPPORTED) 01206 png_charp time_buffer; /* String to hold RFC 1123 time text */ 01207 #endif 01208 01209 /* New members added in libpng-1.0.6 */ 01210 01211 #ifdef PNG_FREE_ME_SUPPORTED 01212 png_uint_32 free_me; /* flags items libpng is responsible for freeing */ 01213 #endif 01214 01215 #if defined(PNG_USER_CHUNKS_SUPPORTED) 01216 png_voidp user_chunk_ptr; 01217 png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ 01218 #endif 01219 01220 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 01221 int num_chunk_list; 01222 png_bytep chunk_list; 01223 #endif 01224 01225 /* New members added in libpng-1.0.3 */ 01226 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) 01227 png_byte rgb_to_gray_status; 01228 /* These were changed from png_byte in libpng-1.0.6 */ 01229 png_uint_16 rgb_to_gray_red_coeff; 01230 png_uint_16 rgb_to_gray_green_coeff; 01231 png_uint_16 rgb_to_gray_blue_coeff; 01232 #endif 01233 01234 /* New member added in libpng-1.0.4 (renamed in 1.0.9) */ 01235 #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ 01236 defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ 01237 defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) 01238 /* changed from png_byte to png_uint_32 at version 1.2.0 */ 01239 #ifdef PNG_1_0_X 01240 png_byte mng_features_permitted; 01241 #else 01242 png_uint_32 mng_features_permitted; 01243 #endif /* PNG_1_0_X */ 01244 #endif 01245 01246 /* New member added in libpng-1.0.7 */ 01247 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) 01248 png_fixed_point int_gamma; 01249 #endif 01250 01251 /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ 01252 #if defined(PNG_MNG_FEATURES_SUPPORTED) 01253 png_byte filter_type; 01254 #endif 01255 01256 #if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) 01257 /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ 01258 png_uint_32 row_buf_size; 01259 #endif 01260 01261 /* New members added in libpng-1.2.0 */ 01262 #if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) 01263 png_byte mmx_bitdepth_threshold; 01264 png_uint_32 mmx_rowbytes_threshold; 01265 png_uint_32 asm_flags; 01266 #endif 01267 01268 /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ 01269 #ifdef PNG_USER_MEM_SUPPORTED 01270 png_voidp mem_ptr; /* user supplied struct for mem functions */ 01271 png_malloc_ptr malloc_fn; /* function for allocating memory */ 01272 png_free_ptr free_fn; /* function for freeing memory */ 01273 #endif 01274 01275 /* New member added in libpng-1.0.13 and 1.2.0 */ 01276 png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ 01277 01278 #if defined(PNG_READ_DITHER_SUPPORTED) 01279 /* The following three members were added at version 1.0.14 and 1.2.4 */ 01280 png_bytep dither_sort; /* working sort array */ 01281 png_bytep index_to_palette; /* where the original index currently is */ 01282 /* in the palette */ 01283 png_bytep palette_to_index; /* which original index points to this */ 01284 /* palette color */ 01285 #endif 01286 01287 }; 01288 01289 01290 /* This prevents a compiler error in png.c if png.c and png.h are both at 01291 version 1.2.5 01292 */ 01293 typedef png_structp version_1_2_5; 01294 01295 typedef png_struct FAR * FAR * png_structpp; 01296 01297 /* Here are the function definitions most commonly used. This is not 01298 * the place to find out how to use libpng. See libpng.txt for the 01299 * full explanation, see example.c for the summary. This just provides 01300 * a simple one line description of the use of each function. 01301 */ 01302 01303 /* Returns the version number of the library */ 01304 extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); 01305 01306 /* Tell lib we have already handled the first <num_bytes> magic bytes. 01307 * Handling more than 8 bytes from the beginning of the file is an error. 01308 */ 01309 extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, 01310 int num_bytes)); 01311 01312 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a 01313 * PNG file. Returns zero if the supplied bytes match the 8-byte PNG 01314 * signature, and non-zero otherwise. Having num_to_check == 0 or 01315 * start > 7 will always fail (ie return non-zero). 01316 */ 01317 extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, 01318 png_size_t num_to_check)); 01319 01320 /* Simple signature checking function. This is the same as calling 01321 * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). 01322 */ 01323 extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); 01324 01325 /* Allocate and initialize png_ptr struct for reading, and any other memory. */ 01326 extern PNG_EXPORT(png_structp,png_create_read_struct) 01327 PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, 01328 png_error_ptr error_fn, png_error_ptr warn_fn)); 01329 01330 /* Allocate and initialize png_ptr struct for writing, and any other memory */ 01331 extern PNG_EXPORT(png_structp,png_create_write_struct) 01332 PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, 01333 png_error_ptr error_fn, png_error_ptr warn_fn)); 01334 01335 extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) 01336 PNGARG((png_structp png_ptr)); 01337 01338 extern PNG_EXPORT(void,png_set_compression_buffer_size) 01339 PNGARG((png_structp png_ptr, png_uint_32 size)); 01340 01341 /* Reset the compression stream */ 01342 extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); 01343 01344 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ 01345 #ifdef PNG_USER_MEM_SUPPORTED 01346 extern PNG_EXPORT(png_structp,png_create_read_struct_2) 01347 PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, 01348 png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, 01349 png_malloc_ptr malloc_fn, png_free_ptr free_fn)); 01350 extern PNG_EXPORT(png_structp,png_create_write_struct_2) 01351 PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, 01352 png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, 01353 png_malloc_ptr malloc_fn, png_free_ptr free_fn)); 01354 #endif 01355 01356 /* Write a PNG chunk - size, type, (optional) data, CRC. */ 01357 extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, 01358 png_bytep chunk_name, png_bytep data, png_size_t length)); 01359 01360 /* Write the start of a PNG chunk - length and chunk name. */ 01361 extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, 01362 png_bytep chunk_name, png_uint_32 length)); 01363 01364 /* Write the data of a PNG chunk started with png_write_chunk_start(). */ 01365 extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, 01366 png_bytep data, png_size_t length)); 01367 01368 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ 01369 extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); 01370 01371 /* Allocate and initialize the info structure */ 01372 extern PNG_EXPORT(png_infop,png_create_info_struct) 01373 PNGARG((png_structp png_ptr)); 01374 01375 /* Initialize the info structure (old interface - DEPRECATED) */ 01376 extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); 01377 #undef png_info_init 01378 #define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info)); 01379 extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, 01380 png_size_t png_info_struct_size)); 01381 01382 /* Writes all the PNG information before the image. */ 01383 extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, 01384 png_infop info_ptr)); 01385 extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, 01386 png_infop info_ptr)); 01387 01388 /* read the information before the actual image data. */ 01389 extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, 01390 png_infop info_ptr)); 01391 01392 #if defined(PNG_TIME_RFC1123_SUPPORTED) 01393 extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) 01394 PNGARG((png_structp png_ptr, png_timep ptime)); 01395 #endif 01396 01397 #if !defined(_WIN32_WCE) 01398 /* "time.h" functions are not supported on WindowsCE */ 01399 #if defined(PNG_WRITE_tIME_SUPPORTED) 01400 /* convert from a struct tm to png_time */ 01401 extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, 01402 struct tm FAR * ttime)); 01403 01404 /* convert from time_t to png_time. Uses gmtime() */ 01405 extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, 01406 time_t ttime)); 01407 #endif /* PNG_WRITE_tIME_SUPPORTED */ 01408 #endif /* _WIN32_WCE */ 01409 01410 #if defined(PNG_READ_EXPAND_SUPPORTED) 01411 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ 01412 extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); 01413 extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); 01414 extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); 01415 extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); 01416 #endif 01417 01418 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) 01419 /* Use blue, green, red order for pixels. */ 01420 extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); 01421 #endif 01422 01423 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) 01424 /* Expand the grayscale to 24-bit RGB if necessary. */ 01425 extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); 01426 #endif 01427 01428 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) 01429 /* Reduce RGB to grayscale. */ 01430 #ifdef PNG_FLOATING_POINT_SUPPORTED 01431 extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, 01432 int error_action, double red, double green )); 01433 #endif 01434 extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, 01435 int error_action, png_fixed_point red, png_fixed_point green )); 01436 extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp 01437 png_ptr)); 01438 #endif 01439 01440 extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, 01441 png_colorp palette)); 01442 01443 #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) 01444 extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); 01445 #endif 01446 01447 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ 01448 defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) 01449 extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); 01450 #endif 01451 01452 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ 01453 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) 01454 extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); 01455 #endif 01456 01457 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) 01458 /* Add a filler byte to 24-bit RGB images. */ 01459 extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, 01460 png_uint_32 filler, int flags)); 01461 /* The values of the PNG_FILLER_ defines should NOT be changed */ 01462 #define PNG_FILLER_BEFORE 0 01463 #define PNG_FILLER_AFTER 1 01464 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ 01465 01466 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) 01467 /* Swap bytes in 16-bit depth files. */ 01468 extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); 01469 #endif 01470 01471 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) 01472 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ 01473 extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); 01474 #endif 01475 01476 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) 01477 /* Swap packing order of pixels in bytes. */ 01478 extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); 01479 #endif 01480 01481 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) 01482 /* Converts files to legal bit depths. */ 01483 extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, 01484 png_color_8p true_bits)); 01485 #endif 01486 01487 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ 01488 defined(PNG_WRITE_INTERLACING_SUPPORTED) 01489 /* Have the code handle the interlacing. Returns the number of passes. */ 01490 extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); 01491 #endif 01492 01493 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) 01494 /* Invert monochrome files */ 01495 extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); 01496 #endif 01497 01498 #if defined(PNG_READ_BACKGROUND_SUPPORTED) 01499 /* Handle alpha and tRNS by replacing with a background color. */ 01500 #ifdef PNG_FLOATING_POINT_SUPPORTED 01501 extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, 01502 png_color_16p background_color, int background_gamma_code, 01503 int need_expand, double background_gamma)); 01504 #endif 01505 #define PNG_BACKGROUND_GAMMA_UNKNOWN 0 01506 #define PNG_BACKGROUND_GAMMA_SCREEN 1 01507 #define PNG_BACKGROUND_GAMMA_FILE 2 01508 #define PNG_BACKGROUND_GAMMA_UNIQUE 3 01509 #endif 01510 01511 #if defined(PNG_READ_16_TO_8_SUPPORTED) 01512 /* strip the second byte of information from a 16-bit depth file. */ 01513 extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); 01514 #endif 01515 01516 #if defined(PNG_READ_DITHER_SUPPORTED) 01517 /* Turn on dithering, and reduce the palette to the number of colors available. */ 01518 extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, 01519 png_colorp palette, int num_palette, int maximum_colors, 01520 png_uint_16p histogram, int full_dither)); 01521 #endif 01522 01523 #if defined(PNG_READ_GAMMA_SUPPORTED) 01524 /* Handle gamma correction. Screen_gamma=(display_exponent) */ 01525 #ifdef PNG_FLOATING_POINT_SUPPORTED 01526 extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, 01527 double screen_gamma, double default_file_gamma)); 01528 #endif 01529 #endif 01530 01531 #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ 01532 defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) 01533 /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ 01534 /* Deprecated and will be removed. Use png_permit_mng_features() instead. */ 01535 extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, 01536 int empty_plte_permitted)); 01537 #endif 01538 01539 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 01540 /* Set how many lines between output flushes - 0 for no flushing */ 01541 extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); 01542 /* Flush the current PNG output buffer */ 01543 extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); 01544 #endif 01545 01546 /* optional update palette with requested transformations */ 01547 extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); 01548 01549 /* optional call to update the users info structure */ 01550 extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, 01551 png_infop info_ptr)); 01552 01553 /* read one or more rows of image data. */ 01554 extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, 01555 png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); 01556 01557 /* read a row of data. */ 01558 extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, 01559 png_bytep row, 01560 png_bytep display_row)); 01561 01562 /* read the whole image into memory at once. */ 01563 extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, 01564 png_bytepp image)); 01565 01566 /* write a row of image data */ 01567 extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, 01568 png_bytep row)); 01569 01570 /* write a few rows of image data */ 01571 extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, 01572 png_bytepp row, png_uint_32 num_rows)); 01573 01574 /* write the image data */ 01575 extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, 01576 png_bytepp image)); 01577 01578 /* writes the end of the PNG file. */ 01579 extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, 01580 png_infop info_ptr)); 01581 01582 /* read the end of the PNG file. */ 01583 extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, 01584 png_infop info_ptr)); 01585 01586 /* free any memory associated with the png_info_struct */ 01587 extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, 01588 png_infopp info_ptr_ptr)); 01589 01590 /* free any memory associated with the png_struct and the png_info_structs */ 01591 extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp 01592 png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); 01593 01594 /* free all memory used by the read (old method - NOT DLL EXPORTED) */ 01595 extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, 01596 png_infop end_info_ptr)); 01597 01598 /* free any memory associated with the png_struct and the png_info_structs */ 01599 extern PNG_EXPORT(void,png_destroy_write_struct) 01600 PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); 01601 01602 /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ 01603 extern void png_write_destroy PNGARG((png_structp png_ptr)); 01604 01605 /* set the libpng method of handling chunk CRC errors */ 01606 extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, 01607 int crit_action, int ancil_action)); 01608 01609 /* Values for png_set_crc_action() to say how to handle CRC errors in 01610 * ancillary and critical chunks, and whether to use the data contained 01611 * therein. Note that it is impossible to "discard" data in a critical 01612 * chunk. For versions prior to 0.90, the action was always error/quit, 01613 * whereas in version 0.90 and later, the action for CRC errors in ancillary 01614 * chunks is warn/discard. These values should NOT be changed. 01615 * 01616 * value action:critical action:ancillary 01617 */ 01618 #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ 01619 #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ 01620 #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ 01621 #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ 01622 #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ 01623 #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ 01624 01625 /* These functions give the user control over the scan-line filtering in 01626 * libpng and the compression methods used by zlib. These functions are 01627 * mainly useful for testing, as the defaults should work with most users. 01628 * Those users who are tight on memory or want faster performance at the 01629 * expense of compression can modify them. See the compression library 01630 * header file (zlib.h) for an explination of the compression functions. 01631 */ 01632 01633 /* set the filtering method(s) used by libpng. Currently, the only valid 01634 * value for "method" is 0. 01635 */ 01636 extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, 01637 int filters)); 01638 01639 /* Flags for png_set_filter() to say which filters to use. The flags 01640 * are chosen so that they don't conflict with real filter types 01641 * below, in case they are supplied instead of the #defined constants. 01642 * These values should NOT be changed. 01643 */ 01644 #define PNG_NO_FILTERS 0x00 01645 #define PNG_FILTER_NONE 0x08 01646 #define PNG_FILTER_SUB 0x10 01647 #define PNG_FILTER_UP 0x20 01648 #define PNG_FILTER_AVG 0x40 01649 #define PNG_FILTER_PAETH 0x80 01650 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ 01651 PNG_FILTER_AVG | PNG_FILTER_PAETH) 01652 01653 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. 01654 * These defines should NOT be changed. 01655 */ 01656 #define PNG_FILTER_VALUE_NONE 0 01657 #define PNG_FILTER_VALUE_SUB 1 01658 #define PNG_FILTER_VALUE_UP 2 01659 #define PNG_FILTER_VALUE_AVG 3 01660 #define PNG_FILTER_VALUE_PAETH 4 01661 #define PNG_FILTER_VALUE_LAST 5 01662 01663 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ 01664 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ 01665 * defines, either the default (minimum-sum-of-absolute-differences), or 01666 * the experimental method (weighted-minimum-sum-of-absolute-differences). 01667 * 01668 * Weights are factors >= 1.0, indicating how important it is to keep the 01669 * filter type consistent between rows. Larger numbers mean the current 01670 * filter is that many times as likely to be the same as the "num_weights" 01671 * previous filters. This is cumulative for each previous row with a weight. 01672 * There needs to be "num_weights" values in "filter_weights", or it can be 01673 * NULL if the weights aren't being specified. Weights have no influence on 01674 * the selection of the first row filter. Well chosen weights can (in theory) 01675 * improve the compression for a given image. 01676 * 01677 * Costs are factors >= 1.0 indicating the relative decoding costs of a 01678 * filter type. Higher costs indicate more decoding expense, and are 01679 * therefore less likely to be selected over a filter with lower computational 01680 * costs. There needs to be a value in "filter_costs" for each valid filter 01681 * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't 01682 * setting the costs. Costs try to improve the speed of decompression without 01683 * unduly increasing the compressed image size. 01684 * 01685 * A negative weight or cost indicates the default value is to be used, and 01686 * values in the range [0.0, 1.0) indicate the value is to remain unchanged. 01687 * The default values for both weights and costs are currently 1.0, but may 01688 * change if good general weighting/cost heuristics can be found. If both 01689 * the weights and costs are set to 1.0, this degenerates the WEIGHTED method 01690 * to the UNWEIGHTED method, but with added encoding time/computation. 01691 */ 01692 #ifdef PNG_FLOATING_POINT_SUPPORTED 01693 extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, 01694 int heuristic_method, int num_weights, png_doublep filter_weights, 01695 png_doublep filter_costs)); 01696 #endif 01697 #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ 01698 01699 /* Heuristic used for row filter selection. These defines should NOT be 01700 * changed. 01701 */ 01702 #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ 01703 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ 01704 #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ 01705 #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ 01706 01707 /* Set the library compression level. Currently, valid values range from 01708 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 01709 * (0 - no compression, 9 - "maximal" compression). Note that tests have 01710 * shown that zlib compression levels 3-6 usually perform as well as level 9 01711 * for PNG images, and do considerably fewer caclulations. In the future, 01712 * these values may not correspond directly to the zlib compression levels. 01713 */ 01714 extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, 01715 int level)); 01716 01717 extern PNG_EXPORT(void,png_set_compression_mem_level) 01718 PNGARG((png_structp png_ptr, int mem_level)); 01719 01720 extern PNG_EXPORT(void,png_set_compression_strategy) 01721 PNGARG((png_structp png_ptr, int strategy)); 01722 01723 extern PNG_EXPORT(void,png_set_compression_window_bits) 01724 PNGARG((png_structp png_ptr, int window_bits)); 01725 01726 extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, 01727 int method)); 01728 01729 /* These next functions are called for input/output, memory, and error 01730 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, 01731 * and call standard C I/O routines such as fread(), fwrite(), and 01732 * fprintf(). These functions can be made to use other I/O routines 01733 * at run time for those applications that need to handle I/O in a 01734 * different manner by calling png_set_???_fn(). See libpng.txt for 01735 * more information. 01736 */ 01737 01738 #if !defined(PNG_NO_STDIO) 01739 /* Initialize the input/output for the PNG file to the default functions. */ 01740 extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); 01741 #endif 01742 01743 /* Replace the (error and abort), and warning functions with user 01744 * supplied functions. If no messages are to be printed you must still 01745 * write and use replacement functions. The replacement error_fn should 01746 * still do a longjmp to the last setjmp location if you are using this 01747 * method of error handling. If error_fn or warning_fn is NULL, the 01748 * default function will be used. 01749 */ 01750 01751 extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, 01752 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); 01753 01754 /* Return the user pointer associated with the error functions */ 01755 extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); 01756 01757 /* Replace the default data output functions with a user supplied one(s). 01758 * If buffered output is not used, then output_flush_fn can be set to NULL. 01759 * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time 01760 * output_flush_fn will be ignored (and thus can be NULL). 01761 */ 01762 extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, 01763 png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); 01764 01765 /* Replace the default data input function with a user supplied one. */ 01766 extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, 01767 png_voidp io_ptr, png_rw_ptr read_data_fn)); 01768 01769 /* Return the user pointer associated with the I/O functions */ 01770 extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); 01771 01772 extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, 01773 png_read_status_ptr read_row_fn)); 01774 01775 extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, 01776 png_write_status_ptr write_row_fn)); 01777 01778 #ifdef PNG_USER_MEM_SUPPORTED 01779 /* Replace the default memory allocation functions with user supplied one(s). */ 01780 extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, 01781 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); 01782 /* Return the user pointer associated with the memory functions */ 01783 extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); 01784 #endif 01785 01786 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 01787 defined(PNG_LEGACY_SUPPORTED) 01788 extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp 01789 png_ptr, png_user_transform_ptr read_user_transform_fn)); 01790 #endif 01791 01792 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ 01793 defined(PNG_LEGACY_SUPPORTED) 01794 extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp 01795 png_ptr, png_user_transform_ptr write_user_transform_fn)); 01796 #endif 01797 01798 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 01799 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ 01800 defined(PNG_LEGACY_SUPPORTED) 01801 extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp 01802 png_ptr, png_voidp user_transform_ptr, int user_transform_depth, 01803 int user_transform_channels)); 01804 /* Return the user pointer associated with the user transform functions */ 01805 extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) 01806 PNGARG((png_structp png_ptr)); 01807 #endif 01808 01809 #ifdef PNG_USER_CHUNKS_SUPPORTED 01810 extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, 01811 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); 01812 extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp 01813 png_ptr)); 01814 #endif 01815 01816 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 01817 /* Sets the function callbacks for the push reader, and a pointer to a 01818 * user-defined structure available to the callback functions. 01819 */ 01820 extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, 01821 png_voidp progressive_ptr, 01822 png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, 01823 png_progressive_end_ptr end_fn)); 01824 01825 /* returns the user pointer associated with the push read functions */ 01826 extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) 01827 PNGARG((png_structp png_ptr)); 01828 01829 /* function to be called when data becomes available */ 01830 extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, 01831 png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); 01832 01833 /* function that combines rows. Not very much different than the 01834 * png_combine_row() call. Is this even used????? 01835 */ 01836 extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, 01837 png_bytep old_row, png_bytep new_row)); 01838 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ 01839 01840 extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, 01841 png_uint_32 size)); 01842 01843 #if defined(PNG_1_0_X) 01844 # define png_malloc_warn png_malloc 01845 #else 01846 /* Added at libpng version 1.2.4 */ 01847 extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, 01848 png_uint_32 size)); 01849 #endif 01850 01851 /* frees a pointer allocated by png_malloc() */ 01852 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); 01853 01854 #if defined(PNG_1_0_X) 01855 /* Function to allocate memory for zlib. */ 01856 extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, 01857 uInt size)); 01858 01859 /* Function to free memory for zlib */ 01860 extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); 01861 #endif 01862 01863 /* Free data that was allocated internally */ 01864 extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, 01865 png_infop info_ptr, png_uint_32 free_me, int num)); 01866 #ifdef PNG_FREE_ME_SUPPORTED 01867 /* Reassign responsibility for freeing existing data, whether allocated 01868 * by libpng or by the application */ 01869 extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, 01870 png_infop info_ptr, int freer, png_uint_32 mask)); 01871 #endif 01872 /* assignments for png_data_freer */ 01873 #define PNG_DESTROY_WILL_FREE_DATA 1 01874 #define PNG_SET_WILL_FREE_DATA 1 01875 #define PNG_USER_WILL_FREE_DATA 2 01876 /* Flags for png_ptr->free_me and info_ptr->free_me */ 01877 #define PNG_FREE_HIST 0x0008 01878 #define PNG_FREE_ICCP 0x0010 01879 #define PNG_FREE_SPLT 0x0020 01880 #define PNG_FREE_ROWS 0x0040 01881 #define PNG_FREE_PCAL 0x0080 01882 #define PNG_FREE_SCAL 0x0100 01883 #define PNG_FREE_UNKN 0x0200 01884 #define PNG_FREE_LIST 0x0400 01885 #define PNG_FREE_PLTE 0x1000 01886 #define PNG_FREE_TRNS 0x2000 01887 #define PNG_FREE_TEXT 0x4000 01888 #define PNG_FREE_ALL 0x7fff 01889 #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ 01890 01891 #ifdef PNG_USER_MEM_SUPPORTED 01892 extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, 01893 png_uint_32 size)); 01894 extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, 01895 png_voidp ptr)); 01896 #endif 01897 01898 extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, 01899 png_voidp s1, png_voidp s2, png_uint_32 size)); 01900 01901 extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, 01902 png_voidp s1, int value, png_uint_32 size)); 01903 01904 #if defined(USE_FAR_KEYWORD) /* memory model conversion function */ 01905 extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, 01906 int check)); 01907 #endif /* USE_FAR_KEYWORD */ 01908 01909 /* Fatal error in PNG image of libpng - can't continue */ 01910 extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, 01911 png_const_charp error_message)); 01912 01913 /* The same, but the chunk name is prepended to the error string. */ 01914 extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, 01915 png_const_charp error_message)); 01916 01917 /* Non-fatal error in libpng. Can continue, but may have a problem. */ 01918 extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, 01919 png_const_charp warning_message)); 01920 01921 /* Non-fatal error in libpng, chunk name is prepended to message. */ 01922 extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, 01923 png_const_charp warning_message)); 01924 01925 /* The png_set_<chunk> functions are for storing values in the png_info_struct. 01926 * Similarly, the png_get_<chunk> calls are used to read values from the 01927 * png_info_struct, either storing the parameters in the passed variables, or 01928 * setting pointers into the png_info_struct where the data is stored. The 01929 * png_get_<chunk> functions return a non-zero value if the data was available 01930 * in info_ptr, or return zero and do not change any of the parameters if the 01931 * data was not available. 01932 * 01933 * These functions should be used instead of directly accessing png_info 01934 * to avoid problems with future changes in the size and internal layout of 01935 * png_info_struct. 01936 */ 01937 /* Returns "flag" if chunk data is valid in info_ptr. */ 01938 extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, 01939 png_infop info_ptr, png_uint_32 flag)); 01940 01941 /* Returns number of bytes needed to hold a transformed row. */ 01942 extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, 01943 png_infop info_ptr)); 01944 01945 #if defined(PNG_INFO_IMAGE_SUPPORTED) 01946 /* Returns row_pointers, which is an array of pointers to scanlines that was 01947 returned from png_read_png(). */ 01948 extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, 01949 png_infop info_ptr)); 01950 /* Set row_pointers, which is an array of pointers to scanlines for use 01951 by png_write_png(). */ 01952 extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, 01953 png_infop info_ptr, png_bytepp row_pointers)); 01954 #endif 01955 01956 /* Returns number of color channels in image. */ 01957 extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, 01958 png_infop info_ptr)); 01959 01960 #ifdef PNG_EASY_ACCESS_SUPPORTED 01961 /* Returns image width in pixels. */ 01962 extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp 01963 png_ptr, png_infop info_ptr)); 01964 01965 /* Returns image height in pixels. */ 01966 extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp 01967 png_ptr, png_infop info_ptr)); 01968 01969 /* Returns image bit_depth. */ 01970 extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp 01971 png_ptr, png_infop info_ptr)); 01972 01973 /* Returns image color_type. */ 01974 extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp 01975 png_ptr, png_infop info_ptr)); 01976 01977 /* Returns image filter_type. */ 01978 extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp 01979 png_ptr, png_infop info_ptr)); 01980 01981 /* Returns image interlace_type. */ 01982 extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp 01983 png_ptr, png_infop info_ptr)); 01984 01985 /* Returns image compression_type. */ 01986 extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp 01987 png_ptr, png_infop info_ptr)); 01988 01989 /* Returns image resolution in pixels per meter, from pHYs chunk data. */ 01990 extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp 01991 png_ptr, png_infop info_ptr)); 01992 extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp 01993 png_ptr, png_infop info_ptr)); 01994 extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp 01995 png_ptr, png_infop info_ptr)); 01996 01997 /* Returns pixel aspect ratio, computed from pHYs chunk data. */ 01998 #ifdef PNG_FLOATING_POINT_SUPPORTED 01999 extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp 02000 png_ptr, png_infop info_ptr)); 02001 #endif 02002 02003 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ 02004 extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp 02005 png_ptr, png_infop info_ptr)); 02006 extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp 02007 png_ptr, png_infop info_ptr)); 02008 extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp 02009 png_ptr, png_infop info_ptr)); 02010 extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp 02011 png_ptr, png_infop info_ptr)); 02012 02013 #endif /* PNG_EASY_ACCESS_SUPPORTED */ 02014 02015 /* Returns pointer to signature string read from PNG header */ 02016 extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, 02017 png_infop info_ptr)); 02018 02019 #if defined(PNG_bKGD_SUPPORTED) 02020 extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, 02021 png_infop info_ptr, png_color_16p *background)); 02022 #endif 02023 02024 #if defined(PNG_bKGD_SUPPORTED) 02025 extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, 02026 png_infop info_ptr, png_color_16p background)); 02027 #endif 02028 02029 #if defined(PNG_cHRM_SUPPORTED) 02030 #ifdef PNG_FLOATING_POINT_SUPPORTED 02031 extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, 02032 png_infop info_ptr, double *white_x, double *white_y, double *red_x, 02033 double *red_y, double *green_x, double *green_y, double *blue_x, 02034 double *blue_y)); 02035 #endif 02036 #ifdef PNG_FIXED_POINT_SUPPORTED 02037 extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, 02038 png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point 02039 *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, 02040 png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point 02041 *int_blue_x, png_fixed_point *int_blue_y)); 02042 #endif 02043 #endif 02044 02045 #if defined(PNG_cHRM_SUPPORTED) 02046 #ifdef PNG_FLOATING_POINT_SUPPORTED 02047 extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, 02048 png_infop info_ptr, double white_x, double white_y, double red_x, 02049 double red_y, double green_x, double green_y, double blue_x, double blue_y)); 02050 #endif 02051 #ifdef PNG_FIXED_POINT_SUPPORTED 02052 extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, 02053 png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, 02054 png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point 02055 int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, 02056 png_fixed_point int_blue_y)); 02057 #endif 02058 #endif 02059 02060 #if defined(PNG_gAMA_SUPPORTED) 02061 #ifdef PNG_FLOATING_POINT_SUPPORTED 02062 extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, 02063 png_infop info_ptr, double *file_gamma)); 02064 #endif 02065 extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, 02066 png_infop info_ptr, png_fixed_point *int_file_gamma)); 02067 #endif 02068 02069 #if defined(PNG_gAMA_SUPPORTED) 02070 #ifdef PNG_FLOATING_POINT_SUPPORTED 02071 extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, 02072 png_infop info_ptr, double file_gamma)); 02073 #endif 02074 extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, 02075 png_infop info_ptr, png_fixed_point int_file_gamma)); 02076 #endif 02077 02078 #if defined(PNG_hIST_SUPPORTED) 02079 extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, 02080 png_infop info_ptr, png_uint_16p *hist)); 02081 #endif 02082 02083 #if defined(PNG_hIST_SUPPORTED) 02084 extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, 02085 png_infop info_ptr, png_uint_16p hist)); 02086 #endif 02087 02088 extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, 02089 png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, 02090 int *bit_depth, int *color_type, int *interlace_method, 02091 int *compression_method, int *filter_method)); 02092 02093 extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, 02094 png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, 02095 int color_type, int interlace_method, int compression_method, 02096 int filter_method)); 02097 02098 #if defined(PNG_oFFs_SUPPORTED) 02099 extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, 02100 png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, 02101 int *unit_type)); 02102 #endif 02103 02104 #if defined(PNG_oFFs_SUPPORTED) 02105 extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, 02106 png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, 02107 int unit_type)); 02108 #endif 02109 02110 #if defined(PNG_pCAL_SUPPORTED) 02111 extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, 02112 png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, 02113 int *type, int *nparams, png_charp *units, png_charpp *params)); 02114 #endif 02115 02116 #if defined(PNG_pCAL_SUPPORTED) 02117 extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, 02118 png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, 02119 int type, int nparams, png_charp units, png_charpp params)); 02120 #endif 02121 02122 #if defined(PNG_pHYs_SUPPORTED) 02123 extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, 02124 png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); 02125 #endif 02126 02127 #if defined(PNG_pHYs_SUPPORTED) 02128 extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, 02129 png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); 02130 #endif 02131 02132 extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, 02133 png_infop info_ptr, png_colorp *palette, int *num_palette)); 02134 02135 extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, 02136 png_infop info_ptr, png_colorp palette, int num_palette)); 02137 02138 #if defined(PNG_sBIT_SUPPORTED) 02139 extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, 02140 png_infop info_ptr, png_color_8p *sig_bit)); 02141 #endif 02142 02143 #if defined(PNG_sBIT_SUPPORTED) 02144 extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, 02145 png_infop info_ptr, png_color_8p sig_bit)); 02146 #endif 02147 02148 #if defined(PNG_sRGB_SUPPORTED) 02149 extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, 02150 png_infop info_ptr, int *intent)); 02151 #endif 02152 02153 #if defined(PNG_sRGB_SUPPORTED) 02154 extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, 02155 png_infop info_ptr, int intent)); 02156 extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, 02157 png_infop info_ptr, int intent)); 02158 #endif 02159 02160 #if defined(PNG_iCCP_SUPPORTED) 02161 extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, 02162 png_infop info_ptr, png_charpp name, int *compression_type, 02163 png_charpp profile, png_uint_32 *proflen)); 02164 /* Note to maintainer: profile should be png_bytepp */ 02165 #endif 02166 02167 #if defined(PNG_iCCP_SUPPORTED) 02168 extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, 02169 png_infop info_ptr, png_charp name, int compression_type, 02170 png_charp profile, png_uint_32 proflen)); 02171 /* Note to maintainer: profile should be png_bytep */ 02172 #endif 02173 02174 #if defined(PNG_sPLT_SUPPORTED) 02175 extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, 02176 png_infop info_ptr, png_sPLT_tpp entries)); 02177 #endif 02178 02179 #if defined(PNG_sPLT_SUPPORTED) 02180 extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, 02181 png_infop info_ptr, png_sPLT_tp entries, int nentries)); 02182 #endif 02183 02184 #if defined(PNG_TEXT_SUPPORTED) 02185 /* png_get_text also returns the number of text chunks in *num_text */ 02186 extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, 02187 png_infop info_ptr, png_textp *text_ptr, int *num_text)); 02188 #endif 02189 02190 /* 02191 * Note while png_set_text() will accept a structure whose text, 02192 * language, and translated keywords are NULL pointers, the structure 02193 * returned by png_get_text will always contain regular 02194 * zero-terminated C strings. They might be empty strings but 02195 * they will never be NULL pointers. 02196 */ 02197 02198 #if defined(PNG_TEXT_SUPPORTED) 02199 extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, 02200 png_infop info_ptr, png_textp text_ptr, int num_text)); 02201 #endif 02202 02203 #if defined(PNG_tIME_SUPPORTED) 02204 extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, 02205 png_infop info_ptr, png_timep *mod_time)); 02206 #endif 02207 02208 #if defined(PNG_tIME_SUPPORTED) 02209 extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, 02210 png_infop info_ptr, png_timep mod_time)); 02211 #endif 02212 02213 #if defined(PNG_tRNS_SUPPORTED) 02214 extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, 02215 png_infop info_ptr, png_bytep *trans, int *num_trans, 02216 png_color_16p *trans_values)); 02217 #endif 02218 02219 #if defined(PNG_tRNS_SUPPORTED) 02220 extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, 02221 png_infop info_ptr, png_bytep trans, int num_trans, 02222 png_color_16p trans_values)); 02223 #endif 02224 02225 #if defined(PNG_tRNS_SUPPORTED) 02226 #endif 02227 02228 #if defined(PNG_sCAL_SUPPORTED) 02229 #ifdef PNG_FLOATING_POINT_SUPPORTED 02230 extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, 02231 png_infop info_ptr, int *unit, double *width, double *height)); 02232 #else 02233 #ifdef PNG_FIXED_POINT_SUPPORTED 02234 extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, 02235 png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); 02236 #endif 02237 #endif 02238 #endif /* PNG_sCAL_SUPPORTED */ 02239 02240 #if defined(PNG_sCAL_SUPPORTED) 02241 #ifdef PNG_FLOATING_POINT_SUPPORTED 02242 extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, 02243 png_infop info_ptr, int unit, double width, double height)); 02244 #endif 02245 #ifdef PNG_FIXED_POINT_SUPPORTED 02246 extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, 02247 png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); 02248 #endif 02249 #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ 02250 02251 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) 02252 /* provide a list of chunks and how they are to be handled, if the built-in 02253 handling or default unknown chunk handling is not desired. Any chunks not 02254 listed will be handled in the default manner. The IHDR and IEND chunks 02255 must not be listed. 02256 keep = 0: follow default behavour 02257 = 1: do not keep 02258 = 2: keep only if safe-to-copy 02259 = 3: keep even if unsafe-to-copy 02260 */ 02261 extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp 02262 png_ptr, int keep, png_bytep chunk_list, int num_chunks)); 02263 extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, 02264 png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); 02265 extern PNG_EXPORT(void, png_set_unknown_chunk_location) 02266 PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); 02267 extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp 02268 png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); 02269 #endif 02270 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 02271 PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep 02272 chunk_name)); 02273 #endif 02274 02275 /* Png_free_data() will turn off the "valid" flag for anything it frees. 02276 If you need to turn it off for a chunk that your application has freed, 02277 you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ 02278 extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, 02279 png_infop info_ptr, int mask)); 02280 02281 #if defined(PNG_INFO_IMAGE_SUPPORTED) 02282 /* The "params" pointer is currently not used and is for future expansion. */ 02283 extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, 02284 png_infop info_ptr, 02285 int transforms, 02286 png_voidp params)); 02287 extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, 02288 png_infop info_ptr, 02289 int transforms, 02290 png_voidp params)); 02291 #endif 02292 02293 /* Define PNG_DEBUG at compile time for debugging information. Higher 02294 * numbers for PNG_DEBUG mean more debugging information. This has 02295 * only been added since version 0.95 so it is not implemented throughout 02296 * libpng yet, but more support will be added as needed. 02297 */ 02298 #ifdef PNG_DEBUG 02299 #if (PNG_DEBUG > 0) 02300 #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) 02301 #include <crtdbg.h> 02302 #if (PNG_DEBUG > 1) 02303 #define png_debug(l,m) _RPT0(_CRT_WARN,m) 02304 #define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) 02305 #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) 02306 #endif 02307 #else /* PNG_DEBUG_FILE || !_MSC_VER */ 02308 #ifndef PNG_DEBUG_FILE 02309 #define PNG_DEBUG_FILE stderr 02310 #endif /* PNG_DEBUG_FILE */ 02311 #if (PNG_DEBUG > 1) 02312 #define png_debug(l,m) \ 02313 { \ 02314 int num_tabs=l; \ 02315 fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ 02316 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ 02317 } 02318 #define png_debug1(l,m,p1) \ 02319 { \ 02320 int num_tabs=l; \ 02321 fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ 02322 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ 02323 } 02324 #define png_debug2(l,m,p1,p2) \ 02325 { \ 02326 int num_tabs=l; \ 02327 fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ 02328 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ 02329 } 02330 #endif /* (PNG_DEBUG > 1) */ 02331 #endif /* _MSC_VER */ 02332 #endif /* (PNG_DEBUG > 0) */ 02333 #endif /* PNG_DEBUG */ 02334 #ifndef png_debug 02335 #define png_debug(l, m) 02336 #endif 02337 #ifndef png_debug1 02338 #define png_debug1(l, m, p1) 02339 #endif 02340 #ifndef png_debug2 02341 #define png_debug2(l, m, p1, p2) 02342 #endif 02343 02344 extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void)); 02345 02346 extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); 02347 extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); 02348 extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); 02349 extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); 02350 02351 #ifdef PNG_MNG_FEATURES_SUPPORTED 02352 extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp 02353 png_ptr, png_uint_32 mng_features_permitted)); 02354 #endif 02355 02356 /* Added to version 1.2.0 */ 02357 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 02358 #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ 02359 #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ 02360 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 02361 #define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 02362 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 02363 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 02364 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 02365 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 02366 #define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ 02367 02368 #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ 02369 | PNG_ASM_FLAG_MMX_READ_INTERLACE \ 02370 | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ 02371 | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ 02372 | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ 02373 | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) 02374 #define PNG_MMX_WRITE_FLAGS ( 0 ) 02375 02376 #define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ 02377 | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ 02378 | PNG_MMX_READ_FLAGS \ 02379 | PNG_MMX_WRITE_FLAGS ) 02380 02381 #define PNG_SELECT_READ 1 02382 #define PNG_SELECT_WRITE 2 02383 02384 02385 #if !defined(PNG_1_0_X) 02386 /* pngget.c */ 02387 extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) 02388 PNGARG((int flag_select, int *compilerID)); 02389 02390 /* pngget.c */ 02391 extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) 02392 PNGARG((int flag_select)); 02393 02394 /* pngget.c */ 02395 extern PNG_EXPORT(png_uint_32,png_get_asm_flags) 02396 PNGARG((png_structp png_ptr)); 02397 02398 /* pngget.c */ 02399 extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) 02400 PNGARG((png_structp png_ptr)); 02401 02402 /* pngget.c */ 02403 extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) 02404 PNGARG((png_structp png_ptr)); 02405 02406 /* pngset.c */ 02407 extern PNG_EXPORT(void,png_set_asm_flags) 02408 PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); 02409 02410 /* pngset.c */ 02411 extern PNG_EXPORT(void,png_set_mmx_thresholds) 02412 PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, 02413 png_uint_32 mmx_rowbytes_threshold)); 02414 02415 #endif /* PNG_1_0_X */ 02416 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ 02417 02418 #if !defined(PNG_1_0_X) 02419 /* png.c, pnggccrd.c, or pngvcrd.c */ 02420 extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); 02421 02422 /* Strip the prepended error numbers ("#nnn ") from error and warning 02423 * messages before passing them to the error or warning handler. */ 02424 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 02425 extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp 02426 png_ptr, png_uint_32 strip_mode)); 02427 #endif 02428 #endif /* PNG_1_0_X */ 02429 02430 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ 02431 02432 #define PNG_HEADER_VERSION_STRING \ 02433 " libpng version 1.2.5 - October 3, 2002 (header)\n" 02434 02435 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED 02436 /* With these routines we avoid an integer divide, which will be slower on 02437 * most machines. However, it does take more operations than the corresponding 02438 * divide method, so it may be slower on a few RISC systems. There are two 02439 * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. 02440 * 02441 * Note that the rounding factors are NOT supposed to be the same! 128 and 02442 * 32768 are correct for the NODIV code; 127 and 32767 are correct for the 02443 * standard method. 02444 * 02445 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] 02446 */ 02447 02448 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ 02449 02450 # define png_composite(composite, fg, alpha, bg) \ 02451 { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ 02452 + (png_uint_16)(bg)*(png_uint_16)(255 - \ 02453 (png_uint_16)(alpha)) + (png_uint_16)128); \ 02454 (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } 02455 02456 # define png_composite_16(composite, fg, alpha, bg) \ 02457 { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ 02458 + (png_uint_32)(bg)*(png_uint_32)(65535L - \ 02459 (png_uint_32)(alpha)) + (png_uint_32)32768L); \ 02460 (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } 02461 02462 #else /* standard method using integer division */ 02463 02464 # define png_composite(composite, fg, alpha, bg) \ 02465 (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ 02466 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ 02467 (png_uint_16)127) / 255) 02468 02469 # define png_composite_16(composite, fg, alpha, bg) \ 02470 (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ 02471 (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ 02472 (png_uint_32)32767) / (png_uint_32)65535L) 02473 02474 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ 02475 02476 /* These next functions are used internally in the code. They generally 02477 * shouldn't be used unless you are writing code to add or replace some 02478 * functionality in libpng. More information about most functions can 02479 * be found in the files where the functions are located. 02480 */ 02481 02482 #if defined(PNG_INTERNAL) 02483 02484 /* Various modes of operation. Note that after an init, mode is set to 02485 * zero automatically when the structure is created. 02486 */ 02487 #define PNG_HAVE_IHDR 0x01 02488 #define PNG_HAVE_PLTE 0x02 02489 #define PNG_HAVE_IDAT 0x04 02490 #define PNG_AFTER_IDAT 0x08 02491 #define PNG_HAVE_IEND 0x10 02492 #define PNG_HAVE_gAMA 0x20 02493 #define PNG_HAVE_cHRM 0x40 02494 #define PNG_HAVE_sRGB 0x80 02495 #define PNG_HAVE_CHUNK_HEADER 0x100 02496 #define PNG_WROTE_tIME 0x200 02497 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 02498 #define PNG_BACKGROUND_IS_GRAY 0x800 02499 #define PNG_HAVE_PNG_SIGNATURE 0x1000 02500 02501 /* flags for the transformations the PNG library does on the image data */ 02502 #define PNG_BGR 0x0001 02503 #define PNG_INTERLACE 0x0002 02504 #define PNG_PACK 0x0004 02505 #define PNG_SHIFT 0x0008 02506 #define PNG_SWAP_BYTES 0x0010 02507 #define PNG_INVERT_MONO 0x0020 02508 #define PNG_DITHER 0x0040 02509 #define PNG_BACKGROUND 0x0080 02510 #define PNG_BACKGROUND_EXPAND 0x0100 02511 /* 0x0200 unused */ 02512 #define PNG_16_TO_8 0x0400 02513 #define PNG_RGBA 0x0800 02514 #define PNG_EXPAND 0x1000 02515 #define PNG_GAMMA 0x2000 02516 #define PNG_GRAY_TO_RGB 0x4000 02517 #define PNG_FILLER 0x8000L 02518 #define PNG_PACKSWAP 0x10000L 02519 #define PNG_SWAP_ALPHA 0x20000L 02520 #define PNG_STRIP_ALPHA 0x40000L 02521 #define PNG_INVERT_ALPHA 0x80000L 02522 #define PNG_USER_TRANSFORM 0x100000L 02523 #define PNG_RGB_TO_GRAY_ERR 0x200000L 02524 #define PNG_RGB_TO_GRAY_WARN 0x400000L 02525 #define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ 02526 02527 /* flags for png_create_struct */ 02528 #define PNG_STRUCT_PNG 0x0001 02529 #define PNG_STRUCT_INFO 0x0002 02530 02531 /* Scaling factor for filter heuristic weighting calculations */ 02532 #define PNG_WEIGHT_SHIFT 8 02533 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) 02534 #define PNG_COST_SHIFT 3 02535 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) 02536 02537 /* flags for the png_ptr->flags rather than declaring a byte for each one */ 02538 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 02539 #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 02540 #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 02541 #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 02542 #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 02543 #define PNG_FLAG_ZLIB_FINISHED 0x0020 02544 #define PNG_FLAG_ROW_INIT 0x0040 02545 #define PNG_FLAG_FILLER_AFTER 0x0080 02546 #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 02547 #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 02548 #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 02549 #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 02550 #define PNG_FLAG_FREE_PLTE 0x1000 02551 #define PNG_FLAG_FREE_TRNS 0x2000 02552 #define PNG_FLAG_FREE_HIST 0x4000 02553 #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L 02554 #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L 02555 #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L 02556 #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L 02557 #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L 02558 #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L 02559 02560 /* For use in png_set_keep_unknown, png_handle_as_unknown */ 02561 #define HANDLE_CHUNK_AS_DEFAULT 0 02562 #define HANDLE_CHUNK_NEVER 1 02563 #define HANDLE_CHUNK_IF_SAFE 2 02564 #define HANDLE_CHUNK_ALWAYS 3 02565 02566 #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ 02567 PNG_FLAG_CRC_ANCILLARY_NOWARN) 02568 02569 #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ 02570 PNG_FLAG_CRC_CRITICAL_IGNORE) 02571 02572 #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ 02573 PNG_FLAG_CRC_CRITICAL_MASK) 02574 02575 /* save typing and make code easier to understand */ 02576 #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ 02577 abs((int)((c1).green) - (int)((c2).green)) + \ 02578 abs((int)((c1).blue) - (int)((c2).blue))) 02579 02580 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ 02581 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) 02582 /* place to hold the signature string for a PNG file. */ 02583 #ifdef PNG_USE_GLOBAL_ARRAYS 02584 PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; 02585 #else 02586 #define png_sig png_sig_bytes(NULL) 02587 #endif 02588 #endif /* PNG_NO_EXTERN */ 02589 02590 /* Constant strings for known chunk types. If you need to add a chunk, 02591 * define the name here, and add an invocation of the macro in png.c and 02592 * wherever it's needed. 02593 */ 02594 #define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} 02595 #define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} 02596 #define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} 02597 #define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} 02598 #define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} 02599 #define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} 02600 #define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} 02601 #define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} 02602 #define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} 02603 #define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} 02604 #define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} 02605 #define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} 02606 #define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} 02607 #define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} 02608 #define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} 02609 #define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} 02610 #define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} 02611 #define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} 02612 #define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} 02613 #define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} 02614 #define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} 02615 02616 #ifdef PNG_USE_GLOBAL_ARRAYS 02617 PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; 02618 PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; 02619 PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; 02620 PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; 02621 PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; 02622 PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; 02623 PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; 02624 PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; 02625 PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; 02626 PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; 02627 PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; 02628 PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; 02629 PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; 02630 PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; 02631 PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; 02632 PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; 02633 PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; 02634 PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; 02635 PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; 02636 PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; 02637 PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; 02638 #endif /* PNG_USE_GLOBAL_ARRAYS */ 02639 02640 02641 /* Inline macros to do direct reads of bytes from the input buffer. These 02642 * require that you are using an architecture that uses PNG byte ordering 02643 * (MSB first) and supports unaligned data storage. I think that PowerPC 02644 * in big-endian mode and 680x0 are the only ones that will support this. 02645 * The x86 line of processors definitely do not. The png_get_int_32() 02646 * routine also assumes we are using two's complement format for negative 02647 * values, which is almost certainly true. 02648 */ 02649 #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) 02650 # if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) 02651 # define png_get_int_32(buf) ( *((png_int_32p) (buf))) 02652 # endif 02653 # define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) 02654 # define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) 02655 #else 02656 # if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) 02657 PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf)); 02658 # endif 02659 PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf)); 02660 PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); 02661 #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ 02662 PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr, 02663 png_bytep buf)); 02664 02665 /* Initialize png_ptr struct for reading, and allocate any other memory. 02666 * (old interface - DEPRECATED - use png_create_read_struct instead). 02667 */ 02668 extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); 02669 #undef png_read_init 02670 #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ 02671 PNG_LIBPNG_VER_STRING, sizeof(png_struct)); 02672 extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, 02673 png_const_charp user_png_ver, png_size_t png_struct_size)); 02674 extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, 02675 png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t 02676 png_info_size)); 02677 02678 /* Initialize png_ptr struct for writing, and allocate any other memory. 02679 * (old interface - DEPRECATED - use png_create_write_struct instead). 02680 */ 02681 extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); 02682 #undef png_write_init 02683 #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ 02684 PNG_LIBPNG_VER_STRING, sizeof(png_struct)); 02685 extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, 02686 png_const_charp user_png_ver, png_size_t png_struct_size)); 02687 extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, 02688 png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t 02689 png_info_size)); 02690 02691 /* Allocate memory for an internal libpng struct */ 02692 PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); 02693 02694 /* Free memory from internal libpng struct */ 02695 PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); 02696 02697 PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr 02698 malloc_fn, png_voidp mem_ptr)); 02699 PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, 02700 png_free_ptr free_fn, png_voidp mem_ptr)); 02701 02702 /* Free any memory that info_ptr points to and reset struct. */ 02703 PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, 02704 png_infop info_ptr)); 02705 02706 #ifndef PNG_1_0_X 02707 /* Function to allocate memory for zlib. */ 02708 PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); 02709 02710 /* Function to free memory for zlib */ 02711 PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); 02712 02713 /* Next four functions are used internally as callbacks. PNGAPI is required 02714 * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ 02715 02716 PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, 02717 png_bytep data, png_size_t length)); 02718 02719 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 02720 PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, 02721 png_bytep buffer, png_size_t length)); 02722 #endif 02723 02724 PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, 02725 png_bytep data, png_size_t length)); 02726 02727 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 02728 #if !defined(PNG_NO_STDIO) 02729 PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); 02730 #endif 02731 #endif 02732 #else /* PNG_1_0_X */ 02733 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 02734 PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, 02735 png_bytep buffer, png_size_t length)); 02736 #endif 02737 #endif /* PNG_1_0_X */ 02738 02739 /* Reset the CRC variable */ 02740 PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); 02741 02742 /* Write the "data" buffer to whatever output you are using. */ 02743 PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, 02744 png_size_t length)); 02745 02746 /* Read data from whatever input you are using into the "data" buffer */ 02747 PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, 02748 png_size_t length)); 02749 02750 /* Read bytes into buf, and update png_ptr->crc */ 02751 PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, 02752 png_size_t length)); 02753 02754 /* Decompress data in a chunk that uses compression */ 02755 #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ 02756 defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) 02757 PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, 02758 int comp_type, png_charp chunkdata, png_size_t chunklength, 02759 png_size_t prefix_length, png_size_t *data_length)); 02760 #endif 02761 02762 /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ 02763 PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); 02764 02765 /* Read the CRC from the file and compare it to the libpng calculated CRC */ 02766 PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); 02767 02768 /* Calculate the CRC over a section of data. Note that we are only 02769 * passing a maximum of 64K on systems that have this as a memory limit, 02770 * since this is the maximum buffer size we can specify. 02771 */ 02772 PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, 02773 png_size_t length)); 02774 02775 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 02776 PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); 02777 #endif 02778 02779 02780 /* Place a 32-bit number into a buffer in PNG byte order (big-endian). 02781 * The only currently known PNG chunks that use signed numbers are 02782 * the ancillary extension chunks, oFFs and pCAL. 02783 */ 02784 PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i)); 02785 02786 #if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) 02787 PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i)); 02788 #endif 02789 02790 /* Place a 16-bit number into a buffer in PNG byte order. 02791 * The parameter is declared unsigned int, not png_uint_16, 02792 * just to avoid potential problems on pre-ANSI C compilers. 02793 */ 02794 PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i)); 02795 02796 /* simple function to write the signature */ 02797 PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); 02798 02799 /* write various chunks */ 02800 02801 /* Write the IHDR chunk, and update the png_struct with the necessary 02802 * information. 02803 */ 02804 PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, 02805 png_uint_32 height, 02806 int bit_depth, int color_type, int compression_method, int filter_method, 02807 int interlace_method)); 02808 02809 PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, 02810 png_uint_32 num_pal)); 02811 02812 PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, 02813 png_size_t length)); 02814 02815 PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); 02816 02817 #if defined(PNG_WRITE_gAMA_SUPPORTED) 02818 #ifdef PNG_FLOATING_POINT_SUPPORTED 02819 PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); 02820 #endif 02821 #ifdef PNG_FIXED_POINT_SUPPORTED 02822 PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point 02823 file_gamma)); 02824 #endif 02825 #endif 02826 02827 #if defined(PNG_WRITE_sBIT_SUPPORTED) 02828 PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, 02829 int color_type)); 02830 #endif 02831 02832 #if defined(PNG_WRITE_cHRM_SUPPORTED) 02833 #ifdef PNG_FLOATING_POINT_SUPPORTED 02834 PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, 02835 double white_x, double white_y, 02836 double red_x, double red_y, double green_x, double green_y, 02837 double blue_x, double blue_y)); 02838 #endif 02839 #ifdef PNG_FIXED_POINT_SUPPORTED 02840 PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, 02841 png_fixed_point int_white_x, png_fixed_point int_white_y, 02842 png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point 02843 int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, 02844 png_fixed_point int_blue_y)); 02845 #endif 02846 #endif 02847 02848 #if defined(PNG_WRITE_sRGB_SUPPORTED) 02849 PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, 02850 int intent)); 02851 #endif 02852 02853 #if defined(PNG_WRITE_iCCP_SUPPORTED) 02854 PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, 02855 png_charp name, int compression_type, 02856 png_charp profile, int proflen)); 02857 /* Note to maintainer: profile should be png_bytep */ 02858 #endif 02859 02860 #if defined(PNG_WRITE_sPLT_SUPPORTED) 02861 PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, 02862 png_sPLT_tp palette)); 02863 #endif 02864 02865 #if defined(PNG_WRITE_tRNS_SUPPORTED) 02866 PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, 02867 png_color_16p values, int number, int color_type)); 02868 #endif 02869 02870 #if defined(PNG_WRITE_bKGD_SUPPORTED) 02871 PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, 02872 png_color_16p values, int color_type)); 02873 #endif 02874 02875 #if defined(PNG_WRITE_hIST_SUPPORTED) 02876 PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, 02877 int num_hist)); 02878 #endif 02879 02880 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ 02881 defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) 02882 PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, 02883 png_charp key, png_charpp new_key)); 02884 #endif 02885 02886 #if defined(PNG_WRITE_tEXt_SUPPORTED) 02887 PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, 02888 png_charp text, png_size_t text_len)); 02889 #endif 02890 02891 #if defined(PNG_WRITE_zTXt_SUPPORTED) 02892 PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, 02893 png_charp text, png_size_t text_len, int compression)); 02894 #endif 02895 02896 #if defined(PNG_WRITE_iTXt_SUPPORTED) 02897 PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, 02898 int compression, png_charp key, png_charp lang, png_charp lang_key, 02899 png_charp text)); 02900 #endif 02901 02902 #if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ 02903 PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, 02904 png_infop info_ptr, png_textp text_ptr, int num_text)); 02905 #endif 02906 02907 #if defined(PNG_WRITE_oFFs_SUPPORTED) 02908 PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, 02909 png_int_32 x_offset, png_int_32 y_offset, int unit_type)); 02910 #endif 02911 02912 #if defined(PNG_WRITE_pCAL_SUPPORTED) 02913 PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, 02914 png_int_32 X0, png_int_32 X1, int type, int nparams, 02915 png_charp units, png_charpp params)); 02916 #endif 02917 02918 #if defined(PNG_WRITE_pHYs_SUPPORTED) 02919 PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, 02920 png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, 02921 int unit_type)); 02922 #endif 02923 02924 #if defined(PNG_WRITE_tIME_SUPPORTED) 02925 PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, 02926 png_timep mod_time)); 02927 #endif 02928 02929 #if defined(PNG_WRITE_sCAL_SUPPORTED) 02930 #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) 02931 PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, 02932 int unit, double width, double height)); 02933 #else 02934 #ifdef PNG_FIXED_POINT_SUPPORTED 02935 PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, 02936 int unit, png_charp width, png_charp height)); 02937 #endif 02938 #endif 02939 #endif 02940 02941 /* Called when finished processing a row of data */ 02942 PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); 02943 02944 /* Internal use only. Called before first row of data */ 02945 PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); 02946 02947 #if defined(PNG_READ_GAMMA_SUPPORTED) 02948 PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); 02949 #endif 02950 02951 /* combine a row of data, dealing with alpha, etc. if requested */ 02952 PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, 02953 int mask)); 02954 02955 #if defined(PNG_READ_INTERLACING_SUPPORTED) 02956 /* expand an interlaced row */ 02957 /* OLD pre-1.0.9 interface: 02958 PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, 02959 png_bytep row, int pass, png_uint_32 transformations)); 02960 */ 02961 PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); 02962 #endif 02963 02964 /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ 02965 02966 #if defined(PNG_WRITE_INTERLACING_SUPPORTED) 02967 /* grab pixels out of a row for an interlaced pass */ 02968 PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, 02969 png_bytep row, int pass)); 02970 #endif 02971 02972 /* unfilter a row */ 02973 PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, 02974 png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); 02975 02976 /* Choose the best filter to use and filter the row data */ 02977 PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, 02978 png_row_infop row_info)); 02979 02980 /* Write out the filtered row. */ 02981 PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, 02982 png_bytep filtered_row)); 02983 /* finish a row while reading, dealing with interlacing passes, etc. */ 02984 PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); 02985 02986 /* initialize the row buffers, etc. */ 02987 PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); 02988 /* optional call to update the users info structure */ 02989 PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, 02990 png_infop info_ptr)); 02991 02992 /* these are the functions that do the transformations */ 02993 #if defined(PNG_READ_FILLER_SUPPORTED) 02994 PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, 02995 png_bytep row, png_uint_32 filler, png_uint_32 flags)); 02996 #endif 02997 02998 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) 02999 PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, 03000 png_bytep row)); 03001 #endif 03002 03003 #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) 03004 PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, 03005 png_bytep row)); 03006 #endif 03007 03008 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) 03009 PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, 03010 png_bytep row)); 03011 #endif 03012 03013 #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) 03014 PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, 03015 png_bytep row)); 03016 #endif 03017 03018 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ 03019 defined(PNG_READ_STRIP_ALPHA_SUPPORTED) 03020 PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, 03021 png_bytep row, png_uint_32 flags)); 03022 #endif 03023 03024 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) 03025 PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); 03026 #endif 03027 03028 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) 03029 PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); 03030 #endif 03031 03032 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) 03033 PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop 03034 row_info, png_bytep row)); 03035 #endif 03036 03037 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) 03038 PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, 03039 png_bytep row)); 03040 #endif 03041 03042 #if defined(PNG_READ_PACK_SUPPORTED) 03043 PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); 03044 #endif 03045 03046 #if defined(PNG_READ_SHIFT_SUPPORTED) 03047 PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, 03048 png_color_8p sig_bits)); 03049 #endif 03050 03051 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) 03052 PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); 03053 #endif 03054 03055 #if defined(PNG_READ_16_TO_8_SUPPORTED) 03056 PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); 03057 #endif 03058 03059 #if defined(PNG_READ_DITHER_SUPPORTED) 03060 PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, 03061 png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); 03062 03063 # if defined(PNG_CORRECT_PALETTE_SUPPORTED) 03064 PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, 03065 png_colorp palette, int num_palette)); 03066 # endif 03067 #endif 03068 03069 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) 03070 PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); 03071 #endif 03072 03073 #if defined(PNG_WRITE_PACK_SUPPORTED) 03074 PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, 03075 png_bytep row, png_uint_32 bit_depth)); 03076 #endif 03077 03078 #if defined(PNG_WRITE_SHIFT_SUPPORTED) 03079 PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, 03080 png_color_8p bit_depth)); 03081 #endif 03082 03083 #if defined(PNG_READ_BACKGROUND_SUPPORTED) 03084 #if defined(PNG_READ_GAMMA_SUPPORTED) 03085 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, 03086 png_color_16p trans_values, png_color_16p background, 03087 png_color_16p background_1, 03088 png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, 03089 png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, 03090 png_uint_16pp gamma_16_to_1, int gamma_shift)); 03091 #else 03092 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, 03093 png_color_16p trans_values, png_color_16p background)); 03094 #endif 03095 #endif 03096 03097 #if defined(PNG_READ_GAMMA_SUPPORTED) 03098 PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, 03099 png_bytep gamma_table, png_uint_16pp gamma_16_table, 03100 int gamma_shift)); 03101 #endif 03102 03103 #if defined(PNG_READ_EXPAND_SUPPORTED) 03104 PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, 03105 png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); 03106 PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, 03107 png_bytep row, png_color_16p trans_value)); 03108 #endif 03109 03110 /* The following decodes the appropriate chunks, and does error correction, 03111 * then calls the appropriate callback for the chunk if it is valid. 03112 */ 03113 03114 /* decode the IHDR chunk */ 03115 PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, 03116 png_uint_32 length)); 03117 PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, 03118 png_uint_32 length)); 03119 PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, 03120 png_uint_32 length)); 03121 03122 #if defined(PNG_READ_bKGD_SUPPORTED) 03123 PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, 03124 png_uint_32 length)); 03125 #endif 03126 03127 #if defined(PNG_READ_cHRM_SUPPORTED) 03128 PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, 03129 png_uint_32 length)); 03130 #endif 03131 03132 #if defined(PNG_READ_gAMA_SUPPORTED) 03133 PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, 03134 png_uint_32 length)); 03135 #endif 03136 03137 #if defined(PNG_READ_hIST_SUPPORTED) 03138 PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, 03139 png_uint_32 length)); 03140 #endif 03141 03142 #if defined(PNG_READ_iCCP_SUPPORTED) 03143 extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, 03144 png_uint_32 length)); 03145 #endif /* PNG_READ_iCCP_SUPPORTED */ 03146 03147 #if defined(PNG_READ_iTXt_SUPPORTED) 03148 PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, 03149 png_uint_32 length)); 03150 #endif 03151 03152 #if defined(PNG_READ_oFFs_SUPPORTED) 03153 PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, 03154 png_uint_32 length)); 03155 #endif 03156 03157 #if defined(PNG_READ_pCAL_SUPPORTED) 03158 PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, 03159 png_uint_32 length)); 03160 #endif 03161 03162 #if defined(PNG_READ_pHYs_SUPPORTED) 03163 PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, 03164 png_uint_32 length)); 03165 #endif 03166 03167 #if defined(PNG_READ_sBIT_SUPPORTED) 03168 PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, 03169 png_uint_32 length)); 03170 #endif 03171 03172 #if defined(PNG_READ_sCAL_SUPPORTED) 03173 PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, 03174 png_uint_32 length)); 03175 #endif 03176 03177 #if defined(PNG_READ_sPLT_SUPPORTED) 03178 extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, 03179 png_uint_32 length)); 03180 #endif /* PNG_READ_sPLT_SUPPORTED */ 03181 03182 #if defined(PNG_READ_sRGB_SUPPORTED) 03183 PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, 03184 png_uint_32 length)); 03185 #endif 03186 03187 #if defined(PNG_READ_tEXt_SUPPORTED) 03188 PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, 03189 png_uint_32 length)); 03190 #endif 03191 03192 #if defined(PNG_READ_tIME_SUPPORTED) 03193 PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, 03194 png_uint_32 length)); 03195 #endif 03196 03197 #if defined(PNG_READ_tRNS_SUPPORTED) 03198 PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, 03199 png_uint_32 length)); 03200 #endif 03201 03202 #if defined(PNG_READ_zTXt_SUPPORTED) 03203 PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, 03204 png_uint_32 length)); 03205 #endif 03206 03207 PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, 03208 png_infop info_ptr, png_uint_32 length)); 03209 03210 PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, 03211 png_bytep chunk_name)); 03212 03213 /* handle the transformations for reading and writing */ 03214 PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); 03215 PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); 03216 03217 PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); 03218 03219 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED 03220 PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, 03221 png_infop info_ptr)); 03222 PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, 03223 png_infop info_ptr)); 03224 PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); 03225 PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, 03226 png_uint_32 length)); 03227 PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); 03228 PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); 03229 PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, 03230 png_bytep buffer, png_size_t buffer_length)); 03231 PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); 03232 PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, 03233 png_bytep buffer, png_size_t buffer_length)); 03234 PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); 03235 PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, 03236 png_infop info_ptr, png_uint_32 length)); 03237 PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, 03238 png_infop info_ptr)); 03239 PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, 03240 png_infop info_ptr)); 03241 PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); 03242 PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, 03243 png_infop info_ptr)); 03244 PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, 03245 png_infop info_ptr)); 03246 PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); 03247 #if defined(PNG_READ_tEXt_SUPPORTED) 03248 PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, 03249 png_infop info_ptr, png_uint_32 length)); 03250 PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, 03251 png_infop info_ptr)); 03252 #endif 03253 #if defined(PNG_READ_zTXt_SUPPORTED) 03254 PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, 03255 png_infop info_ptr, png_uint_32 length)); 03256 PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, 03257 png_infop info_ptr)); 03258 #endif 03259 #if defined(PNG_READ_iTXt_SUPPORTED) 03260 PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, 03261 png_infop info_ptr, png_uint_32 length)); 03262 PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, 03263 png_infop info_ptr)); 03264 #endif 03265 03266 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ 03267 03268 #ifdef PNG_MNG_FEATURES_SUPPORTED 03269 PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, 03270 png_bytep row)); 03271 PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, 03272 png_bytep row)); 03273 #endif 03274 03275 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) 03276 /* png.c */ /* PRIVATE */ 03277 PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); 03278 #endif 03279 /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ 03280 03281 #endif /* PNG_INTERNAL */ 03282 03283 #ifdef __cplusplus 03284 } 03285 #endif 03286 03287 #endif /* PNG_VERSION_INFO_ONLY */ 03288 /* do not put anything past this line */ 03289 #endif /* PNG_H */