1 /* pngconf.h - machine configurable file for libpng
3 * libpng 1.0.10 - March 30, 2001
4 * For conditions of distribution and use, see copyright notice in png.h
5 * Copyright (c) 1998-2001 Glenn Randers-Pehrson
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
10 /* Any machine specific code is near the front of this file, so if you
11 * are configuring libpng for a machine, you may want to read the section
12 * starting here down to where it starts to typedef png_color, png_text,
19 /* This is the size of the compression buffer, and thus the size of
20 * an IDAT chunk. Make this whatever size you feel is best for your
21 * machine. One of these will be allocated per png_struct. When this
22 * is full, it writes the data to the disk, and does some other
23 * calculations. Making this an extremely small size will slow
24 * the library down, but you may want to experiment to determine
25 * where it becomes significant, if you are concerned with memory
26 * usage. Note that zlib allocates at least 32Kb also. For readers,
27 * this describes the size of the buffer available to read the data in.
28 * Unless this gets smaller than the size of a row (compressed),
29 * it should not make much difference how big this is.
33 # define PNG_ZBUF_SIZE 8192
36 /* Enable if you want a write-only libpng */
38 #ifndef PNG_NO_READ_SUPPORTED
39 # define PNG_READ_SUPPORTED
42 /* Enable if you want a read-only libpng */
44 #ifndef PNG_NO_WRITE_SUPPORTED
45 # define PNG_WRITE_SUPPORTED
48 /* Enable if you need to support PNGs that are embedded in MNG
51 #ifndef PNG_NO_MNG_FEATURES
52 # ifndef PNG_MNG_FEATURES_SUPPORTED
53 # define PNG_MNG_FEATURES_SUPPORTED
58 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
59 # ifndef PNG_FLOATING_POINT_SUPPORTED
60 # define PNG_FLOATING_POINT_SUPPORTED
64 /* If you are running on a machine where you cannot allocate more
65 * than 64K of memory at once, uncomment this. While libpng will not
66 * normally need that much memory in a chunk (unless you load up a very
67 * large file), zlib needs to know how big of a chunk it can use, and
68 * libpng thus makes sure to check any memory allocation to verify it
69 * will fit into memory.
70 #define PNG_MAX_MALLOC_64K
72 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
73 # define PNG_MAX_MALLOC_64K
76 /* Special munging to support doing things the 'cygwin' way:
77 * 'Normal' png-on-win32 defines/defaults:
78 * PNG_BUILD_DLL -- building dll
79 * PNG_USE_DLL -- building an application, linking to dll
80 * (no define) -- building static library, or building an
81 * application and linking to the static lib
82 * 'Cygwin' defines/defaults:
83 * PNG_BUILD_DLL -- building the dll
84 * (no define) -- building an application, linking to the dll
85 * PNG_STATIC -- building the static lib, or building an application
86 * that links to the static lib.
87 * ALL_STATIC -- building various static libs, or building an application
88 * that links to the static libs.
90 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
91 * this bit of #ifdefs will define the 'correct' config variables based on
92 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
95 #if defined(__CYGWIN__)
96 # if defined(PNG_BUILD_DLL)
97 # if defined(PNG_USE_DLL)
100 # if !defined(PNG_DLL)
103 # if defined(PNG_STATIC)
107 # if defined(ALL_STATIC)
110 # if defined(PNG_STATIC)
111 # if defined(PNG_USE_DLL)
114 # if defined(PNG_DLL)
118 # if defined(PNG_USE_DLL)
119 # if !defined(PNG_DLL)
123 # if defined(PNG_DLL)
135 /* This protects us against compilers that run on a windowing system
136 * and thus don't have or would rather us not use the stdio types:
137 * stdin, stdout, and stderr. The only one currently used is stderr
138 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
139 * prevent these from being compiled and used. #defining PNG_NO_STDIO
140 * will also prevent these, plus will prevent the entire set of stdio
141 * macros and functions (FILE *, printf, etc.) from being compiled and used,
142 * unless (PNG_DEBUG > 0) has been #defined.
144 * #define PNG_NO_CONSOLE_IO
145 * #define PNG_NO_STDIO
148 #if defined(_WIN32_WCE)
149 # include <windows.h>
150 /* Console I/O functions are not supported on WindowsCE */
151 # define PNG_NO_CONSOLE_IO
158 # ifndef PNG_CONSOLE_IO_SUPPORTED
159 # ifndef PNG_NO_CONSOLE_IO
160 # define PNG_NO_CONSOLE_IO
166 # ifndef PNG_NO_CONSOLE_IO
167 # define PNG_NO_CONSOLE_IO
175 # if !defined(_WIN32_WCE)
176 /* "stdio.h" functions are not supported on WindowsCE */
181 /* This macro protects us against machines that don't have function
182 * prototypes (ie K&R style headers). If your compiler does not handle
183 * function prototypes, define this macro and use the included ansi2knr.
184 * I've always been able to use _NO_PROTO as the indicator, but you may
185 * need to drag the empty declaration out in front of here, or change the
186 * ifdef to suit your own needs.
190 #ifdef OF /* zlib prototype munger */
191 # define PNGARG(arglist) OF(arglist)
195 # define PNGARG(arglist) ()
197 # define PNGARG(arglist) arglist
198 #endif /* _NO_PROTO */
204 /* Try to determine if we are compiling on a Mac. Note that testing for
205 * just __MWERKS__ is not good enough, because the Codewarrior is now used
206 * on non-Mac platforms.
209 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
210 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
215 /* enough people need this for various reasons to include it here */
216 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
217 # include <sys/types.h>
220 #ifndef PNG_SETJMP_NOT_SUPPORTED
221 # define PNG_SETJMP_SUPPORTED
224 #ifdef PNG_SETJMP_SUPPORTED
225 /* This is an attempt to force a single setjmp behaviour on Linux. If
226 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
231 # define PNG_SAVE_BSD_SOURCE
235 __png
.h__ already includes setjmp
.h
;
236 __dont__ include it again
.;
238 # endif /* __linux__ */
240 /* include setjmp.h for error handling */
244 # ifdef PNG_SAVE_BSD_SOURCE
246 # undef PNG_SAVE_BSD_SOURCE
248 # endif /* __linux__ */
249 #endif /* PNG_SETJMP_SUPPORTED */
251 #if defined(_AIX) && defined(__xlC__)
252 /* This prevents "AIX/xlC" from generating an "index(s,c)" macro in strings.h
253 * that conflicts with libpng's png_color_16.index */
258 # include <strings.h>
263 /* Other defines for things like memory and the like can go here. */
268 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
269 * aren't usually used outside the library (as far as I know), so it is
270 * debatable if they should be exported at all. In the future, when it is
271 * possible to have run-time registry of chunk-handling functions, some of
272 * these will be made available again.
273 #define PNG_EXTERN extern
277 /* Other defines specific to compilers can go here. Try to keep
278 * them inside an appropriate ifdef/endif pair for portability.
281 #if defined(PNG_FLOATING_POINT_SUPPORTED)
283 /* We need to check that <math.h> hasn't already been included earlier
284 * as it seems it doesn't agree with <fp.h>, yet we should really use
285 * <fp.h> if possible.
287 # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
293 # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
294 /* Amiga SAS/C: We must include builtin FPU functions when compiling using
301 /* Codewarrior on NT has linking problems without this. */
302 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
303 # define PNG_ALWAYS_EXTERN
306 /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
307 * stdlib.h like it should (I think). Or perhaps this is a C++
319 /* This controls how fine the dithering gets. As this allocates
320 * a largish chunk of memory (32K), those who are not as concerned
321 * with dithering quality can decrease some or all of these.
323 #ifndef PNG_DITHER_RED_BITS
324 # define PNG_DITHER_RED_BITS 5
326 #ifndef PNG_DITHER_GREEN_BITS
327 # define PNG_DITHER_GREEN_BITS 5
329 #ifndef PNG_DITHER_BLUE_BITS
330 # define PNG_DITHER_BLUE_BITS 5
333 /* This controls how fine the gamma correction becomes when you
334 * are only interested in 8 bits anyway. Increasing this value
335 * results in more memory being used, and more pow() functions
336 * being called to fill in the gamma tables. Don't set this value
337 * less then 8, and even that may not work (I haven't tested it).
340 #ifndef PNG_MAX_GAMMA_8
341 # define PNG_MAX_GAMMA_8 11
344 /* This controls how much a difference in gamma we can tolerate before
345 * we actually start doing gamma conversion.
347 #ifndef PNG_GAMMA_THRESHOLD
348 # define PNG_GAMMA_THRESHOLD 0.05
351 #endif /* PNG_INTERNAL */
353 /* The following uses const char * instead of char * for error
354 * and warning message functions, so some compilers won't complain.
355 * If you do not want to use const, define PNG_NO_CONST here.
359 # define PNG_CONST const
364 /* The following defines give you the ability to remove code from the
365 * library that you will not be using. I wish I could figure out how to
366 * automate this, but I can't do that without making it seriously hard
367 * on the users. So if you are not using an ability, change the #define
368 * to and #undef, and that part of the library will not be compiled. If
369 * your linker can't find a function, you may want to make sure the
370 * ability is defined here. Some of these depend upon some others being
371 * defined. I haven't figured out all the interactions here, so you may
372 * have to experiment awhile to get everything to compile. If you are
373 * creating or using a shared library, you probably shouldn't touch this,
374 * as it will affect the size of the structures, and this will cause bad
375 * things to happen if the library and/or application ever change.
378 /* Any features you will not be using can be undef'ed here */
380 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
381 * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
382 * on the compile line, then pick and choose which ones to define without
383 * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
384 * if you only want to have a png-compliant reader/writer but don't need
385 * any of the extra transformations. This saves about 80 kbytes in a
386 * typical installation of the library. (PNG_NO_* form added in version
387 * 1.0.1c, for consistency)
390 /* The size of the png_text structure changed in libpng-1.0.6 when
391 * iTXt is supported. It is turned off by default, to support old apps
392 * that malloc the png_text structure instead of calling png_set_text()
393 * and letting libpng malloc it. It will be turned on by default in
397 #ifndef PNG_iTXt_SUPPORTED
398 # ifndef PNG_READ_iTXt_SUPPORTED
399 # define PNG_NO_READ_iTXt
401 # ifndef PNG_WRITE_iTXt_SUPPORTED
402 # define PNG_NO_WRITE_iTXt
406 /* The following support, added after version 1.0.0, can be turned off here en
407 * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
408 * with old applications that require the length of png_struct and png_info
409 * to remain unchanged.
412 #ifdef PNG_LEGACY_SUPPORTED
413 # define PNG_NO_FREE_ME
414 # define PNG_NO_READ_UNKNOWN_CHUNKS
415 # define PNG_NO_WRITE_UNKNOWN_CHUNKS
416 # define PNG_NO_READ_USER_CHUNKS
417 # define PNG_NO_READ_iCCP
418 # define PNG_NO_WRITE_iCCP
419 # define PNG_NO_READ_iTXt
420 # define PNG_NO_WRITE_iTXt
421 # define PNG_NO_READ_sCAL
422 # define PNG_NO_WRITE_sCAL
423 # define PNG_NO_READ_sPLT
424 # define PNG_NO_WRITE_sPLT
425 # define PNG_NO_INFO_IMAGE
426 # define PNG_NO_READ_RGB_TO_GRAY
427 # define PNG_NO_READ_USER_TRANSFORM
428 # define PNG_NO_WRITE_USER_TRANSFORM
429 # define PNG_NO_USER_MEM
430 # define PNG_NO_READ_EMPTY_PLTE
431 # define PNG_NO_MNG_FEATURES
432 # define PNG_NO_FIXED_POINT_SUPPORTED
435 /* Ignore attempt to turn off both floating and fixed point support */
436 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
437 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
438 # define PNG_FIXED_POINT_SUPPORTED
441 #ifndef PNG_NO_FREE_ME
442 # define PNG_FREE_ME_SUPPORTED
445 #if defined(PNG_READ_SUPPORTED)
447 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
448 !defined(PNG_NO_READ_TRANSFORMS)
449 # define PNG_READ_TRANSFORMS_SUPPORTED
452 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
453 # ifndef PNG_NO_READ_EXPAND
454 # define PNG_READ_EXPAND_SUPPORTED
456 # ifndef PNG_NO_READ_SHIFT
457 # define PNG_READ_SHIFT_SUPPORTED
459 # ifndef PNG_NO_READ_PACK
460 # define PNG_READ_PACK_SUPPORTED
462 # ifndef PNG_NO_READ_BGR
463 # define PNG_READ_BGR_SUPPORTED
465 # ifndef PNG_NO_READ_SWAP
466 # define PNG_READ_SWAP_SUPPORTED
468 # ifndef PNG_NO_READ_PACKSWAP
469 # define PNG_READ_PACKSWAP_SUPPORTED
471 # ifndef PNG_NO_READ_INVERT
472 # define PNG_READ_INVERT_SUPPORTED
474 # ifndef PNG_NO_READ_DITHER
475 # define PNG_READ_DITHER_SUPPORTED
477 # ifndef PNG_NO_READ_BACKGROUND
478 # define PNG_READ_BACKGROUND_SUPPORTED
480 # ifndef PNG_NO_READ_16_TO_8
481 # define PNG_READ_16_TO_8_SUPPORTED
483 # ifndef PNG_NO_READ_FILLER
484 # define PNG_READ_FILLER_SUPPORTED
486 # ifndef PNG_NO_READ_GAMMA
487 # define PNG_READ_GAMMA_SUPPORTED
489 # ifndef PNG_NO_READ_GRAY_TO_RGB
490 # define PNG_READ_GRAY_TO_RGB_SUPPORTED
492 # ifndef PNG_NO_READ_SWAP_ALPHA
493 # define PNG_READ_SWAP_ALPHA_SUPPORTED
495 # ifndef PNG_NO_READ_INVERT_ALPHA
496 # define PNG_READ_INVERT_ALPHA_SUPPORTED
498 # ifndef PNG_NO_READ_STRIP_ALPHA
499 # define PNG_READ_STRIP_ALPHA_SUPPORTED
501 # ifndef PNG_NO_READ_USER_TRANSFORM
502 # define PNG_READ_USER_TRANSFORM_SUPPORTED
504 # ifndef PNG_NO_READ_RGB_TO_GRAY
505 # define PNG_READ_RGB_TO_GRAY_SUPPORTED
507 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
509 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
510 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
511 # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
512 #endif /* about interlacing capability! You'll */
513 /* still have interlacing unless you change the following line: */
515 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
517 #ifndef PNG_NO_READ_COMPOSITE_NODIV
518 # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
519 # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
523 /* Deprecated, will be removed from version 2.0.0.
524 Use PNG_MNG_FEATURES_SUPPORTED instead. */
525 #ifndef PNG_NO_READ_EMPTY_PLTE
526 # define PNG_READ_EMPTY_PLTE_SUPPORTED
529 #endif /* PNG_READ_SUPPORTED */
531 #if defined(PNG_WRITE_SUPPORTED)
533 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
534 !defined(PNG_NO_WRITE_TRANSFORMS)
535 # define PNG_WRITE_TRANSFORMS_SUPPORTED
538 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
539 # ifndef PNG_NO_WRITE_SHIFT
540 # define PNG_WRITE_SHIFT_SUPPORTED
542 # ifndef PNG_NO_WRITE_PACK
543 # define PNG_WRITE_PACK_SUPPORTED
545 # ifndef PNG_NO_WRITE_BGR
546 # define PNG_WRITE_BGR_SUPPORTED
548 # ifndef PNG_NO_WRITE_SWAP
549 # define PNG_WRITE_SWAP_SUPPORTED
551 # ifndef PNG_NO_WRITE_PACKSWAP
552 # define PNG_WRITE_PACKSWAP_SUPPORTED
554 # ifndef PNG_NO_WRITE_INVERT
555 # define PNG_WRITE_INVERT_SUPPORTED
557 # ifndef PNG_NO_WRITE_FILLER
558 # define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
560 # ifndef PNG_NO_WRITE_SWAP_ALPHA
561 # define PNG_WRITE_SWAP_ALPHA_SUPPORTED
563 # ifndef PNG_NO_WRITE_INVERT_ALPHA
564 # define PNG_WRITE_INVERT_ALPHA_SUPPORTED
566 # ifndef PNG_NO_WRITE_USER_TRANSFORM
567 # define PNG_WRITE_USER_TRANSFORM_SUPPORTED
569 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
571 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
572 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
573 # ifndef PNG_NO_USER_TRANSFORM_PTR
574 # define PNG_USER_TRANSFORM_PTR_SUPPORTED
578 #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
579 encoders, but can cause trouble
582 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
583 defined(PNG_FLOATING_POINT_SUPPORTED)
584 # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
587 #ifndef PNG_NO_WRITE_FLUSH
588 # define PNG_WRITE_FLUSH_SUPPORTED
591 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
592 #ifndef PNG_NO_WRITE_EMPTY_PLTE
593 # define PNG_WRITE_EMPTY_PLTE_SUPPORTED
596 #endif /* PNG_WRITE_SUPPORTED */
599 # define PNG_TIME_RFC1123_SUPPORTED
602 /* This adds extra functions in pngget.c for accessing data from the
603 * info pointer (added in version 0.99)
604 * png_get_image_width()
605 * png_get_image_height()
606 * png_get_bit_depth()
607 * png_get_color_type()
608 * png_get_compression_type()
609 * png_get_filter_type()
610 * png_get_interlace_type()
611 * png_get_pixel_aspect_ratio()
612 * png_get_pixels_per_meter()
613 * png_get_x_offset_pixels()
614 * png_get_y_offset_pixels()
615 * png_get_x_offset_microns()
616 * png_get_y_offset_microns()
618 #ifndef PNG_NO_EASY_ACCESS
619 # define PNG_EASY_ACCESS_SUPPORTED
622 /* PNG_ASSEMBLER_CODE will be enabled by default in version 1.2.0
623 even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
624 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
625 # if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD)
626 # ifndef PNG_ASSEMBLER_CODE_SUPPORTED
627 # define PNG_ASSEMBLER_CODE_SUPPORTED
629 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
630 # define PNG_MMX_CODE_SUPPORTED
635 /* These are currently experimental features, define them if you want */
637 /* very little testing */
639 #ifdef PNG_READ_SUPPORTED
640 # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
641 # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
644 #ifndef PNG_NO_USER_MEM
645 # define PNG_USER_MEM_SUPPORTED
647 #ifndef PNG_NO_ZALLOC_ZERO
648 # define PNG_ZALLOC_ZERO
652 /* This is only for PowerPC big-endian and 680x0 systems */
655 #ifdef PNG_READ_SUPPORTED
656 # ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
657 # define PNG_READ_BIG_ENDIAN_SUPPORTED
662 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
664 #define PNG_NO_POINTER_INDEXING
667 /* These functions are turned off by default, as they will be phased out. */
669 #define PNG_USELESS_TESTS_SUPPORTED
670 #define PNG_CORRECT_PALETTE_SUPPORTED
673 /* Any chunks you are not interested in, you can undef here. The
674 * ones that allocate memory may be expecially important (hIST,
675 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
679 #if defined(PNG_READ_SUPPORTED) && \
680 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
681 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
682 # define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
685 #if defined(PNG_WRITE_SUPPORTED) && \
686 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
687 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
688 # define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
691 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
693 #ifdef PNG_NO_READ_TEXT
694 # define PNG_NO_READ_iTXt
695 # define PNG_NO_READ_tEXt
696 # define PNG_NO_READ_zTXt
698 #ifndef PNG_NO_READ_bKGD
699 # define PNG_READ_bKGD_SUPPORTED
700 # define PNG_bKGD_SUPPORTED
702 #ifndef PNG_NO_READ_cHRM
703 # define PNG_READ_cHRM_SUPPORTED
704 # define PNG_cHRM_SUPPORTED
706 #ifndef PNG_NO_READ_gAMA
707 # define PNG_READ_gAMA_SUPPORTED
708 # define PNG_gAMA_SUPPORTED
710 #ifndef PNG_NO_READ_hIST
711 # define PNG_READ_hIST_SUPPORTED
712 # define PNG_hIST_SUPPORTED
714 #ifndef PNG_NO_READ_iCCP
715 # define PNG_READ_iCCP_SUPPORTED
716 # define PNG_iCCP_SUPPORTED
718 #ifndef PNG_NO_READ_iTXt
719 # define PNG_READ_iTXt_SUPPORTED
720 # define PNG_iTXt_SUPPORTED
722 #ifndef PNG_NO_READ_oFFs
723 # define PNG_READ_oFFs_SUPPORTED
724 # define PNG_oFFs_SUPPORTED
726 #ifndef PNG_NO_READ_pCAL
727 # define PNG_READ_pCAL_SUPPORTED
728 # define PNG_pCAL_SUPPORTED
730 #ifndef PNG_NO_READ_sCAL
731 # define PNG_READ_sCAL_SUPPORTED
732 # define PNG_sCAL_SUPPORTED
734 #ifndef PNG_NO_READ_pHYs
735 # define PNG_READ_pHYs_SUPPORTED
736 # define PNG_pHYs_SUPPORTED
738 #ifndef PNG_NO_READ_sBIT
739 # define PNG_READ_sBIT_SUPPORTED
740 # define PNG_sBIT_SUPPORTED
742 #ifndef PNG_NO_READ_sPLT
743 # define PNG_READ_sPLT_SUPPORTED
744 # define PNG_sPLT_SUPPORTED
746 #ifndef PNG_NO_READ_sRGB
747 # define PNG_READ_sRGB_SUPPORTED
748 # define PNG_sRGB_SUPPORTED
750 #ifndef PNG_NO_READ_tEXt
751 # define PNG_READ_tEXt_SUPPORTED
752 # define PNG_tEXt_SUPPORTED
754 #ifndef PNG_NO_READ_tIME
755 # define PNG_READ_tIME_SUPPORTED
756 # define PNG_tIME_SUPPORTED
758 #ifndef PNG_NO_READ_tRNS
759 # define PNG_READ_tRNS_SUPPORTED
760 # define PNG_tRNS_SUPPORTED
762 #ifndef PNG_NO_READ_zTXt
763 # define PNG_READ_zTXt_SUPPORTED
764 # define PNG_zTXt_SUPPORTED
766 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
767 # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
768 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
769 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
771 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
772 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
775 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
776 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
777 # define PNG_READ_USER_CHUNKS_SUPPORTED
778 # define PNG_USER_CHUNKS_SUPPORTED
779 # ifdef PNG_NO_READ_UNKNOWN_CHUNKS
780 # undef PNG_NO_READ_UNKNOWN_CHUNKS
782 # ifdef PNG_NO_HANDLE_AS_UNKNOWN
783 # undef PNG_NO_HANDLE_AS_UNKNOWN
786 #ifndef PNG_NO_READ_OPT_PLTE
787 # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
788 #endif /* optional PLTE chunk in RGB and RGBA images */
789 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
790 defined(PNG_READ_zTXt_SUPPORTED)
791 # define PNG_READ_TEXT_SUPPORTED
792 # define PNG_TEXT_SUPPORTED
795 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
797 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
799 #ifdef PNG_NO_WRITE_TEXT
800 # define PNG_NO_WRITE_iTXt
801 # define PNG_NO_WRITE_tEXt
802 # define PNG_NO_WRITE_zTXt
804 #ifndef PNG_NO_WRITE_bKGD
805 # define PNG_WRITE_bKGD_SUPPORTED
806 # ifndef PNG_bKGD_SUPPORTED
807 # define PNG_bKGD_SUPPORTED
810 #ifndef PNG_NO_WRITE_cHRM
811 # define PNG_WRITE_cHRM_SUPPORTED
812 # ifndef PNG_cHRM_SUPPORTED
813 # define PNG_cHRM_SUPPORTED
816 #ifndef PNG_NO_WRITE_gAMA
817 # define PNG_WRITE_gAMA_SUPPORTED
818 # ifndef PNG_gAMA_SUPPORTED
819 # define PNG_gAMA_SUPPORTED
822 #ifndef PNG_NO_WRITE_hIST
823 # define PNG_WRITE_hIST_SUPPORTED
824 # ifndef PNG_hIST_SUPPORTED
825 # define PNG_hIST_SUPPORTED
828 #ifndef PNG_NO_WRITE_iCCP
829 # define PNG_WRITE_iCCP_SUPPORTED
830 # ifndef PNG_iCCP_SUPPORTED
831 # define PNG_iCCP_SUPPORTED
834 #ifndef PNG_NO_WRITE_iTXt
835 # define PNG_WRITE_iTXt_SUPPORTED
836 # ifndef PNG_iTXt_SUPPORTED
837 # define PNG_iTXt_SUPPORTED
840 #ifndef PNG_NO_WRITE_oFFs
841 # define PNG_WRITE_oFFs_SUPPORTED
842 # ifndef PNG_oFFs_SUPPORTED
843 # define PNG_oFFs_SUPPORTED
846 #ifndef PNG_NO_WRITE_pCAL
847 # define PNG_WRITE_pCAL_SUPPORTED
848 # ifndef PNG_pCAL_SUPPORTED
849 # define PNG_pCAL_SUPPORTED
852 #ifndef PNG_NO_WRITE_sCAL
853 # define PNG_WRITE_sCAL_SUPPORTED
854 # ifndef PNG_sCAL_SUPPORTED
855 # define PNG_sCAL_SUPPORTED
858 #ifndef PNG_NO_WRITE_pHYs
859 # define PNG_WRITE_pHYs_SUPPORTED
860 # ifndef PNG_pHYs_SUPPORTED
861 # define PNG_pHYs_SUPPORTED
864 #ifndef PNG_NO_WRITE_sBIT
865 # define PNG_WRITE_sBIT_SUPPORTED
866 # ifndef PNG_sBIT_SUPPORTED
867 # define PNG_sBIT_SUPPORTED
870 #ifndef PNG_NO_WRITE_sPLT
871 # define PNG_WRITE_sPLT_SUPPORTED
872 # ifndef PNG_sPLT_SUPPORTED
873 # define PNG_sPLT_SUPPORTED
876 #ifndef PNG_NO_WRITE_sRGB
877 # define PNG_WRITE_sRGB_SUPPORTED
878 # ifndef PNG_sRGB_SUPPORTED
879 # define PNG_sRGB_SUPPORTED
882 #ifndef PNG_NO_WRITE_tEXt
883 # define PNG_WRITE_tEXt_SUPPORTED
884 # ifndef PNG_tEXt_SUPPORTED
885 # define PNG_tEXt_SUPPORTED
888 #ifndef PNG_NO_WRITE_tIME
889 # define PNG_WRITE_tIME_SUPPORTED
890 # ifndef PNG_tIME_SUPPORTED
891 # define PNG_tIME_SUPPORTED
894 #ifndef PNG_NO_WRITE_tRNS
895 # define PNG_WRITE_tRNS_SUPPORTED
896 # ifndef PNG_tRNS_SUPPORTED
897 # define PNG_tRNS_SUPPORTED
900 #ifndef PNG_NO_WRITE_zTXt
901 # define PNG_WRITE_zTXt_SUPPORTED
902 # ifndef PNG_zTXt_SUPPORTED
903 # define PNG_zTXt_SUPPORTED
906 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
907 # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
908 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
909 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
911 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
912 # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
913 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
917 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
918 defined(PNG_WRITE_zTXt_SUPPORTED)
919 # define PNG_WRITE_TEXT_SUPPORTED
920 # ifndef PNG_TEXT_SUPPORTED
921 # define PNG_TEXT_SUPPORTED
925 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
927 /* Turn this off to disable png_read_png() and
928 * png_write_png() and leave the row_pointers member
929 * out of the info structure.
931 #ifndef PNG_NO_INFO_IMAGE
932 # define PNG_INFO_IMAGE_SUPPORTED
935 /* need the time information for reading tIME chunks */
936 #if defined(PNG_tIME_SUPPORTED)
937 # if !defined(_WIN32_WCE)
938 /* "time.h" functions are not supported on WindowsCE */
943 /* Some typedefs to get us started. These should be safe on most of the
944 * common platforms. The typedefs should be at least as large as the
945 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
946 * don't have to be exactly that size. Some compilers dislike passing
947 * unsigned shorts as function parameters, so you may be better off using
948 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
949 * want to have unsigned int for png_uint_32 instead of unsigned long.
952 typedef unsigned int png_uint_32
;
953 typedef int png_int_32
;
954 typedef unsigned short png_uint_16
;
955 typedef short png_int_16
;
956 typedef unsigned char png_byte
;
958 /* This is usually size_t. It is typedef'ed just in case you need it to
959 change (I'm not sure if you will or not, so I thought I'd be safe) */
960 typedef size_t png_size_t
;
962 /* The following is needed for medium model support. It cannot be in the
963 * PNG_INTERNAL section. Needs modification for other compilers besides
964 * MSC. Model independent support declares all arrays and pointers to be
965 * large using the far keyword. The zlib version used must also support
966 * model independent data. As of version zlib 1.0.4, the necessary changes
967 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
968 * changes that are needed. (Tim Wegner)
971 /* Separate compiler dependencies (problem here is that zlib.h always
972 defines FAR. (SJT) */
974 # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
979 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
980 # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
981 # define PNG_MAX_MALLOC_64K
986 # define USE_FAR_KEYWORD
987 # endif /* LDATA != 1 */
988 /* Possibly useful for moving data out of default segment.
989 * Uncomment it if you want. Could also define FARDATA as
990 * const if your compiler supports it. (SJT)
993 # endif /* __WIN32__, __FLAT__, __CYGWIN__ */
994 #endif /* __BORLANDC__ */
997 /* Suggest testing for specific compiler first before testing for
998 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
999 * making reliance oncertain keywords suspect. (SJT)
1002 /* MSC Medium model */
1004 # if defined(M_I86MM)
1005 # define USE_FAR_KEYWORD
1006 # define FARDATA FAR
1011 /* SJT: default case */
1016 /* At this point FAR is always defined */
1021 /* Typedef for floating-point numbers that are converted
1022 to fixed-point with a multiple of 100,000, e.g., int_gamma */
1023 typedef png_int_32 png_fixed_point
;
1025 /* Add typedefs for pointers */
1026 typedef void FAR
* png_voidp
;
1027 typedef png_byte FAR
* png_bytep
;
1028 typedef png_uint_32 FAR
* png_uint_32p
;
1029 typedef png_int_32 FAR
* png_int_32p
;
1030 typedef png_uint_16 FAR
* png_uint_16p
;
1031 typedef png_int_16 FAR
* png_int_16p
;
1032 typedef PNG_CONST
char FAR
* png_const_charp
;
1033 typedef char FAR
* png_charp
;
1034 typedef png_fixed_point FAR
* png_fixed_point_p
;
1036 #ifndef PNG_NO_STDIO
1037 #if defined(_WIN32_WCE)
1038 typedef HANDLE png_FILE_p
;
1040 typedef FILE * png_FILE_p
;
1044 #ifdef PNG_FLOATING_POINT_SUPPORTED
1045 typedef double FAR
* png_doublep
;
1048 /* Pointers to pointers; i.e. arrays */
1049 typedef png_byte FAR
* FAR
* png_bytepp
;
1050 typedef png_uint_32 FAR
* FAR
* png_uint_32pp
;
1051 typedef png_int_32 FAR
* FAR
* png_int_32pp
;
1052 typedef png_uint_16 FAR
* FAR
* png_uint_16pp
;
1053 typedef png_int_16 FAR
* FAR
* png_int_16pp
;
1054 typedef PNG_CONST
char FAR
* FAR
* png_const_charpp
;
1055 typedef char FAR
* FAR
* png_charpp
;
1056 typedef png_fixed_point FAR
* FAR
* png_fixed_point_pp
;
1057 #ifdef PNG_FLOATING_POINT_SUPPORTED
1058 typedef double FAR
* FAR
* png_doublepp
;
1061 /* Pointers to pointers to pointers; i.e., pointer to array */
1062 typedef char FAR
* FAR
* FAR
* png_charppp
;
1064 /* libpng typedefs for types in zlib. If zlib changes
1065 * or another compression library is used, then change these.
1066 * Eliminates need to change all the source files.
1068 typedef charf
* png_zcharp
;
1069 typedef charf
* FAR
* png_zcharpp
;
1070 typedef z_stream FAR
* png_zstreamp
;
1073 * Define PNG_BUILD_DLL if the module being built is a Windows
1076 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
1077 * It is equivalent to Microsoft predefined macro _DLL that is
1078 * automatically defined when you compile using the share
1079 * version of the CRT (C Run-Time library)
1081 * The cygwin mods make this behavior a little different:
1082 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1083 * Define PNG_STATIC if you are building a static library for use with cygwin,
1084 * -or- if you are building an application that you want to link to the
1086 * PNG_USE_DLL is defined by default (no user action needed) unless one of
1087 * the other flags is defined.
1090 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
1093 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1094 * When building a static lib, default to no GLOBAL ARRAYS, but allow
1095 * command-line override
1097 #if defined(__CYGWIN__)
1098 # if !defined(PNG_STATIC)
1099 # if defined(PNG_USE_GLOBAL_ARRAYS)
1100 # undef PNG_USE_GLOBAL_ARRAYS
1102 # if !defined(PNG_USE_LOCAL_ARRAYS)
1103 # define PNG_USE_LOCAL_ARRAYS
1106 # if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1107 # if defined(PNG_USE_GLOBAL_ARRAYS)
1108 # undef PNG_USE_GLOBAL_ARRAYS
1112 # if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1113 # define PNG_USE_LOCAL_ARRAYS
1117 /* Do not use global arrays (helps with building DLL's)
1118 * They are no longer used in libpng itself, since version 1.0.5c,
1119 * but might be required for some pre-1.0.5c applications.
1121 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1122 # if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
1123 # define PNG_USE_LOCAL_ARRAYS
1125 # define PNG_USE_GLOBAL_ARRAYS
1132 #if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF)
1133 # ifndef PNG_NO_MODULEDEF
1134 # define PNG_NO_MODULEDEF
1138 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
1142 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
1143 (( defined(_Windows) || defined(_WINDOWS) || \
1144 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
1145 ) && !defined(__CYGWIN__))
1147 # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1148 # define PNGAPI __cdecl
1150 # define PNGAPI _cdecl
1153 # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1154 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1158 # if !defined(PNG_IMPEXP)
1160 # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
1161 # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
1163 /* Borland/Microsoft */
1164 # if defined(_MSC_VER) || defined(__BORLANDC__)
1165 # if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1166 # define PNG_EXPORT PNG_EXPORT_TYPE1
1168 # define PNG_EXPORT PNG_EXPORT_TYPE2
1169 # if defined(PNG_BUILD_DLL)
1170 # define PNG_IMPEXP __export
1172 # define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in
1174 # endif /* Exists in Borland C++ for
1175 C++ classes (== huge) */
1179 # if !defined(PNG_IMPEXP)
1180 # if defined(PNG_BUILD_DLL)
1181 # define PNG_IMPEXP __declspec(dllexport)
1183 # define PNG_IMPEXP __declspec(dllimport)
1186 # endif /* PNG_IMPEXP */
1187 #else /* !(DLL || non-cygwin WINDOWS) */
1188 # if defined(__CYGWIN__) && !defined(PNG_DLL)
1189 # if !defined(PNG_IMPEXP)
1192 # define PNGAPI __cdecl
1194 # if 0 /* ... other platforms, with other meanings */
1211 # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
1214 #ifdef PNG_USE_GLOBAL_ARRAYS
1215 # ifndef PNG_EXPORT_VAR
1216 # define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1220 /* User may want to use these so they are not in PNG_INTERNAL. Any library
1221 * functions that are passed far data must be model independent.
1225 # define PNG_ABORT() abort()
1228 #ifdef PNG_SETJMP_SUPPORTED
1229 # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
1231 # define png_jmpbuf(png_ptr) \
1232 (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
1235 #if defined(USE_FAR_KEYWORD) /* memory model independent fns */
1236 /* use this to make far-to-near assignments */
1239 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1240 # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1241 # define png_strcpy _fstrcpy
1242 # define png_strlen _fstrlen
1243 # define png_memcmp _fmemcmp /* SJT: added */
1244 # define png_memcpy _fmemcpy
1245 # define png_memset _fmemset
1246 #else /* use the usual functions */
1247 # define CVT_PTR(ptr) (ptr)
1248 # define CVT_PTR_NOCHECK(ptr) (ptr)
1249 # define png_strcpy strcpy
1250 # define png_strlen strlen
1251 # define png_memcmp memcmp /* SJT: added */
1252 # define png_memcpy memcpy
1253 # define png_memset memset
1255 /* End of memory model independent support */
1257 /* Just a little check that someone hasn't tried to define something
1260 #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
1261 # undef PNG_ZBUF_SIZE
1262 # define PNG_ZBUF_SIZE 65536
1265 #ifdef PNG_READ_SUPPORTED
1266 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
1267 #if defined(PNG_INTERNAL)
1269 /* These are the default thresholds before the MMX code kicks in; if either
1270 * rowbytes or bitdepth is below the threshold, plain C code is used. These
1271 * can be overridden at runtime via the png_set_mmx_thresholds() call in
1272 * libpng 1.2.0 and later. The values below were chosen by Intel.
1275 #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
1276 # define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
1278 #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
1279 # define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
1282 /* Set this in the makefile for VC++ on Pentium, not here. */
1283 /* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
1284 * MMX will be detected at run time and used if present.
1286 #ifdef PNG_USE_PNGVCRD
1287 # define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1288 # define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1289 # define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1292 /* Set this in the makefile for gcc/as on Pentium, not here. */
1293 /* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
1294 * MMX will be detected at run time and used if present.
1296 #ifdef PNG_USE_PNGGCCRD
1297 # define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1298 # define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1299 # define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1301 /* - see pnggccrd.c for info about what is currently enabled */
1303 #endif /* PNG_INTERNAL */
1304 #endif /* PNG_READ_SUPPORTED */
1306 #endif /* PNGCONF_H */