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