istereo

annotate libs/libpng/pngconf.h @ 26:862a3329a8f0

wohooo, added a shitload of code from zlib/libpng/libjpeg. When the good lord was raining shared libraries the iphone held a fucking umbrella...
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 06:28:38 +0300
parents
children
rev   line source
nuclear@26 1
nuclear@26 2 /* pngconf.h - machine configurable file for libpng
nuclear@26 3 *
nuclear@26 4 * libpng version 1.2.33 - October 31, 2008
nuclear@26 5 * For conditions of distribution and use, see copyright notice in png.h
nuclear@26 6 * Copyright (c) 1998-2008 Glenn Randers-Pehrson
nuclear@26 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
nuclear@26 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
nuclear@26 9 */
nuclear@26 10
nuclear@26 11 /* Any machine specific code is near the front of this file, so if you
nuclear@26 12 * are configuring libpng for a machine, you may want to read the section
nuclear@26 13 * starting here down to where it starts to typedef png_color, png_text,
nuclear@26 14 * and png_info.
nuclear@26 15 */
nuclear@26 16
nuclear@26 17 #ifndef PNGCONF_H
nuclear@26 18 #define PNGCONF_H
nuclear@26 19
nuclear@26 20 #define PNG_1_2_X
nuclear@26 21
nuclear@26 22 /*
nuclear@26 23 * PNG_USER_CONFIG has to be defined on the compiler command line. This
nuclear@26 24 * includes the resource compiler for Windows DLL configurations.
nuclear@26 25 */
nuclear@26 26 #ifdef PNG_USER_CONFIG
nuclear@26 27 # ifndef PNG_USER_PRIVATEBUILD
nuclear@26 28 # define PNG_USER_PRIVATEBUILD
nuclear@26 29 # endif
nuclear@26 30 #include "pngusr.h"
nuclear@26 31 #endif
nuclear@26 32
nuclear@26 33 /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
nuclear@26 34 #ifdef PNG_CONFIGURE_LIBPNG
nuclear@26 35 #ifdef HAVE_CONFIG_H
nuclear@26 36 #include "config.h"
nuclear@26 37 #endif
nuclear@26 38 #endif
nuclear@26 39
nuclear@26 40 /*
nuclear@26 41 * Added at libpng-1.2.8
nuclear@26 42 *
nuclear@26 43 * If you create a private DLL you need to define in "pngusr.h" the followings:
nuclear@26 44 * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
nuclear@26 45 * the DLL was built>
nuclear@26 46 * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
nuclear@26 47 * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
nuclear@26 48 * distinguish your DLL from those of the official release. These
nuclear@26 49 * correspond to the trailing letters that come after the version
nuclear@26 50 * number and must match your private DLL name>
nuclear@26 51 * e.g. // private DLL "libpng13gx.dll"
nuclear@26 52 * #define PNG_USER_DLLFNAME_POSTFIX "gx"
nuclear@26 53 *
nuclear@26 54 * The following macros are also at your disposal if you want to complete the
nuclear@26 55 * DLL VERSIONINFO structure.
nuclear@26 56 * - PNG_USER_VERSIONINFO_COMMENTS
nuclear@26 57 * - PNG_USER_VERSIONINFO_COMPANYNAME
nuclear@26 58 * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
nuclear@26 59 */
nuclear@26 60
nuclear@26 61 #ifdef __STDC__
nuclear@26 62 #ifdef SPECIALBUILD
nuclear@26 63 # pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
nuclear@26 64 are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
nuclear@26 65 #endif
nuclear@26 66
nuclear@26 67 #ifdef PRIVATEBUILD
nuclear@26 68 # pragma message("PRIVATEBUILD is deprecated.\
nuclear@26 69 Use PNG_USER_PRIVATEBUILD instead.")
nuclear@26 70 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
nuclear@26 71 #endif
nuclear@26 72 #endif /* __STDC__ */
nuclear@26 73
nuclear@26 74 #ifndef PNG_VERSION_INFO_ONLY
nuclear@26 75
nuclear@26 76 /* End of material added to libpng-1.2.8 */
nuclear@26 77
nuclear@26 78 /* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
nuclear@26 79 Restored at libpng-1.2.21 */
nuclear@26 80 #if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
nuclear@26 81 !defined(PNG_WARN_UNINITIALIZED_ROW)
nuclear@26 82 # define PNG_WARN_UNINITIALIZED_ROW 1
nuclear@26 83 #endif
nuclear@26 84 /* End of material added at libpng-1.2.19/1.2.21 */
nuclear@26 85
nuclear@26 86 /* This is the size of the compression buffer, and thus the size of
nuclear@26 87 * an IDAT chunk. Make this whatever size you feel is best for your
nuclear@26 88 * machine. One of these will be allocated per png_struct. When this
nuclear@26 89 * is full, it writes the data to the disk, and does some other
nuclear@26 90 * calculations. Making this an extremely small size will slow
nuclear@26 91 * the library down, but you may want to experiment to determine
nuclear@26 92 * where it becomes significant, if you are concerned with memory
nuclear@26 93 * usage. Note that zlib allocates at least 32Kb also. For readers,
nuclear@26 94 * this describes the size of the buffer available to read the data in.
nuclear@26 95 * Unless this gets smaller than the size of a row (compressed),
nuclear@26 96 * it should not make much difference how big this is.
nuclear@26 97 */
nuclear@26 98
nuclear@26 99 #ifndef PNG_ZBUF_SIZE
nuclear@26 100 # define PNG_ZBUF_SIZE 8192
nuclear@26 101 #endif
nuclear@26 102
nuclear@26 103 /* Enable if you want a write-only libpng */
nuclear@26 104
nuclear@26 105 #ifndef PNG_NO_READ_SUPPORTED
nuclear@26 106 # define PNG_READ_SUPPORTED
nuclear@26 107 #endif
nuclear@26 108
nuclear@26 109 /* Enable if you want a read-only libpng */
nuclear@26 110
nuclear@26 111 #ifndef PNG_NO_WRITE_SUPPORTED
nuclear@26 112 # define PNG_WRITE_SUPPORTED
nuclear@26 113 #endif
nuclear@26 114
nuclear@26 115 /* Enabled by default in 1.2.0. You can disable this if you don't need to
nuclear@26 116 support PNGs that are embedded in MNG datastreams */
nuclear@26 117 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
nuclear@26 118 # ifndef PNG_MNG_FEATURES_SUPPORTED
nuclear@26 119 # define PNG_MNG_FEATURES_SUPPORTED
nuclear@26 120 # endif
nuclear@26 121 #endif
nuclear@26 122
nuclear@26 123 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
nuclear@26 124 # ifndef PNG_FLOATING_POINT_SUPPORTED
nuclear@26 125 # define PNG_FLOATING_POINT_SUPPORTED
nuclear@26 126 # endif
nuclear@26 127 #endif
nuclear@26 128
nuclear@26 129 /* If you are running on a machine where you cannot allocate more
nuclear@26 130 * than 64K of memory at once, uncomment this. While libpng will not
nuclear@26 131 * normally need that much memory in a chunk (unless you load up a very
nuclear@26 132 * large file), zlib needs to know how big of a chunk it can use, and
nuclear@26 133 * libpng thus makes sure to check any memory allocation to verify it
nuclear@26 134 * will fit into memory.
nuclear@26 135 #define PNG_MAX_MALLOC_64K
nuclear@26 136 */
nuclear@26 137 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
nuclear@26 138 # define PNG_MAX_MALLOC_64K
nuclear@26 139 #endif
nuclear@26 140
nuclear@26 141 /* Special munging to support doing things the 'cygwin' way:
nuclear@26 142 * 'Normal' png-on-win32 defines/defaults:
nuclear@26 143 * PNG_BUILD_DLL -- building dll
nuclear@26 144 * PNG_USE_DLL -- building an application, linking to dll
nuclear@26 145 * (no define) -- building static library, or building an
nuclear@26 146 * application and linking to the static lib
nuclear@26 147 * 'Cygwin' defines/defaults:
nuclear@26 148 * PNG_BUILD_DLL -- (ignored) building the dll
nuclear@26 149 * (no define) -- (ignored) building an application, linking to the dll
nuclear@26 150 * PNG_STATIC -- (ignored) building the static lib, or building an
nuclear@26 151 * application that links to the static lib.
nuclear@26 152 * ALL_STATIC -- (ignored) building various static libs, or building an
nuclear@26 153 * application that links to the static libs.
nuclear@26 154 * Thus,
nuclear@26 155 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
nuclear@26 156 * this bit of #ifdefs will define the 'correct' config variables based on
nuclear@26 157 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
nuclear@26 158 * unnecessary.
nuclear@26 159 *
nuclear@26 160 * Also, the precedence order is:
nuclear@26 161 * ALL_STATIC (since we can't #undef something outside our namespace)
nuclear@26 162 * PNG_BUILD_DLL
nuclear@26 163 * PNG_STATIC
nuclear@26 164 * (nothing) == PNG_USE_DLL
nuclear@26 165 *
nuclear@26 166 * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
nuclear@26 167 * of auto-import in binutils, we no longer need to worry about
nuclear@26 168 * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
nuclear@26 169 * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
nuclear@26 170 * to __declspec() stuff. However, we DO need to worry about
nuclear@26 171 * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
nuclear@26 172 * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
nuclear@26 173 */
nuclear@26 174 #if defined(__CYGWIN__)
nuclear@26 175 # if defined(ALL_STATIC)
nuclear@26 176 # if defined(PNG_BUILD_DLL)
nuclear@26 177 # undef PNG_BUILD_DLL
nuclear@26 178 # endif
nuclear@26 179 # if defined(PNG_USE_DLL)
nuclear@26 180 # undef PNG_USE_DLL
nuclear@26 181 # endif
nuclear@26 182 # if defined(PNG_DLL)
nuclear@26 183 # undef PNG_DLL
nuclear@26 184 # endif
nuclear@26 185 # if !defined(PNG_STATIC)
nuclear@26 186 # define PNG_STATIC
nuclear@26 187 # endif
nuclear@26 188 # else
nuclear@26 189 # if defined (PNG_BUILD_DLL)
nuclear@26 190 # if defined(PNG_STATIC)
nuclear@26 191 # undef PNG_STATIC
nuclear@26 192 # endif
nuclear@26 193 # if defined(PNG_USE_DLL)
nuclear@26 194 # undef PNG_USE_DLL
nuclear@26 195 # endif
nuclear@26 196 # if !defined(PNG_DLL)
nuclear@26 197 # define PNG_DLL
nuclear@26 198 # endif
nuclear@26 199 # else
nuclear@26 200 # if defined(PNG_STATIC)
nuclear@26 201 # if defined(PNG_USE_DLL)
nuclear@26 202 # undef PNG_USE_DLL
nuclear@26 203 # endif
nuclear@26 204 # if defined(PNG_DLL)
nuclear@26 205 # undef PNG_DLL
nuclear@26 206 # endif
nuclear@26 207 # else
nuclear@26 208 # if !defined(PNG_USE_DLL)
nuclear@26 209 # define PNG_USE_DLL
nuclear@26 210 # endif
nuclear@26 211 # if !defined(PNG_DLL)
nuclear@26 212 # define PNG_DLL
nuclear@26 213 # endif
nuclear@26 214 # endif
nuclear@26 215 # endif
nuclear@26 216 # endif
nuclear@26 217 #endif
nuclear@26 218
nuclear@26 219 /* This protects us against compilers that run on a windowing system
nuclear@26 220 * and thus don't have or would rather us not use the stdio types:
nuclear@26 221 * stdin, stdout, and stderr. The only one currently used is stderr
nuclear@26 222 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
nuclear@26 223 * prevent these from being compiled and used. #defining PNG_NO_STDIO
nuclear@26 224 * will also prevent these, plus will prevent the entire set of stdio
nuclear@26 225 * macros and functions (FILE *, printf, etc.) from being compiled and used,
nuclear@26 226 * unless (PNG_DEBUG > 0) has been #defined.
nuclear@26 227 *
nuclear@26 228 * #define PNG_NO_CONSOLE_IO
nuclear@26 229 * #define PNG_NO_STDIO
nuclear@26 230 */
nuclear@26 231
nuclear@26 232 #if defined(_WIN32_WCE)
nuclear@26 233 # include <windows.h>
nuclear@26 234 /* Console I/O functions are not supported on WindowsCE */
nuclear@26 235 # define PNG_NO_CONSOLE_IO
nuclear@26 236 # ifdef PNG_DEBUG
nuclear@26 237 # undef PNG_DEBUG
nuclear@26 238 # endif
nuclear@26 239 #endif
nuclear@26 240
nuclear@26 241 #ifdef PNG_BUILD_DLL
nuclear@26 242 # ifndef PNG_CONSOLE_IO_SUPPORTED
nuclear@26 243 # ifndef PNG_NO_CONSOLE_IO
nuclear@26 244 # define PNG_NO_CONSOLE_IO
nuclear@26 245 # endif
nuclear@26 246 # endif
nuclear@26 247 #endif
nuclear@26 248
nuclear@26 249 # ifdef PNG_NO_STDIO
nuclear@26 250 # ifndef PNG_NO_CONSOLE_IO
nuclear@26 251 # define PNG_NO_CONSOLE_IO
nuclear@26 252 # endif
nuclear@26 253 # ifdef PNG_DEBUG
nuclear@26 254 # if (PNG_DEBUG > 0)
nuclear@26 255 # include <stdio.h>
nuclear@26 256 # endif
nuclear@26 257 # endif
nuclear@26 258 # else
nuclear@26 259 # if !defined(_WIN32_WCE)
nuclear@26 260 /* "stdio.h" functions are not supported on WindowsCE */
nuclear@26 261 # include <stdio.h>
nuclear@26 262 # endif
nuclear@26 263 # endif
nuclear@26 264
nuclear@26 265 /* This macro protects us against machines that don't have function
nuclear@26 266 * prototypes (ie K&R style headers). If your compiler does not handle
nuclear@26 267 * function prototypes, define this macro and use the included ansi2knr.
nuclear@26 268 * I've always been able to use _NO_PROTO as the indicator, but you may
nuclear@26 269 * need to drag the empty declaration out in front of here, or change the
nuclear@26 270 * ifdef to suit your own needs.
nuclear@26 271 */
nuclear@26 272 #ifndef PNGARG
nuclear@26 273
nuclear@26 274 #ifdef OF /* zlib prototype munger */
nuclear@26 275 # define PNGARG(arglist) OF(arglist)
nuclear@26 276 #else
nuclear@26 277
nuclear@26 278 #ifdef _NO_PROTO
nuclear@26 279 # define PNGARG(arglist) ()
nuclear@26 280 # ifndef PNG_TYPECAST_NULL
nuclear@26 281 # define PNG_TYPECAST_NULL
nuclear@26 282 # endif
nuclear@26 283 #else
nuclear@26 284 # define PNGARG(arglist) arglist
nuclear@26 285 #endif /* _NO_PROTO */
nuclear@26 286
nuclear@26 287
nuclear@26 288 #endif /* OF */
nuclear@26 289
nuclear@26 290 #endif /* PNGARG */
nuclear@26 291
nuclear@26 292 /* Try to determine if we are compiling on a Mac. Note that testing for
nuclear@26 293 * just __MWERKS__ is not good enough, because the Codewarrior is now used
nuclear@26 294 * on non-Mac platforms.
nuclear@26 295 */
nuclear@26 296 #ifndef MACOS
nuclear@26 297 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
nuclear@26 298 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
nuclear@26 299 # define MACOS
nuclear@26 300 # endif
nuclear@26 301 #endif
nuclear@26 302
nuclear@26 303 /* enough people need this for various reasons to include it here */
nuclear@26 304 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
nuclear@26 305 # include <sys/types.h>
nuclear@26 306 #endif
nuclear@26 307
nuclear@26 308 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
nuclear@26 309 # define PNG_SETJMP_SUPPORTED
nuclear@26 310 #endif
nuclear@26 311
nuclear@26 312 #ifdef PNG_SETJMP_SUPPORTED
nuclear@26 313 /* This is an attempt to force a single setjmp behaviour on Linux. If
nuclear@26 314 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
nuclear@26 315 */
nuclear@26 316
nuclear@26 317 # ifdef __linux__
nuclear@26 318 # ifdef _BSD_SOURCE
nuclear@26 319 # define PNG_SAVE_BSD_SOURCE
nuclear@26 320 # undef _BSD_SOURCE
nuclear@26 321 # endif
nuclear@26 322 # ifdef _SETJMP_H
nuclear@26 323 /* If you encounter a compiler error here, see the explanation
nuclear@26 324 * near the end of INSTALL.
nuclear@26 325 */
nuclear@26 326 __pngconf.h__ already includes setjmp.h;
nuclear@26 327 __dont__ include it again.;
nuclear@26 328 # endif
nuclear@26 329 # endif /* __linux__ */
nuclear@26 330
nuclear@26 331 /* include setjmp.h for error handling */
nuclear@26 332 # include <setjmp.h>
nuclear@26 333
nuclear@26 334 # ifdef __linux__
nuclear@26 335 # ifdef PNG_SAVE_BSD_SOURCE
nuclear@26 336 # ifndef _BSD_SOURCE
nuclear@26 337 # define _BSD_SOURCE
nuclear@26 338 # endif
nuclear@26 339 # undef PNG_SAVE_BSD_SOURCE
nuclear@26 340 # endif
nuclear@26 341 # endif /* __linux__ */
nuclear@26 342 #endif /* PNG_SETJMP_SUPPORTED */
nuclear@26 343
nuclear@26 344 #ifdef BSD
nuclear@26 345 # include <strings.h>
nuclear@26 346 #else
nuclear@26 347 # include <string.h>
nuclear@26 348 #endif
nuclear@26 349
nuclear@26 350 /* Other defines for things like memory and the like can go here. */
nuclear@26 351 #ifdef PNG_INTERNAL
nuclear@26 352
nuclear@26 353 #include <stdlib.h>
nuclear@26 354
nuclear@26 355 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
nuclear@26 356 * aren't usually used outside the library (as far as I know), so it is
nuclear@26 357 * debatable if they should be exported at all. In the future, when it is
nuclear@26 358 * possible to have run-time registry of chunk-handling functions, some of
nuclear@26 359 * these will be made available again.
nuclear@26 360 #define PNG_EXTERN extern
nuclear@26 361 */
nuclear@26 362 #define PNG_EXTERN
nuclear@26 363
nuclear@26 364 /* Other defines specific to compilers can go here. Try to keep
nuclear@26 365 * them inside an appropriate ifdef/endif pair for portability.
nuclear@26 366 */
nuclear@26 367
nuclear@26 368 #if defined(PNG_FLOATING_POINT_SUPPORTED)
nuclear@26 369 # if defined(MACOS)
nuclear@26 370 /* We need to check that <math.h> hasn't already been included earlier
nuclear@26 371 * as it seems it doesn't agree with <fp.h>, yet we should really use
nuclear@26 372 * <fp.h> if possible.
nuclear@26 373 */
nuclear@26 374 # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
nuclear@26 375 # include <fp.h>
nuclear@26 376 # endif
nuclear@26 377 # else
nuclear@26 378 # include <math.h>
nuclear@26 379 # endif
nuclear@26 380 # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
nuclear@26 381 /* Amiga SAS/C: We must include builtin FPU functions when compiling using
nuclear@26 382 * MATH=68881
nuclear@26 383 */
nuclear@26 384 # include <m68881.h>
nuclear@26 385 # endif
nuclear@26 386 #endif
nuclear@26 387
nuclear@26 388 /* Codewarrior on NT has linking problems without this. */
nuclear@26 389 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
nuclear@26 390 # define PNG_ALWAYS_EXTERN
nuclear@26 391 #endif
nuclear@26 392
nuclear@26 393 /* This provides the non-ANSI (far) memory allocation routines. */
nuclear@26 394 #if defined(__TURBOC__) && defined(__MSDOS__)
nuclear@26 395 # include <mem.h>
nuclear@26 396 # include <alloc.h>
nuclear@26 397 #endif
nuclear@26 398
nuclear@26 399 /* I have no idea why is this necessary... */
nuclear@26 400 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
nuclear@26 401 defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
nuclear@26 402 # include <malloc.h>
nuclear@26 403 #endif
nuclear@26 404
nuclear@26 405 /* This controls how fine the dithering gets. As this allocates
nuclear@26 406 * a largish chunk of memory (32K), those who are not as concerned
nuclear@26 407 * with dithering quality can decrease some or all of these.
nuclear@26 408 */
nuclear@26 409 #ifndef PNG_DITHER_RED_BITS
nuclear@26 410 # define PNG_DITHER_RED_BITS 5
nuclear@26 411 #endif
nuclear@26 412 #ifndef PNG_DITHER_GREEN_BITS
nuclear@26 413 # define PNG_DITHER_GREEN_BITS 5
nuclear@26 414 #endif
nuclear@26 415 #ifndef PNG_DITHER_BLUE_BITS
nuclear@26 416 # define PNG_DITHER_BLUE_BITS 5
nuclear@26 417 #endif
nuclear@26 418
nuclear@26 419 /* This controls how fine the gamma correction becomes when you
nuclear@26 420 * are only interested in 8 bits anyway. Increasing this value
nuclear@26 421 * results in more memory being used, and more pow() functions
nuclear@26 422 * being called to fill in the gamma tables. Don't set this value
nuclear@26 423 * less then 8, and even that may not work (I haven't tested it).
nuclear@26 424 */
nuclear@26 425
nuclear@26 426 #ifndef PNG_MAX_GAMMA_8
nuclear@26 427 # define PNG_MAX_GAMMA_8 11
nuclear@26 428 #endif
nuclear@26 429
nuclear@26 430 /* This controls how much a difference in gamma we can tolerate before
nuclear@26 431 * we actually start doing gamma conversion.
nuclear@26 432 */
nuclear@26 433 #ifndef PNG_GAMMA_THRESHOLD
nuclear@26 434 # define PNG_GAMMA_THRESHOLD 0.05
nuclear@26 435 #endif
nuclear@26 436
nuclear@26 437 #endif /* PNG_INTERNAL */
nuclear@26 438
nuclear@26 439 /* The following uses const char * instead of char * for error
nuclear@26 440 * and warning message functions, so some compilers won't complain.
nuclear@26 441 * If you do not want to use const, define PNG_NO_CONST here.
nuclear@26 442 */
nuclear@26 443
nuclear@26 444 #ifndef PNG_NO_CONST
nuclear@26 445 # define PNG_CONST const
nuclear@26 446 #else
nuclear@26 447 # define PNG_CONST
nuclear@26 448 #endif
nuclear@26 449
nuclear@26 450 /* The following defines give you the ability to remove code from the
nuclear@26 451 * library that you will not be using. I wish I could figure out how to
nuclear@26 452 * automate this, but I can't do that without making it seriously hard
nuclear@26 453 * on the users. So if you are not using an ability, change the #define
nuclear@26 454 * to and #undef, and that part of the library will not be compiled. If
nuclear@26 455 * your linker can't find a function, you may want to make sure the
nuclear@26 456 * ability is defined here. Some of these depend upon some others being
nuclear@26 457 * defined. I haven't figured out all the interactions here, so you may
nuclear@26 458 * have to experiment awhile to get everything to compile. If you are
nuclear@26 459 * creating or using a shared library, you probably shouldn't touch this,
nuclear@26 460 * as it will affect the size of the structures, and this will cause bad
nuclear@26 461 * things to happen if the library and/or application ever change.
nuclear@26 462 */
nuclear@26 463
nuclear@26 464 /* Any features you will not be using can be undef'ed here */
nuclear@26 465
nuclear@26 466 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
nuclear@26 467 * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
nuclear@26 468 * on the compile line, then pick and choose which ones to define without
nuclear@26 469 * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
nuclear@26 470 * if you only want to have a png-compliant reader/writer but don't need
nuclear@26 471 * any of the extra transformations. This saves about 80 kbytes in a
nuclear@26 472 * typical installation of the library. (PNG_NO_* form added in version
nuclear@26 473 * 1.0.1c, for consistency)
nuclear@26 474 */
nuclear@26 475
nuclear@26 476 /* The size of the png_text structure changed in libpng-1.0.6 when
nuclear@26 477 * iTXt support was added. iTXt support was turned off by default through
nuclear@26 478 * libpng-1.2.x, to support old apps that malloc the png_text structure
nuclear@26 479 * instead of calling png_set_text() and letting libpng malloc it. It
nuclear@26 480 * was turned on by default in libpng-1.3.0.
nuclear@26 481 */
nuclear@26 482
nuclear@26 483 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
nuclear@26 484 # ifndef PNG_NO_iTXt_SUPPORTED
nuclear@26 485 # define PNG_NO_iTXt_SUPPORTED
nuclear@26 486 # endif
nuclear@26 487 # ifndef PNG_NO_READ_iTXt
nuclear@26 488 # define PNG_NO_READ_iTXt
nuclear@26 489 # endif
nuclear@26 490 # ifndef PNG_NO_WRITE_iTXt
nuclear@26 491 # define PNG_NO_WRITE_iTXt
nuclear@26 492 # endif
nuclear@26 493 #endif
nuclear@26 494
nuclear@26 495 #if !defined(PNG_NO_iTXt_SUPPORTED)
nuclear@26 496 # if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
nuclear@26 497 # define PNG_READ_iTXt
nuclear@26 498 # endif
nuclear@26 499 # if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
nuclear@26 500 # define PNG_WRITE_iTXt
nuclear@26 501 # endif
nuclear@26 502 #endif
nuclear@26 503
nuclear@26 504 /* The following support, added after version 1.0.0, can be turned off here en
nuclear@26 505 * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
nuclear@26 506 * with old applications that require the length of png_struct and png_info
nuclear@26 507 * to remain unchanged.
nuclear@26 508 */
nuclear@26 509
nuclear@26 510 #ifdef PNG_LEGACY_SUPPORTED
nuclear@26 511 # define PNG_NO_FREE_ME
nuclear@26 512 # define PNG_NO_READ_UNKNOWN_CHUNKS
nuclear@26 513 # define PNG_NO_WRITE_UNKNOWN_CHUNKS
nuclear@26 514 # define PNG_NO_READ_USER_CHUNKS
nuclear@26 515 # define PNG_NO_READ_iCCP
nuclear@26 516 # define PNG_NO_WRITE_iCCP
nuclear@26 517 # define PNG_NO_READ_iTXt
nuclear@26 518 # define PNG_NO_WRITE_iTXt
nuclear@26 519 # define PNG_NO_READ_sCAL
nuclear@26 520 # define PNG_NO_WRITE_sCAL
nuclear@26 521 # define PNG_NO_READ_sPLT
nuclear@26 522 # define PNG_NO_WRITE_sPLT
nuclear@26 523 # define PNG_NO_INFO_IMAGE
nuclear@26 524 # define PNG_NO_READ_RGB_TO_GRAY
nuclear@26 525 # define PNG_NO_READ_USER_TRANSFORM
nuclear@26 526 # define PNG_NO_WRITE_USER_TRANSFORM
nuclear@26 527 # define PNG_NO_USER_MEM
nuclear@26 528 # define PNG_NO_READ_EMPTY_PLTE
nuclear@26 529 # define PNG_NO_MNG_FEATURES
nuclear@26 530 # define PNG_NO_FIXED_POINT_SUPPORTED
nuclear@26 531 #endif
nuclear@26 532
nuclear@26 533 /* Ignore attempt to turn off both floating and fixed point support */
nuclear@26 534 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
nuclear@26 535 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
nuclear@26 536 # define PNG_FIXED_POINT_SUPPORTED
nuclear@26 537 #endif
nuclear@26 538
nuclear@26 539 #ifndef PNG_NO_FREE_ME
nuclear@26 540 # define PNG_FREE_ME_SUPPORTED
nuclear@26 541 #endif
nuclear@26 542
nuclear@26 543 #if defined(PNG_READ_SUPPORTED)
nuclear@26 544
nuclear@26 545 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
nuclear@26 546 !defined(PNG_NO_READ_TRANSFORMS)
nuclear@26 547 # define PNG_READ_TRANSFORMS_SUPPORTED
nuclear@26 548 #endif
nuclear@26 549
nuclear@26 550 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
nuclear@26 551 # ifndef PNG_NO_READ_EXPAND
nuclear@26 552 # define PNG_READ_EXPAND_SUPPORTED
nuclear@26 553 # endif
nuclear@26 554 # ifndef PNG_NO_READ_SHIFT
nuclear@26 555 # define PNG_READ_SHIFT_SUPPORTED
nuclear@26 556 # endif
nuclear@26 557 # ifndef PNG_NO_READ_PACK
nuclear@26 558 # define PNG_READ_PACK_SUPPORTED
nuclear@26 559 # endif
nuclear@26 560 # ifndef PNG_NO_READ_BGR
nuclear@26 561 # define PNG_READ_BGR_SUPPORTED
nuclear@26 562 # endif
nuclear@26 563 # ifndef PNG_NO_READ_SWAP
nuclear@26 564 # define PNG_READ_SWAP_SUPPORTED
nuclear@26 565 # endif
nuclear@26 566 # ifndef PNG_NO_READ_PACKSWAP
nuclear@26 567 # define PNG_READ_PACKSWAP_SUPPORTED
nuclear@26 568 # endif
nuclear@26 569 # ifndef PNG_NO_READ_INVERT
nuclear@26 570 # define PNG_READ_INVERT_SUPPORTED
nuclear@26 571 # endif
nuclear@26 572 # ifndef PNG_NO_READ_DITHER
nuclear@26 573 # define PNG_READ_DITHER_SUPPORTED
nuclear@26 574 # endif
nuclear@26 575 # ifndef PNG_NO_READ_BACKGROUND
nuclear@26 576 # define PNG_READ_BACKGROUND_SUPPORTED
nuclear@26 577 # endif
nuclear@26 578 # ifndef PNG_NO_READ_16_TO_8
nuclear@26 579 # define PNG_READ_16_TO_8_SUPPORTED
nuclear@26 580 # endif
nuclear@26 581 # ifndef PNG_NO_READ_FILLER
nuclear@26 582 # define PNG_READ_FILLER_SUPPORTED
nuclear@26 583 # endif
nuclear@26 584 # ifndef PNG_NO_READ_GAMMA
nuclear@26 585 # define PNG_READ_GAMMA_SUPPORTED
nuclear@26 586 # endif
nuclear@26 587 # ifndef PNG_NO_READ_GRAY_TO_RGB
nuclear@26 588 # define PNG_READ_GRAY_TO_RGB_SUPPORTED
nuclear@26 589 # endif
nuclear@26 590 # ifndef PNG_NO_READ_SWAP_ALPHA
nuclear@26 591 # define PNG_READ_SWAP_ALPHA_SUPPORTED
nuclear@26 592 # endif
nuclear@26 593 # ifndef PNG_NO_READ_INVERT_ALPHA
nuclear@26 594 # define PNG_READ_INVERT_ALPHA_SUPPORTED
nuclear@26 595 # endif
nuclear@26 596 # ifndef PNG_NO_READ_STRIP_ALPHA
nuclear@26 597 # define PNG_READ_STRIP_ALPHA_SUPPORTED
nuclear@26 598 # endif
nuclear@26 599 # ifndef PNG_NO_READ_USER_TRANSFORM
nuclear@26 600 # define PNG_READ_USER_TRANSFORM_SUPPORTED
nuclear@26 601 # endif
nuclear@26 602 # ifndef PNG_NO_READ_RGB_TO_GRAY
nuclear@26 603 # define PNG_READ_RGB_TO_GRAY_SUPPORTED
nuclear@26 604 # endif
nuclear@26 605 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
nuclear@26 606
nuclear@26 607 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
nuclear@26 608 !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */
nuclear@26 609 # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
nuclear@26 610 #endif /* about interlacing capability! You'll */
nuclear@26 611 /* still have interlacing unless you change the following line: */
nuclear@26 612
nuclear@26 613 #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
nuclear@26 614
nuclear@26 615 #ifndef PNG_NO_READ_COMPOSITE_NODIV
nuclear@26 616 # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
nuclear@26 617 # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
nuclear@26 618 # endif
nuclear@26 619 #endif
nuclear@26 620
nuclear@26 621 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
nuclear@26 622 /* Deprecated, will be removed from version 2.0.0.
nuclear@26 623 Use PNG_MNG_FEATURES_SUPPORTED instead. */
nuclear@26 624 #ifndef PNG_NO_READ_EMPTY_PLTE
nuclear@26 625 # define PNG_READ_EMPTY_PLTE_SUPPORTED
nuclear@26 626 #endif
nuclear@26 627 #endif
nuclear@26 628
nuclear@26 629 #endif /* PNG_READ_SUPPORTED */
nuclear@26 630
nuclear@26 631 #if defined(PNG_WRITE_SUPPORTED)
nuclear@26 632
nuclear@26 633 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
nuclear@26 634 !defined(PNG_NO_WRITE_TRANSFORMS)
nuclear@26 635 # define PNG_WRITE_TRANSFORMS_SUPPORTED
nuclear@26 636 #endif
nuclear@26 637
nuclear@26 638 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
nuclear@26 639 # ifndef PNG_NO_WRITE_SHIFT
nuclear@26 640 # define PNG_WRITE_SHIFT_SUPPORTED
nuclear@26 641 # endif
nuclear@26 642 # ifndef PNG_NO_WRITE_PACK
nuclear@26 643 # define PNG_WRITE_PACK_SUPPORTED
nuclear@26 644 # endif
nuclear@26 645 # ifndef PNG_NO_WRITE_BGR
nuclear@26 646 # define PNG_WRITE_BGR_SUPPORTED
nuclear@26 647 # endif
nuclear@26 648 # ifndef PNG_NO_WRITE_SWAP
nuclear@26 649 # define PNG_WRITE_SWAP_SUPPORTED
nuclear@26 650 # endif
nuclear@26 651 # ifndef PNG_NO_WRITE_PACKSWAP
nuclear@26 652 # define PNG_WRITE_PACKSWAP_SUPPORTED
nuclear@26 653 # endif
nuclear@26 654 # ifndef PNG_NO_WRITE_INVERT
nuclear@26 655 # define PNG_WRITE_INVERT_SUPPORTED
nuclear@26 656 # endif
nuclear@26 657 # ifndef PNG_NO_WRITE_FILLER
nuclear@26 658 # define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
nuclear@26 659 # endif
nuclear@26 660 # ifndef PNG_NO_WRITE_SWAP_ALPHA
nuclear@26 661 # define PNG_WRITE_SWAP_ALPHA_SUPPORTED
nuclear@26 662 # endif
nuclear@26 663 # ifndef PNG_NO_WRITE_INVERT_ALPHA
nuclear@26 664 # define PNG_WRITE_INVERT_ALPHA_SUPPORTED
nuclear@26 665 # endif
nuclear@26 666 # ifndef PNG_NO_WRITE_USER_TRANSFORM
nuclear@26 667 # define PNG_WRITE_USER_TRANSFORM_SUPPORTED
nuclear@26 668 # endif
nuclear@26 669 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
nuclear@26 670
nuclear@26 671 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
nuclear@26 672 !defined(PNG_WRITE_INTERLACING_SUPPORTED)
nuclear@26 673 #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
nuclear@26 674 encoders, but can cause trouble
nuclear@26 675 if left undefined */
nuclear@26 676 #endif
nuclear@26 677
nuclear@26 678 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
nuclear@26 679 !defined(PNG_WRITE_WEIGHTED_FILTER) && \
nuclear@26 680 defined(PNG_FLOATING_POINT_SUPPORTED)
nuclear@26 681 # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
nuclear@26 682 #endif
nuclear@26 683
nuclear@26 684 #ifndef PNG_NO_WRITE_FLUSH
nuclear@26 685 # define PNG_WRITE_FLUSH_SUPPORTED
nuclear@26 686 #endif
nuclear@26 687
nuclear@26 688 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
nuclear@26 689 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
nuclear@26 690 #ifndef PNG_NO_WRITE_EMPTY_PLTE
nuclear@26 691 # define PNG_WRITE_EMPTY_PLTE_SUPPORTED
nuclear@26 692 #endif
nuclear@26 693 #endif
nuclear@26 694
nuclear@26 695 #endif /* PNG_WRITE_SUPPORTED */
nuclear@26 696
nuclear@26 697 #ifndef PNG_1_0_X
nuclear@26 698 # ifndef PNG_NO_ERROR_NUMBERS
nuclear@26 699 # define PNG_ERROR_NUMBERS_SUPPORTED
nuclear@26 700 # endif
nuclear@26 701 #endif /* PNG_1_0_X */
nuclear@26 702
nuclear@26 703 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
nuclear@26 704 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
nuclear@26 705 # ifndef PNG_NO_USER_TRANSFORM_PTR
nuclear@26 706 # define PNG_USER_TRANSFORM_PTR_SUPPORTED
nuclear@26 707 # endif
nuclear@26 708 #endif
nuclear@26 709
nuclear@26 710 #ifndef PNG_NO_STDIO
nuclear@26 711 # define PNG_TIME_RFC1123_SUPPORTED
nuclear@26 712 #endif
nuclear@26 713
nuclear@26 714 /* This adds extra functions in pngget.c for accessing data from the
nuclear@26 715 * info pointer (added in version 0.99)
nuclear@26 716 * png_get_image_width()
nuclear@26 717 * png_get_image_height()
nuclear@26 718 * png_get_bit_depth()
nuclear@26 719 * png_get_color_type()
nuclear@26 720 * png_get_compression_type()
nuclear@26 721 * png_get_filter_type()
nuclear@26 722 * png_get_interlace_type()
nuclear@26 723 * png_get_pixel_aspect_ratio()
nuclear@26 724 * png_get_pixels_per_meter()
nuclear@26 725 * png_get_x_offset_pixels()
nuclear@26 726 * png_get_y_offset_pixels()
nuclear@26 727 * png_get_x_offset_microns()
nuclear@26 728 * png_get_y_offset_microns()
nuclear@26 729 */
nuclear@26 730 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
nuclear@26 731 # define PNG_EASY_ACCESS_SUPPORTED
nuclear@26 732 #endif
nuclear@26 733
nuclear@26 734 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
nuclear@26 735 * and removed from version 1.2.20. The following will be removed
nuclear@26 736 * from libpng-1.4.0
nuclear@26 737 */
nuclear@26 738
nuclear@26 739 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
nuclear@26 740 # ifndef PNG_OPTIMIZED_CODE_SUPPORTED
nuclear@26 741 # define PNG_OPTIMIZED_CODE_SUPPORTED
nuclear@26 742 # endif
nuclear@26 743 #endif
nuclear@26 744
nuclear@26 745 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
nuclear@26 746 # ifndef PNG_ASSEMBLER_CODE_SUPPORTED
nuclear@26 747 # define PNG_ASSEMBLER_CODE_SUPPORTED
nuclear@26 748 # endif
nuclear@26 749
nuclear@26 750 # if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
nuclear@26 751 /* work around 64-bit gcc compiler bugs in gcc-3.x */
nuclear@26 752 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
nuclear@26 753 # define PNG_NO_MMX_CODE
nuclear@26 754 # endif
nuclear@26 755 # endif
nuclear@26 756
nuclear@26 757 # if defined(__APPLE__)
nuclear@26 758 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
nuclear@26 759 # define PNG_NO_MMX_CODE
nuclear@26 760 # endif
nuclear@26 761 # endif
nuclear@26 762
nuclear@26 763 # if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
nuclear@26 764 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
nuclear@26 765 # define PNG_NO_MMX_CODE
nuclear@26 766 # endif
nuclear@26 767 # endif
nuclear@26 768
nuclear@26 769 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
nuclear@26 770 # define PNG_MMX_CODE_SUPPORTED
nuclear@26 771 # endif
nuclear@26 772
nuclear@26 773 #endif
nuclear@26 774 /* end of obsolete code to be removed from libpng-1.4.0 */
nuclear@26 775
nuclear@26 776 #if !defined(PNG_1_0_X)
nuclear@26 777 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
nuclear@26 778 # define PNG_USER_MEM_SUPPORTED
nuclear@26 779 #endif
nuclear@26 780 #endif /* PNG_1_0_X */
nuclear@26 781
nuclear@26 782 /* Added at libpng-1.2.6 */
nuclear@26 783 #if !defined(PNG_1_0_X)
nuclear@26 784 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
nuclear@26 785 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
nuclear@26 786 # define PNG_SET_USER_LIMITS_SUPPORTED
nuclear@26 787 #endif
nuclear@26 788 #endif
nuclear@26 789 #endif /* PNG_1_0_X */
nuclear@26 790
nuclear@26 791 /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
nuclear@26 792 * how large, set these limits to 0x7fffffffL
nuclear@26 793 */
nuclear@26 794 #ifndef PNG_USER_WIDTH_MAX
nuclear@26 795 # define PNG_USER_WIDTH_MAX 1000000L
nuclear@26 796 #endif
nuclear@26 797 #ifndef PNG_USER_HEIGHT_MAX
nuclear@26 798 # define PNG_USER_HEIGHT_MAX 1000000L
nuclear@26 799 #endif
nuclear@26 800
nuclear@26 801 /* These are currently experimental features, define them if you want */
nuclear@26 802
nuclear@26 803 /* very little testing */
nuclear@26 804 /*
nuclear@26 805 #ifdef PNG_READ_SUPPORTED
nuclear@26 806 # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
nuclear@26 807 # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
nuclear@26 808 # endif
nuclear@26 809 #endif
nuclear@26 810 */
nuclear@26 811
nuclear@26 812 /* This is only for PowerPC big-endian and 680x0 systems */
nuclear@26 813 /* some testing */
nuclear@26 814 /*
nuclear@26 815 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
nuclear@26 816 # define PNG_READ_BIG_ENDIAN_SUPPORTED
nuclear@26 817 #endif
nuclear@26 818 */
nuclear@26 819
nuclear@26 820 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
nuclear@26 821 /*
nuclear@26 822 #define PNG_NO_POINTER_INDEXING
nuclear@26 823 */
nuclear@26 824
nuclear@26 825 /* These functions are turned off by default, as they will be phased out. */
nuclear@26 826 /*
nuclear@26 827 #define PNG_USELESS_TESTS_SUPPORTED
nuclear@26 828 #define PNG_CORRECT_PALETTE_SUPPORTED
nuclear@26 829 */
nuclear@26 830
nuclear@26 831 /* Any chunks you are not interested in, you can undef here. The
nuclear@26 832 * ones that allocate memory may be expecially important (hIST,
nuclear@26 833 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
nuclear@26 834 * a bit smaller.
nuclear@26 835 */
nuclear@26 836
nuclear@26 837 #if defined(PNG_READ_SUPPORTED) && \
nuclear@26 838 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
nuclear@26 839 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
nuclear@26 840 # define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
nuclear@26 841 #endif
nuclear@26 842
nuclear@26 843 #if defined(PNG_WRITE_SUPPORTED) && \
nuclear@26 844 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
nuclear@26 845 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
nuclear@26 846 # define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
nuclear@26 847 #endif
nuclear@26 848
nuclear@26 849 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
nuclear@26 850
nuclear@26 851 #ifdef PNG_NO_READ_TEXT
nuclear@26 852 # define PNG_NO_READ_iTXt
nuclear@26 853 # define PNG_NO_READ_tEXt
nuclear@26 854 # define PNG_NO_READ_zTXt
nuclear@26 855 #endif
nuclear@26 856 #ifndef PNG_NO_READ_bKGD
nuclear@26 857 # define PNG_READ_bKGD_SUPPORTED
nuclear@26 858 # define PNG_bKGD_SUPPORTED
nuclear@26 859 #endif
nuclear@26 860 #ifndef PNG_NO_READ_cHRM
nuclear@26 861 # define PNG_READ_cHRM_SUPPORTED
nuclear@26 862 # define PNG_cHRM_SUPPORTED
nuclear@26 863 #endif
nuclear@26 864 #ifndef PNG_NO_READ_gAMA
nuclear@26 865 # define PNG_READ_gAMA_SUPPORTED
nuclear@26 866 # define PNG_gAMA_SUPPORTED
nuclear@26 867 #endif
nuclear@26 868 #ifndef PNG_NO_READ_hIST
nuclear@26 869 # define PNG_READ_hIST_SUPPORTED
nuclear@26 870 # define PNG_hIST_SUPPORTED
nuclear@26 871 #endif
nuclear@26 872 #ifndef PNG_NO_READ_iCCP
nuclear@26 873 # define PNG_READ_iCCP_SUPPORTED
nuclear@26 874 # define PNG_iCCP_SUPPORTED
nuclear@26 875 #endif
nuclear@26 876 #ifndef PNG_NO_READ_iTXt
nuclear@26 877 # ifndef PNG_READ_iTXt_SUPPORTED
nuclear@26 878 # define PNG_READ_iTXt_SUPPORTED
nuclear@26 879 # endif
nuclear@26 880 # ifndef PNG_iTXt_SUPPORTED
nuclear@26 881 # define PNG_iTXt_SUPPORTED
nuclear@26 882 # endif
nuclear@26 883 #endif
nuclear@26 884 #ifndef PNG_NO_READ_oFFs
nuclear@26 885 # define PNG_READ_oFFs_SUPPORTED
nuclear@26 886 # define PNG_oFFs_SUPPORTED
nuclear@26 887 #endif
nuclear@26 888 #ifndef PNG_NO_READ_pCAL
nuclear@26 889 # define PNG_READ_pCAL_SUPPORTED
nuclear@26 890 # define PNG_pCAL_SUPPORTED
nuclear@26 891 #endif
nuclear@26 892 #ifndef PNG_NO_READ_sCAL
nuclear@26 893 # define PNG_READ_sCAL_SUPPORTED
nuclear@26 894 # define PNG_sCAL_SUPPORTED
nuclear@26 895 #endif
nuclear@26 896 #ifndef PNG_NO_READ_pHYs
nuclear@26 897 # define PNG_READ_pHYs_SUPPORTED
nuclear@26 898 # define PNG_pHYs_SUPPORTED
nuclear@26 899 #endif
nuclear@26 900 #ifndef PNG_NO_READ_sBIT
nuclear@26 901 # define PNG_READ_sBIT_SUPPORTED
nuclear@26 902 # define PNG_sBIT_SUPPORTED
nuclear@26 903 #endif
nuclear@26 904 #ifndef PNG_NO_READ_sPLT
nuclear@26 905 # define PNG_READ_sPLT_SUPPORTED
nuclear@26 906 # define PNG_sPLT_SUPPORTED
nuclear@26 907 #endif
nuclear@26 908 #ifndef PNG_NO_READ_sRGB
nuclear@26 909 # define PNG_READ_sRGB_SUPPORTED
nuclear@26 910 # define PNG_sRGB_SUPPORTED
nuclear@26 911 #endif
nuclear@26 912 #ifndef PNG_NO_READ_tEXt
nuclear@26 913 # define PNG_READ_tEXt_SUPPORTED
nuclear@26 914 # define PNG_tEXt_SUPPORTED
nuclear@26 915 #endif
nuclear@26 916 #ifndef PNG_NO_READ_tIME
nuclear@26 917 # define PNG_READ_tIME_SUPPORTED
nuclear@26 918 # define PNG_tIME_SUPPORTED
nuclear@26 919 #endif
nuclear@26 920 #ifndef PNG_NO_READ_tRNS
nuclear@26 921 # define PNG_READ_tRNS_SUPPORTED
nuclear@26 922 # define PNG_tRNS_SUPPORTED
nuclear@26 923 #endif
nuclear@26 924 #ifndef PNG_NO_READ_zTXt
nuclear@26 925 # define PNG_READ_zTXt_SUPPORTED
nuclear@26 926 # define PNG_zTXt_SUPPORTED
nuclear@26 927 #endif
nuclear@26 928 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
nuclear@26 929 # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 930 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 931 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 932 # endif
nuclear@26 933 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
nuclear@26 934 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
nuclear@26 935 # endif
nuclear@26 936 #endif
nuclear@26 937 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
nuclear@26 938 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
nuclear@26 939 # define PNG_READ_USER_CHUNKS_SUPPORTED
nuclear@26 940 # define PNG_USER_CHUNKS_SUPPORTED
nuclear@26 941 # ifdef PNG_NO_READ_UNKNOWN_CHUNKS
nuclear@26 942 # undef PNG_NO_READ_UNKNOWN_CHUNKS
nuclear@26 943 # endif
nuclear@26 944 # ifdef PNG_NO_HANDLE_AS_UNKNOWN
nuclear@26 945 # undef PNG_NO_HANDLE_AS_UNKNOWN
nuclear@26 946 # endif
nuclear@26 947 #endif
nuclear@26 948 #ifndef PNG_NO_READ_OPT_PLTE
nuclear@26 949 # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
nuclear@26 950 #endif /* optional PLTE chunk in RGB and RGBA images */
nuclear@26 951 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
nuclear@26 952 defined(PNG_READ_zTXt_SUPPORTED)
nuclear@26 953 # define PNG_READ_TEXT_SUPPORTED
nuclear@26 954 # define PNG_TEXT_SUPPORTED
nuclear@26 955 #endif
nuclear@26 956
nuclear@26 957 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
nuclear@26 958
nuclear@26 959 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
nuclear@26 960
nuclear@26 961 #ifdef PNG_NO_WRITE_TEXT
nuclear@26 962 # define PNG_NO_WRITE_iTXt
nuclear@26 963 # define PNG_NO_WRITE_tEXt
nuclear@26 964 # define PNG_NO_WRITE_zTXt
nuclear@26 965 #endif
nuclear@26 966 #ifndef PNG_NO_WRITE_bKGD
nuclear@26 967 # define PNG_WRITE_bKGD_SUPPORTED
nuclear@26 968 # ifndef PNG_bKGD_SUPPORTED
nuclear@26 969 # define PNG_bKGD_SUPPORTED
nuclear@26 970 # endif
nuclear@26 971 #endif
nuclear@26 972 #ifndef PNG_NO_WRITE_cHRM
nuclear@26 973 # define PNG_WRITE_cHRM_SUPPORTED
nuclear@26 974 # ifndef PNG_cHRM_SUPPORTED
nuclear@26 975 # define PNG_cHRM_SUPPORTED
nuclear@26 976 # endif
nuclear@26 977 #endif
nuclear@26 978 #ifndef PNG_NO_WRITE_gAMA
nuclear@26 979 # define PNG_WRITE_gAMA_SUPPORTED
nuclear@26 980 # ifndef PNG_gAMA_SUPPORTED
nuclear@26 981 # define PNG_gAMA_SUPPORTED
nuclear@26 982 # endif
nuclear@26 983 #endif
nuclear@26 984 #ifndef PNG_NO_WRITE_hIST
nuclear@26 985 # define PNG_WRITE_hIST_SUPPORTED
nuclear@26 986 # ifndef PNG_hIST_SUPPORTED
nuclear@26 987 # define PNG_hIST_SUPPORTED
nuclear@26 988 # endif
nuclear@26 989 #endif
nuclear@26 990 #ifndef PNG_NO_WRITE_iCCP
nuclear@26 991 # define PNG_WRITE_iCCP_SUPPORTED
nuclear@26 992 # ifndef PNG_iCCP_SUPPORTED
nuclear@26 993 # define PNG_iCCP_SUPPORTED
nuclear@26 994 # endif
nuclear@26 995 #endif
nuclear@26 996 #ifndef PNG_NO_WRITE_iTXt
nuclear@26 997 # ifndef PNG_WRITE_iTXt_SUPPORTED
nuclear@26 998 # define PNG_WRITE_iTXt_SUPPORTED
nuclear@26 999 # endif
nuclear@26 1000 # ifndef PNG_iTXt_SUPPORTED
nuclear@26 1001 # define PNG_iTXt_SUPPORTED
nuclear@26 1002 # endif
nuclear@26 1003 #endif
nuclear@26 1004 #ifndef PNG_NO_WRITE_oFFs
nuclear@26 1005 # define PNG_WRITE_oFFs_SUPPORTED
nuclear@26 1006 # ifndef PNG_oFFs_SUPPORTED
nuclear@26 1007 # define PNG_oFFs_SUPPORTED
nuclear@26 1008 # endif
nuclear@26 1009 #endif
nuclear@26 1010 #ifndef PNG_NO_WRITE_pCAL
nuclear@26 1011 # define PNG_WRITE_pCAL_SUPPORTED
nuclear@26 1012 # ifndef PNG_pCAL_SUPPORTED
nuclear@26 1013 # define PNG_pCAL_SUPPORTED
nuclear@26 1014 # endif
nuclear@26 1015 #endif
nuclear@26 1016 #ifndef PNG_NO_WRITE_sCAL
nuclear@26 1017 # define PNG_WRITE_sCAL_SUPPORTED
nuclear@26 1018 # ifndef PNG_sCAL_SUPPORTED
nuclear@26 1019 # define PNG_sCAL_SUPPORTED
nuclear@26 1020 # endif
nuclear@26 1021 #endif
nuclear@26 1022 #ifndef PNG_NO_WRITE_pHYs
nuclear@26 1023 # define PNG_WRITE_pHYs_SUPPORTED
nuclear@26 1024 # ifndef PNG_pHYs_SUPPORTED
nuclear@26 1025 # define PNG_pHYs_SUPPORTED
nuclear@26 1026 # endif
nuclear@26 1027 #endif
nuclear@26 1028 #ifndef PNG_NO_WRITE_sBIT
nuclear@26 1029 # define PNG_WRITE_sBIT_SUPPORTED
nuclear@26 1030 # ifndef PNG_sBIT_SUPPORTED
nuclear@26 1031 # define PNG_sBIT_SUPPORTED
nuclear@26 1032 # endif
nuclear@26 1033 #endif
nuclear@26 1034 #ifndef PNG_NO_WRITE_sPLT
nuclear@26 1035 # define PNG_WRITE_sPLT_SUPPORTED
nuclear@26 1036 # ifndef PNG_sPLT_SUPPORTED
nuclear@26 1037 # define PNG_sPLT_SUPPORTED
nuclear@26 1038 # endif
nuclear@26 1039 #endif
nuclear@26 1040 #ifndef PNG_NO_WRITE_sRGB
nuclear@26 1041 # define PNG_WRITE_sRGB_SUPPORTED
nuclear@26 1042 # ifndef PNG_sRGB_SUPPORTED
nuclear@26 1043 # define PNG_sRGB_SUPPORTED
nuclear@26 1044 # endif
nuclear@26 1045 #endif
nuclear@26 1046 #ifndef PNG_NO_WRITE_tEXt
nuclear@26 1047 # define PNG_WRITE_tEXt_SUPPORTED
nuclear@26 1048 # ifndef PNG_tEXt_SUPPORTED
nuclear@26 1049 # define PNG_tEXt_SUPPORTED
nuclear@26 1050 # endif
nuclear@26 1051 #endif
nuclear@26 1052 #ifndef PNG_NO_WRITE_tIME
nuclear@26 1053 # define PNG_WRITE_tIME_SUPPORTED
nuclear@26 1054 # ifndef PNG_tIME_SUPPORTED
nuclear@26 1055 # define PNG_tIME_SUPPORTED
nuclear@26 1056 # endif
nuclear@26 1057 #endif
nuclear@26 1058 #ifndef PNG_NO_WRITE_tRNS
nuclear@26 1059 # define PNG_WRITE_tRNS_SUPPORTED
nuclear@26 1060 # ifndef PNG_tRNS_SUPPORTED
nuclear@26 1061 # define PNG_tRNS_SUPPORTED
nuclear@26 1062 # endif
nuclear@26 1063 #endif
nuclear@26 1064 #ifndef PNG_NO_WRITE_zTXt
nuclear@26 1065 # define PNG_WRITE_zTXt_SUPPORTED
nuclear@26 1066 # ifndef PNG_zTXt_SUPPORTED
nuclear@26 1067 # define PNG_zTXt_SUPPORTED
nuclear@26 1068 # endif
nuclear@26 1069 #endif
nuclear@26 1070 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
nuclear@26 1071 # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 1072 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 1073 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
nuclear@26 1074 # endif
nuclear@26 1075 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
nuclear@26 1076 # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
nuclear@26 1077 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
nuclear@26 1078 # endif
nuclear@26 1079 # endif
nuclear@26 1080 #endif
nuclear@26 1081 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
nuclear@26 1082 defined(PNG_WRITE_zTXt_SUPPORTED)
nuclear@26 1083 # define PNG_WRITE_TEXT_SUPPORTED
nuclear@26 1084 # ifndef PNG_TEXT_SUPPORTED
nuclear@26 1085 # define PNG_TEXT_SUPPORTED
nuclear@26 1086 # endif
nuclear@26 1087 #endif
nuclear@26 1088
nuclear@26 1089 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
nuclear@26 1090
nuclear@26 1091 /* Turn this off to disable png_read_png() and
nuclear@26 1092 * png_write_png() and leave the row_pointers member
nuclear@26 1093 * out of the info structure.
nuclear@26 1094 */
nuclear@26 1095 #ifndef PNG_NO_INFO_IMAGE
nuclear@26 1096 # define PNG_INFO_IMAGE_SUPPORTED
nuclear@26 1097 #endif
nuclear@26 1098
nuclear@26 1099 /* need the time information for reading tIME chunks */
nuclear@26 1100 #if defined(PNG_tIME_SUPPORTED)
nuclear@26 1101 # if !defined(_WIN32_WCE)
nuclear@26 1102 /* "time.h" functions are not supported on WindowsCE */
nuclear@26 1103 # include <time.h>
nuclear@26 1104 # endif
nuclear@26 1105 #endif
nuclear@26 1106
nuclear@26 1107 /* Some typedefs to get us started. These should be safe on most of the
nuclear@26 1108 * common platforms. The typedefs should be at least as large as the
nuclear@26 1109 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
nuclear@26 1110 * don't have to be exactly that size. Some compilers dislike passing
nuclear@26 1111 * unsigned shorts as function parameters, so you may be better off using
nuclear@26 1112 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
nuclear@26 1113 * want to have unsigned int for png_uint_32 instead of unsigned long.
nuclear@26 1114 */
nuclear@26 1115
nuclear@26 1116 typedef unsigned long png_uint_32;
nuclear@26 1117 typedef long png_int_32;
nuclear@26 1118 typedef unsigned short png_uint_16;
nuclear@26 1119 typedef short png_int_16;
nuclear@26 1120 typedef unsigned char png_byte;
nuclear@26 1121
nuclear@26 1122 /* This is usually size_t. It is typedef'ed just in case you need it to
nuclear@26 1123 change (I'm not sure if you will or not, so I thought I'd be safe) */
nuclear@26 1124 #ifdef PNG_SIZE_T
nuclear@26 1125 typedef PNG_SIZE_T png_size_t;
nuclear@26 1126 # define png_sizeof(x) png_convert_size(sizeof(x))
nuclear@26 1127 #else
nuclear@26 1128 typedef size_t png_size_t;
nuclear@26 1129 # define png_sizeof(x) sizeof(x)
nuclear@26 1130 #endif
nuclear@26 1131
nuclear@26 1132 /* The following is needed for medium model support. It cannot be in the
nuclear@26 1133 * PNG_INTERNAL section. Needs modification for other compilers besides
nuclear@26 1134 * MSC. Model independent support declares all arrays and pointers to be
nuclear@26 1135 * large using the far keyword. The zlib version used must also support
nuclear@26 1136 * model independent data. As of version zlib 1.0.4, the necessary changes
nuclear@26 1137 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
nuclear@26 1138 * changes that are needed. (Tim Wegner)
nuclear@26 1139 */
nuclear@26 1140
nuclear@26 1141 /* Separate compiler dependencies (problem here is that zlib.h always
nuclear@26 1142 defines FAR. (SJT) */
nuclear@26 1143 #ifdef __BORLANDC__
nuclear@26 1144 # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
nuclear@26 1145 # define LDATA 1
nuclear@26 1146 # else
nuclear@26 1147 # define LDATA 0
nuclear@26 1148 # endif
nuclear@26 1149 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
nuclear@26 1150 # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
nuclear@26 1151 # define PNG_MAX_MALLOC_64K
nuclear@26 1152 # if (LDATA != 1)
nuclear@26 1153 # ifndef FAR
nuclear@26 1154 # define FAR __far
nuclear@26 1155 # endif
nuclear@26 1156 # define USE_FAR_KEYWORD
nuclear@26 1157 # endif /* LDATA != 1 */
nuclear@26 1158 /* Possibly useful for moving data out of default segment.
nuclear@26 1159 * Uncomment it if you want. Could also define FARDATA as
nuclear@26 1160 * const if your compiler supports it. (SJT)
nuclear@26 1161 # define FARDATA FAR
nuclear@26 1162 */
nuclear@26 1163 # endif /* __WIN32__, __FLAT__, __CYGWIN__ */
nuclear@26 1164 #endif /* __BORLANDC__ */
nuclear@26 1165
nuclear@26 1166
nuclear@26 1167 /* Suggest testing for specific compiler first before testing for
nuclear@26 1168 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
nuclear@26 1169 * making reliance oncertain keywords suspect. (SJT)
nuclear@26 1170 */
nuclear@26 1171
nuclear@26 1172 /* MSC Medium model */
nuclear@26 1173 #if defined(FAR)
nuclear@26 1174 # if defined(M_I86MM)
nuclear@26 1175 # define USE_FAR_KEYWORD
nuclear@26 1176 # define FARDATA FAR
nuclear@26 1177 # include <dos.h>
nuclear@26 1178 # endif
nuclear@26 1179 #endif
nuclear@26 1180
nuclear@26 1181 /* SJT: default case */
nuclear@26 1182 #ifndef FAR
nuclear@26 1183 # define FAR
nuclear@26 1184 #endif
nuclear@26 1185
nuclear@26 1186 /* At this point FAR is always defined */
nuclear@26 1187 #ifndef FARDATA
nuclear@26 1188 # define FARDATA
nuclear@26 1189 #endif
nuclear@26 1190
nuclear@26 1191 /* Typedef for floating-point numbers that are converted
nuclear@26 1192 to fixed-point with a multiple of 100,000, e.g., int_gamma */
nuclear@26 1193 typedef png_int_32 png_fixed_point;
nuclear@26 1194
nuclear@26 1195 /* Add typedefs for pointers */
nuclear@26 1196 typedef void FAR * png_voidp;
nuclear@26 1197 typedef png_byte FAR * png_bytep;
nuclear@26 1198 typedef png_uint_32 FAR * png_uint_32p;
nuclear@26 1199 typedef png_int_32 FAR * png_int_32p;
nuclear@26 1200 typedef png_uint_16 FAR * png_uint_16p;
nuclear@26 1201 typedef png_int_16 FAR * png_int_16p;
nuclear@26 1202 typedef PNG_CONST char FAR * png_const_charp;
nuclear@26 1203 typedef char FAR * png_charp;
nuclear@26 1204 typedef png_fixed_point FAR * png_fixed_point_p;
nuclear@26 1205
nuclear@26 1206 #ifndef PNG_NO_STDIO
nuclear@26 1207 #if defined(_WIN32_WCE)
nuclear@26 1208 typedef HANDLE png_FILE_p;
nuclear@26 1209 #else
nuclear@26 1210 typedef FILE * png_FILE_p;
nuclear@26 1211 #endif
nuclear@26 1212 #endif
nuclear@26 1213
nuclear@26 1214 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@26 1215 typedef double FAR * png_doublep;
nuclear@26 1216 #endif
nuclear@26 1217
nuclear@26 1218 /* Pointers to pointers; i.e. arrays */
nuclear@26 1219 typedef png_byte FAR * FAR * png_bytepp;
nuclear@26 1220 typedef png_uint_32 FAR * FAR * png_uint_32pp;
nuclear@26 1221 typedef png_int_32 FAR * FAR * png_int_32pp;
nuclear@26 1222 typedef png_uint_16 FAR * FAR * png_uint_16pp;
nuclear@26 1223 typedef png_int_16 FAR * FAR * png_int_16pp;
nuclear@26 1224 typedef PNG_CONST char FAR * FAR * png_const_charpp;
nuclear@26 1225 typedef char FAR * FAR * png_charpp;
nuclear@26 1226 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
nuclear@26 1227 #ifdef PNG_FLOATING_POINT_SUPPORTED
nuclear@26 1228 typedef double FAR * FAR * png_doublepp;
nuclear@26 1229 #endif
nuclear@26 1230
nuclear@26 1231 /* Pointers to pointers to pointers; i.e., pointer to array */
nuclear@26 1232 typedef char FAR * FAR * FAR * png_charppp;
nuclear@26 1233
nuclear@26 1234 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
nuclear@26 1235 /* SPC - Is this stuff deprecated? */
nuclear@26 1236 /* It'll be removed as of libpng-1.3.0 - GR-P */
nuclear@26 1237 /* libpng typedefs for types in zlib. If zlib changes
nuclear@26 1238 * or another compression library is used, then change these.
nuclear@26 1239 * Eliminates need to change all the source files.
nuclear@26 1240 */
nuclear@26 1241 typedef charf * png_zcharp;
nuclear@26 1242 typedef charf * FAR * png_zcharpp;
nuclear@26 1243 typedef z_stream FAR * png_zstreamp;
nuclear@26 1244 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
nuclear@26 1245
nuclear@26 1246 /*
nuclear@26 1247 * Define PNG_BUILD_DLL if the module being built is a Windows
nuclear@26 1248 * LIBPNG DLL.
nuclear@26 1249 *
nuclear@26 1250 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
nuclear@26 1251 * It is equivalent to Microsoft predefined macro _DLL that is
nuclear@26 1252 * automatically defined when you compile using the share
nuclear@26 1253 * version of the CRT (C Run-Time library)
nuclear@26 1254 *
nuclear@26 1255 * The cygwin mods make this behavior a little different:
nuclear@26 1256 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
nuclear@26 1257 * Define PNG_STATIC if you are building a static library for use with cygwin,
nuclear@26 1258 * -or- if you are building an application that you want to link to the
nuclear@26 1259 * static library.
nuclear@26 1260 * PNG_USE_DLL is defined by default (no user action needed) unless one of
nuclear@26 1261 * the other flags is defined.
nuclear@26 1262 */
nuclear@26 1263
nuclear@26 1264 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
nuclear@26 1265 # define PNG_DLL
nuclear@26 1266 #endif
nuclear@26 1267 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
nuclear@26 1268 * When building a static lib, default to no GLOBAL ARRAYS, but allow
nuclear@26 1269 * command-line override
nuclear@26 1270 */
nuclear@26 1271 #if defined(__CYGWIN__)
nuclear@26 1272 # if !defined(PNG_STATIC)
nuclear@26 1273 # if defined(PNG_USE_GLOBAL_ARRAYS)
nuclear@26 1274 # undef PNG_USE_GLOBAL_ARRAYS
nuclear@26 1275 # endif
nuclear@26 1276 # if !defined(PNG_USE_LOCAL_ARRAYS)
nuclear@26 1277 # define PNG_USE_LOCAL_ARRAYS
nuclear@26 1278 # endif
nuclear@26 1279 # else
nuclear@26 1280 # if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
nuclear@26 1281 # if defined(PNG_USE_GLOBAL_ARRAYS)
nuclear@26 1282 # undef PNG_USE_GLOBAL_ARRAYS
nuclear@26 1283 # endif
nuclear@26 1284 # endif
nuclear@26 1285 # endif
nuclear@26 1286 # if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
nuclear@26 1287 # define PNG_USE_LOCAL_ARRAYS
nuclear@26 1288 # endif
nuclear@26 1289 #endif
nuclear@26 1290
nuclear@26 1291 /* Do not use global arrays (helps with building DLL's)
nuclear@26 1292 * They are no longer used in libpng itself, since version 1.0.5c,
nuclear@26 1293 * but might be required for some pre-1.0.5c applications.
nuclear@26 1294 */
nuclear@26 1295 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
nuclear@26 1296 # if defined(PNG_NO_GLOBAL_ARRAYS) || \
nuclear@26 1297 (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
nuclear@26 1298 # define PNG_USE_LOCAL_ARRAYS
nuclear@26 1299 # else
nuclear@26 1300 # define PNG_USE_GLOBAL_ARRAYS
nuclear@26 1301 # endif
nuclear@26 1302 #endif
nuclear@26 1303
nuclear@26 1304 #if defined(__CYGWIN__)
nuclear@26 1305 # undef PNGAPI
nuclear@26 1306 # define PNGAPI __cdecl
nuclear@26 1307 # undef PNG_IMPEXP
nuclear@26 1308 # define PNG_IMPEXP
nuclear@26 1309 #endif
nuclear@26 1310
nuclear@26 1311 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
nuclear@26 1312 * you may get warnings regarding the linkage of png_zalloc and png_zfree.
nuclear@26 1313 * Don't ignore those warnings; you must also reset the default calling
nuclear@26 1314 * convention in your compiler to match your PNGAPI, and you must build
nuclear@26 1315 * zlib and your applications the same way you build libpng.
nuclear@26 1316 */
nuclear@26 1317
nuclear@26 1318 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
nuclear@26 1319 # ifndef PNG_NO_MODULEDEF
nuclear@26 1320 # define PNG_NO_MODULEDEF
nuclear@26 1321 # endif
nuclear@26 1322 #endif
nuclear@26 1323
nuclear@26 1324 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
nuclear@26 1325 # define PNG_IMPEXP
nuclear@26 1326 #endif
nuclear@26 1327
nuclear@26 1328 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
nuclear@26 1329 (( defined(_Windows) || defined(_WINDOWS) || \
nuclear@26 1330 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
nuclear@26 1331
nuclear@26 1332 # ifndef PNGAPI
nuclear@26 1333 # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
nuclear@26 1334 # define PNGAPI __cdecl
nuclear@26 1335 # else
nuclear@26 1336 # define PNGAPI _cdecl
nuclear@26 1337 # endif
nuclear@26 1338 # endif
nuclear@26 1339
nuclear@26 1340 # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
nuclear@26 1341 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
nuclear@26 1342 # define PNG_IMPEXP
nuclear@26 1343 # endif
nuclear@26 1344
nuclear@26 1345 # if !defined(PNG_IMPEXP)
nuclear@26 1346
nuclear@26 1347 # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
nuclear@26 1348 # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
nuclear@26 1349
nuclear@26 1350 /* Borland/Microsoft */
nuclear@26 1351 # if defined(_MSC_VER) || defined(__BORLANDC__)
nuclear@26 1352 # if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
nuclear@26 1353 # define PNG_EXPORT PNG_EXPORT_TYPE1
nuclear@26 1354 # else
nuclear@26 1355 # define PNG_EXPORT PNG_EXPORT_TYPE2
nuclear@26 1356 # if defined(PNG_BUILD_DLL)
nuclear@26 1357 # define PNG_IMPEXP __export
nuclear@26 1358 # else
nuclear@26 1359 # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
nuclear@26 1360 VC++ */
nuclear@26 1361 # endif /* Exists in Borland C++ for
nuclear@26 1362 C++ classes (== huge) */
nuclear@26 1363 # endif
nuclear@26 1364 # endif
nuclear@26 1365
nuclear@26 1366 # if !defined(PNG_IMPEXP)
nuclear@26 1367 # if defined(PNG_BUILD_DLL)
nuclear@26 1368 # define PNG_IMPEXP __declspec(dllexport)
nuclear@26 1369 # else
nuclear@26 1370 # define PNG_IMPEXP __declspec(dllimport)
nuclear@26 1371 # endif
nuclear@26 1372 # endif
nuclear@26 1373 # endif /* PNG_IMPEXP */
nuclear@26 1374 #else /* !(DLL || non-cygwin WINDOWS) */
nuclear@26 1375 # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
nuclear@26 1376 # ifndef PNGAPI
nuclear@26 1377 # define PNGAPI _System
nuclear@26 1378 # endif
nuclear@26 1379 # else
nuclear@26 1380 # if 0 /* ... other platforms, with other meanings */
nuclear@26 1381 # endif
nuclear@26 1382 # endif
nuclear@26 1383 #endif
nuclear@26 1384
nuclear@26 1385 #ifndef PNGAPI
nuclear@26 1386 # define PNGAPI
nuclear@26 1387 #endif
nuclear@26 1388 #ifndef PNG_IMPEXP
nuclear@26 1389 # define PNG_IMPEXP
nuclear@26 1390 #endif
nuclear@26 1391
nuclear@26 1392 #ifdef PNG_BUILDSYMS
nuclear@26 1393 # ifndef PNG_EXPORT
nuclear@26 1394 # define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
nuclear@26 1395 # endif
nuclear@26 1396 # ifdef PNG_USE_GLOBAL_ARRAYS
nuclear@26 1397 # ifndef PNG_EXPORT_VAR
nuclear@26 1398 # define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
nuclear@26 1399 # endif
nuclear@26 1400 # endif
nuclear@26 1401 #endif
nuclear@26 1402
nuclear@26 1403 #ifndef PNG_EXPORT
nuclear@26 1404 # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
nuclear@26 1405 #endif
nuclear@26 1406
nuclear@26 1407 #ifdef PNG_USE_GLOBAL_ARRAYS
nuclear@26 1408 # ifndef PNG_EXPORT_VAR
nuclear@26 1409 # define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
nuclear@26 1410 # endif
nuclear@26 1411 #endif
nuclear@26 1412
nuclear@26 1413 /* User may want to use these so they are not in PNG_INTERNAL. Any library
nuclear@26 1414 * functions that are passed far data must be model independent.
nuclear@26 1415 */
nuclear@26 1416
nuclear@26 1417 #ifndef PNG_ABORT
nuclear@26 1418 # define PNG_ABORT() abort()
nuclear@26 1419 #endif
nuclear@26 1420
nuclear@26 1421 #ifdef PNG_SETJMP_SUPPORTED
nuclear@26 1422 # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
nuclear@26 1423 #else
nuclear@26 1424 # define png_jmpbuf(png_ptr) \
nuclear@26 1425 (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
nuclear@26 1426 #endif
nuclear@26 1427
nuclear@26 1428 #if defined(USE_FAR_KEYWORD) /* memory model independent fns */
nuclear@26 1429 /* use this to make far-to-near assignments */
nuclear@26 1430 # define CHECK 1
nuclear@26 1431 # define NOCHECK 0
nuclear@26 1432 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
nuclear@26 1433 # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
nuclear@26 1434 # define png_snprintf _fsnprintf /* Added to v 1.2.19 */
nuclear@26 1435 # define png_strlen _fstrlen
nuclear@26 1436 # define png_memcmp _fmemcmp /* SJT: added */
nuclear@26 1437 # define png_memcpy _fmemcpy
nuclear@26 1438 # define png_memset _fmemset
nuclear@26 1439 #else /* use the usual functions */
nuclear@26 1440 # define CVT_PTR(ptr) (ptr)
nuclear@26 1441 # define CVT_PTR_NOCHECK(ptr) (ptr)
nuclear@26 1442 # ifndef PNG_NO_SNPRINTF
nuclear@26 1443 # ifdef _MSC_VER
nuclear@26 1444 # define png_snprintf _snprintf /* Added to v 1.2.19 */
nuclear@26 1445 # define png_snprintf2 _snprintf
nuclear@26 1446 # define png_snprintf6 _snprintf
nuclear@26 1447 # else
nuclear@26 1448 # define png_snprintf snprintf /* Added to v 1.2.19 */
nuclear@26 1449 # define png_snprintf2 snprintf
nuclear@26 1450 # define png_snprintf6 snprintf
nuclear@26 1451 # endif
nuclear@26 1452 # else
nuclear@26 1453 /* You don't have or don't want to use snprintf(). Caution: Using
nuclear@26 1454 * sprintf instead of snprintf exposes your application to accidental
nuclear@26 1455 * or malevolent buffer overflows. If you don't have snprintf()
nuclear@26 1456 * as a general rule you should provide one (you can get one from
nuclear@26 1457 * Portable OpenSSH). */
nuclear@26 1458 # define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
nuclear@26 1459 # define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
nuclear@26 1460 # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
nuclear@26 1461 sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
nuclear@26 1462 # endif
nuclear@26 1463 # define png_strlen strlen
nuclear@26 1464 # define png_memcmp memcmp /* SJT: added */
nuclear@26 1465 # define png_memcpy memcpy
nuclear@26 1466 # define png_memset memset
nuclear@26 1467 #endif
nuclear@26 1468 /* End of memory model independent support */
nuclear@26 1469
nuclear@26 1470 /* Just a little check that someone hasn't tried to define something
nuclear@26 1471 * contradictory.
nuclear@26 1472 */
nuclear@26 1473 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
nuclear@26 1474 # undef PNG_ZBUF_SIZE
nuclear@26 1475 # define PNG_ZBUF_SIZE 65536L
nuclear@26 1476 #endif
nuclear@26 1477
nuclear@26 1478 /* Added at libpng-1.2.8 */
nuclear@26 1479 #endif /* PNG_VERSION_INFO_ONLY */
nuclear@26 1480
nuclear@26 1481 #endif /* PNGCONF_H */