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