Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 1 | |
Glenn Randers-Pehrson | 0f881d6 | 1998-02-07 10:20:57 -0600 | [diff] [blame] | 2 | /* pngconf.h - machine configurable file for libpng |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 3 | * |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 4 | * libpng 1.0.5q - February 5, 2000 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 5 | * For conditions of distribution and use, see copyright notice in png.h |
| 6 | * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. |
| 7 | * Copyright (c) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 8 | * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 9 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 10 | |
| 11 | /* Any machine specific code is near the front of this file, so if you |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 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 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 16 | |
| 17 | #ifndef PNGCONF_H |
| 18 | #define PNGCONF_H |
| 19 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 20 | /* This is the size of the compression buffer, and thus the size of |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 21 | * an IDAT chunk. Make this whatever size you feel is best for your |
| 22 | * machine. One of these will be allocated per png_struct. When this |
| 23 | * is full, it writes the data to the disk, and does some other |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 24 | * calculations. Making this an extremely small size will slow |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 25 | * the library down, but you may want to experiment to determine |
| 26 | * where it becomes significant, if you are concerned with memory |
| 27 | * usage. Note that zlib allocates at least 32Kb also. For readers, |
| 28 | * this describes the size of the buffer available to read the data in. |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 29 | * Unless this gets smaller than the size of a row (compressed), |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 30 | * it should not make much difference how big this is. |
| 31 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 32 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 33 | #ifndef PNG_ZBUF_SIZE |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 34 | #define PNG_ZBUF_SIZE 8192 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 35 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 36 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 37 | /* If you are running on a machine where you cannot allocate more |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 38 | * than 64K of memory at once, uncomment this. While libpng will not |
| 39 | * normally need that much memory in a chunk (unless you load up a very |
| 40 | * large file), zlib needs to know how big of a chunk it can use, and |
| 41 | * libpng thus makes sure to check any memory allocation to verify it |
| 42 | * will fit into memory. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 43 | #define PNG_MAX_MALLOC_64K |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 44 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 45 | #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) |
| 46 | #define PNG_MAX_MALLOC_64K |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 47 | #endif |
| 48 | |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 49 | /* This protects us against compilers that run on a windowing system |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 50 | * and thus don't have or would rather us not use the stdio types: |
| 51 | * stdin, stdout, and stderr. The only one currently used is stderr |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 52 | * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will |
| 53 | * prevent these from being compiled and used. #defining PNG_NO_STDIO |
| 54 | * will also prevent these, plus will prevent the entire set of stdio |
| 55 | * macros and functions (FILE *, printf, etc.) from being compiled and used, |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 56 | * unless (PNG_DEBUG > 0) has been #defined. |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 57 | * |
| 58 | * #define PNG_NO_CONSOLE_IO |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 59 | * #define PNG_NO_STDIO |
| 60 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 61 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 62 | # ifdef PNG_NO_STDIO |
| 63 | # ifndef PNG_NO_CONSOLE_IO |
| 64 | # define PNG_NO_CONSOLE_IO |
| 65 | # endif |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 66 | # ifdef PNG_DEBUG |
| 67 | # if (PNG_DEBUG > 0) |
| 68 | # include <stdio.h> |
| 69 | # endif |
| 70 | # endif |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 71 | # else |
| 72 | # include <stdio.h> |
| 73 | # endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 74 | |
| 75 | /* This macro protects us against machines that don't have function |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 76 | * prototypes (ie K&R style headers). If your compiler does not handle |
| 77 | * function prototypes, define this macro and use the included ansi2knr. |
| 78 | * I've always been able to use _NO_PROTO as the indicator, but you may |
| 79 | * need to drag the empty declaration out in front of here, or change the |
| 80 | * ifdef to suit your own needs. |
| 81 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 82 | #ifndef PNGARG |
| 83 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 84 | #ifdef OF /* zlib prototype munger */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 85 | #define PNGARG(arglist) OF(arglist) |
| 86 | #else |
| 87 | |
| 88 | #ifdef _NO_PROTO |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 89 | #define PNGARG(arglist) () |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 90 | #else |
| 91 | #define PNGARG(arglist) arglist |
| 92 | #endif /* _NO_PROTO */ |
| 93 | |
| 94 | #endif /* OF */ |
| 95 | |
| 96 | #endif /* PNGARG */ |
| 97 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 98 | /* Try to determine if we are compiling on a Mac. Note that testing for |
| 99 | * just __MWERKS__ is not good enough, because the Codewarrior is now used |
| 100 | * on non-Mac platforms. |
| 101 | */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 102 | #ifndef MACOS |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 103 | #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 104 | defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 105 | #define MACOS |
| 106 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 107 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 108 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 109 | /* enough people need this for various reasons to include it here */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 110 | #if !defined(MACOS) && !defined(RISCOS) |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 111 | #include <sys/types.h> |
| 112 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 113 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 114 | #ifndef PNG_SETJMP_NOT_SUPPORTED |
| 115 | # define PNG_SETJMP_SUPPORTED |
| 116 | #endif |
| 117 | |
| 118 | #ifdef PNG_SETJMP_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 119 | /* This is an attempt to force a single setjmp behaviour on Linux. If |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 120 | * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. |
| 121 | */ |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 122 | # ifdef __linux__ |
| 123 | # ifdef _BSD_SOURCE |
| 124 | # define _PNG_SAVE_BSD_SOURCE |
| 125 | # undef _BSD_SOURCE |
| 126 | # endif |
| 127 | # ifdef _SETJMP_H |
| 128 | __png.h__ already includes setjmp.h |
| 129 | __dont__ include it again |
| 130 | # endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 131 | #endif /* __linux__ */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 132 | |
| 133 | /* include setjmp.h for error handling */ |
| 134 | #include <setjmp.h> |
| 135 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 136 | # ifdef __linux__ |
| 137 | # ifdef _PNG_SAVE_BSD_SOURCE |
| 138 | # define _BSD_SOURCE |
| 139 | # undef _PNG_SAVE_BSD_SOURCE |
| 140 | # endif |
| 141 | # endif /* __linux__ */ |
| 142 | #endif /* PNG_SETJMP_SUPPORTED */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 143 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 144 | #ifdef BSD |
| 145 | #include <strings.h> |
| 146 | #else |
| 147 | #include <string.h> |
| 148 | #endif |
| 149 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 150 | /* Other defines for things like memory and the like can go here. */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 151 | #ifdef PNG_INTERNAL |
| 152 | #include <stdlib.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 153 | |
| 154 | /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which |
| 155 | * aren't usually used outside the library (as far as I know), so it is |
| 156 | * debatable if they should be exported at all. In the future, when it is |
| 157 | * possible to have run-time registry of chunk-handling functions, some of |
| 158 | * these will be made available again. |
| 159 | #define PNG_EXTERN extern |
| 160 | */ |
| 161 | #define PNG_EXTERN |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 162 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 163 | /* Other defines specific to compilers can go here. Try to keep |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 164 | * them inside an appropriate ifdef/endif pair for portability. |
| 165 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 166 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 167 | #if !defined(PNG_NO_FLOATING_POINT_SUPPORTED) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 168 | #if defined(MACOS) |
| 169 | /* We need to check that <math.h> hasn't already been included earlier |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 170 | * as it seems it doesn't agree with <fp.h>, yet we should really use |
| 171 | * <fp.h> if possible. |
| 172 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 173 | #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 174 | #include <fp.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 175 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 176 | #else |
| 177 | #include <math.h> |
| 178 | #endif |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 179 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 180 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 181 | /* Codewarrior on NT has linking problems without this. */ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 182 | #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 183 | #define PNG_ALWAYS_EXTERN |
| 184 | #endif |
| 185 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 186 | /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 187 | * stdlib.h like it should (I think). Or perhaps this is a C++ |
| 188 | * "feature"? |
| 189 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 190 | #ifdef __TURBOC__ |
| 191 | #include <mem.h> |
| 192 | #include "alloc.h" |
| 193 | #endif |
| 194 | |
| 195 | #ifdef _MSC_VER |
| 196 | #include <malloc.h> |
| 197 | #endif |
| 198 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 199 | /* This controls how fine the dithering gets. As this allocates |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 200 | * a largish chunk of memory (32K), those who are not as concerned |
| 201 | * with dithering quality can decrease some or all of these. |
| 202 | */ |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 203 | #ifndef PNG_DITHER_RED_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 204 | #define PNG_DITHER_RED_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 205 | #endif |
| 206 | #ifndef PNG_DITHER_GREEN_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 207 | #define PNG_DITHER_GREEN_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 208 | #endif |
| 209 | #ifndef PNG_DITHER_BLUE_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 210 | #define PNG_DITHER_BLUE_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 211 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 212 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 213 | /* This controls how fine the gamma correction becomes when you |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 214 | * are only interested in 8 bits anyway. Increasing this value |
| 215 | * results in more memory being used, and more pow() functions |
| 216 | * being called to fill in the gamma tables. Don't set this value |
| 217 | * less then 8, and even that may not work (I haven't tested it). |
| 218 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 219 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 220 | #ifndef PNG_MAX_GAMMA_8 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 221 | #define PNG_MAX_GAMMA_8 11 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 222 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 223 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 224 | /* This controls how much a difference in gamma we can tolerate before |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 225 | * we actually start doing gamma conversion. |
| 226 | */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 227 | #ifndef PNG_GAMMA_THRESHOLD |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 228 | #define PNG_GAMMA_THRESHOLD 0.05 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 229 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 230 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 231 | #endif /* PNG_INTERNAL */ |
| 232 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 233 | /* The following uses const char * instead of char * for error |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 234 | * and warning message functions, so some compilers won't complain. |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 235 | * If you do not want to use const, define PNG_NO_CONST here. |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 236 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 237 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 238 | #ifndef PNG_NO_CONST |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 239 | # define PNG_CONST const |
| 240 | #else |
| 241 | # define PNG_CONST |
| 242 | #endif |
| 243 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 244 | /* The following defines give you the ability to remove code from the |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 245 | * library that you will not be using. I wish I could figure out how to |
| 246 | * automate this, but I can't do that without making it seriously hard |
| 247 | * on the users. So if you are not using an ability, change the #define |
| 248 | * to and #undef, and that part of the library will not be compiled. If |
| 249 | * your linker can't find a function, you may want to make sure the |
| 250 | * ability is defined here. Some of these depend upon some others being |
| 251 | * defined. I haven't figured out all the interactions here, so you may |
| 252 | * have to experiment awhile to get everything to compile. If you are |
| 253 | * creating or using a shared library, you probably shouldn't touch this, |
| 254 | * as it will affect the size of the structures, and this will cause bad |
| 255 | * things to happen if the library and/or application ever change. |
| 256 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 257 | |
| 258 | /* Any transformations you will not be using can be undef'ed here */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 259 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 260 | /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 261 | to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS |
| 262 | on the compile line, then pick and choose which ones to define without |
| 263 | having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED |
| 264 | if you only want to have a png-compliant reader/writer but don't need |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 265 | any of the extra transformations. This saves about 80 kbytes in a |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 266 | typical installation of the library. (PNG_NO_* form added in version |
| 267 | 1.0.1c, for consistency) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 268 | */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 269 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 270 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 271 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 272 | #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ |
| 273 | !defined(PNG_NO_READ_TRANSFORMS) |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 274 | #define PNG_READ_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 275 | #endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 276 | #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ |
| 277 | !defined(PNG_NO_WRITE_TRANSFORMS) |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 278 | #define PNG_WRITE_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 279 | #endif |
| 280 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 281 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 282 | #ifndef PNG_NO_READ_EXPAND |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 283 | #define PNG_READ_EXPAND_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 284 | #endif |
| 285 | #ifndef PNG_NO_READ_SHIFT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 286 | #define PNG_READ_SHIFT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 287 | #endif |
| 288 | #ifndef PNG_NO_READ_PACK |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 289 | #define PNG_READ_PACK_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 290 | #endif |
| 291 | #ifndef PNG_NO_READ_BGR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 292 | #define PNG_READ_BGR_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 293 | #endif |
| 294 | #ifndef PNG_NO_READ_SWAP |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 295 | #define PNG_READ_SWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 296 | #endif |
| 297 | #ifndef PNG_NO_READ_PACKSWAP |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 298 | #define PNG_READ_PACKSWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 299 | #endif |
| 300 | #ifndef PNG_NO_READ_INVERT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 301 | #define PNG_READ_INVERT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 302 | #endif |
| 303 | #ifndef PNG_NO_READ_DITHER |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 304 | #define PNG_READ_DITHER_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 305 | #endif |
| 306 | #ifndef PNG_NO_READ_BACKGROUND |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 307 | #define PNG_READ_BACKGROUND_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 308 | #endif |
| 309 | #ifndef PNG_NO_READ_16_TO_8 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 310 | #define PNG_READ_16_TO_8_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 311 | #endif |
| 312 | #ifndef PNG_NO_READ_FILLER |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 313 | #define PNG_READ_FILLER_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 314 | #endif |
| 315 | #ifndef PNG_NO_READ_GAMMA |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 316 | #define PNG_READ_GAMMA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 317 | #endif |
| 318 | #ifndef PNG_NO_READ_GRAY_TO_RGB |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 319 | #define PNG_READ_GRAY_TO_RGB_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 320 | #endif |
| 321 | #ifndef PNG_NO_READ_SWAP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 322 | #define PNG_READ_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 323 | #endif |
| 324 | #ifndef PNG_NO_READ_INVERT_ALPHA |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 325 | #define PNG_READ_INVERT_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 326 | #endif |
| 327 | #ifndef PNG_NO_READ_STRIP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 328 | #define PNG_READ_STRIP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 329 | #endif |
| 330 | #ifndef PNG_NO_READ_USER_TRANSFORM |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 331 | #define PNG_READ_USER_TRANSFORM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 332 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 333 | #ifndef PNG_NO_READ_RGB_TO_GRAY |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 334 | #define PNG_READ_RGB_TO_GRAY_SUPPORTED |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 335 | #endif |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 336 | #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 337 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 338 | #if !defined(PNG_NO_PROGRESSIVE_READ) && \ |
| 339 | !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 340 | #define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ |
| 341 | #endif /* about interlacing capability! You'll */ |
| 342 | /* still have interlacing unless you change the following line: */ |
| 343 | #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 344 | |
| 345 | #ifndef PNG_NO_READ_COMPOSITED_NODIV |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 346 | #define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 347 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 348 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 349 | #ifndef PNG_NO_READ_EMPTY_PLTE |
| 350 | #define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */ |
| 351 | #endif |
| 352 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 353 | #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 354 | #ifndef PNG_NO_WRITE_SHIFT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 355 | #define PNG_WRITE_SHIFT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 356 | #endif |
| 357 | #ifndef PNG_NO_WRITE_PACK |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 358 | #define PNG_WRITE_PACK_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 359 | #endif |
| 360 | #ifndef PNG_NO_WRITE_BGR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 361 | #define PNG_WRITE_BGR_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 362 | #endif |
| 363 | #ifndef PNG_NO_WRITE_SWAP |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 364 | #define PNG_WRITE_SWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 365 | #endif |
| 366 | #ifndef PNG_NO_WRITE_PACKSWAP |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 367 | #define PNG_WRITE_PACKSWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 368 | #endif |
| 369 | #ifndef PNG_NO_WRITE_INVERT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 370 | #define PNG_WRITE_INVERT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 371 | #endif |
| 372 | #ifndef PNG_NO_WRITE_FILLER |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 373 | #define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 374 | #endif |
| 375 | #ifndef PNG_NO_WRITE_SWAP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 376 | #define PNG_WRITE_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 377 | #endif |
| 378 | #ifndef PNG_NO_WRITE_INVERT_ALPHA |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 379 | #define PNG_WRITE_INVERT_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 380 | #endif |
| 381 | #ifndef PNG_NO_WRITE_USER_TRANSFORM |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 382 | #define PNG_WRITE_USER_TRANSFORM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 383 | #endif |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 384 | #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 385 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 386 | #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant |
| 387 | encoders, but can cause trouble |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 388 | if left undefined */ |
| 389 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 390 | #ifndef PNG_NO_WRITE_WEIGHTED_FILTER |
| 391 | #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED |
| 392 | #endif |
| 393 | |
| 394 | #ifndef PNG_NO_WRITE_FLUSH |
| 395 | #define PNG_WRITE_FLUSH_SUPPORTED |
| 396 | #endif |
| 397 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 398 | #ifndef PNG_NO_WRITE_EMPTY_PLTE |
| 399 | #define PNG_WRITE_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */ |
| 400 | #endif |
| 401 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 402 | #ifndef PNG_NO_STDIO |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 403 | #define PNG_TIME_RFC1123_SUPPORTED |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 404 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 405 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 406 | /* This adds extra functions in pngget.c for accessing data from the |
| 407 | * info pointer (added in version 0.99) |
| 408 | * png_get_image_width() |
| 409 | * png_get_image_height() |
| 410 | * png_get_bit_depth() |
| 411 | * png_get_color_type() |
| 412 | * png_get_compression_type() |
| 413 | * png_get_filter_type() |
| 414 | * png_get_interlace_type() |
| 415 | * png_get_pixel_aspect_ratio() |
| 416 | * png_get_pixels_per_meter() |
| 417 | * png_get_x_offset_pixels() |
| 418 | * png_get_y_offset_pixels() |
| 419 | * png_get_x_offset_microns() |
| 420 | * png_get_y_offset_microns() |
| 421 | */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 422 | #ifndef PNG_NO_EASY_ACCESS |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 423 | #define PNG_EASY_ACCESS_SUPPORTED |
| 424 | #endif |
| 425 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 426 | #ifndef PNG_NO_ASSEMBLER_CODE |
| 427 | #define PNG_ASSEMBLER_CODE_SUPPORTED |
| 428 | #endif |
| 429 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 430 | #ifndef PNG_NO_FLOATING_POINT_SUPPORTED |
| 431 | #define PNG_FLOATING_POINT_SUPPORTED |
| 432 | #endif |
| 433 | |
| 434 | #ifndef PNG_NO_FIXED_POINT_SUPPORTED |
| 435 | #define PNG_FIXED_POINT_SUPPORTED |
| 436 | #endif |
| 437 | |
Glenn Randers-Pehrson | 5379b24 | 1999-11-27 10:22:33 -0600 | [diff] [blame] | 438 | /* Do not use global arrays (helps with building DLL's) |
| 439 | * They are no longer used in libpng itself, since version 1.0.5c, |
| 440 | * but might be required for some pre-1.0.5c applications. |
| 441 | */ |
Glenn Randers-Pehrson | 074af5e | 1999-11-28 23:32:18 -0600 | [diff] [blame] | 442 | #ifdef PNG_NO_GLOBAL_ARRAYS |
| 443 | #define PNG_USE_LOCAL_ARRAYS |
| 444 | #else |
| 445 | #define PNG_USE_GLOBAL_ARRAYS |
Glenn Randers-Pehrson | 5379b24 | 1999-11-27 10:22:33 -0600 | [diff] [blame] | 446 | #endif |
| 447 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 448 | /* These are currently experimental features, define them if you want */ |
| 449 | |
| 450 | /* very little testing */ |
| 451 | /* |
Glenn Randers-Pehrson | cbe52d8 | 1998-02-28 07:00:24 -0600 | [diff] [blame] | 452 | #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 453 | #define PNG_USER_MEM_SUPPORTED |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 454 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 455 | |
| 456 | /* This is only for PowerPC big-endian and 680x0 systems */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 457 | /* some testing */ |
| 458 | /* |
| 459 | #define PNG_READ_BIG_ENDIAN_SUPPORTED |
| 460 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 461 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 462 | /* These functions are turned off by default, as they will be phased out. */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 463 | /* |
| 464 | #define PNG_USELESS_TESTS_SUPPORTED |
| 465 | #define PNG_CORRECT_PALETTE_SUPPORTED |
| 466 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 467 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 468 | /* Any chunks you are not interested in, you can undef here. The |
| 469 | * ones that allocate memory may be expecially important (hIST, |
| 470 | * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 471 | * a bit smaller. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 472 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 473 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 474 | #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ |
| 475 | !defined(PNG_NO_READ_ANCILLARY_CHUNKS) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 476 | #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
| 477 | #endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 478 | #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ |
| 479 | !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 480 | #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
| 481 | #endif |
| 482 | |
| 483 | #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 484 | |
| 485 | #ifdef PNG_NO_READ_TEXT |
| 486 | # define PNG_NO_READ_iTXt |
| 487 | # define PNG_NO_READ_tEXt |
| 488 | # define PNG_NO_READ_zTXt |
| 489 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 490 | #ifndef PNG_NO_READ_bKGD |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 491 | # define PNG_READ_bKGD_SUPPORTED |
| 492 | # define PNG_bKGD_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 493 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 494 | #ifndef PNG_NO_READ_cHRM |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 495 | # define PNG_READ_cHRM_SUPPORTED |
| 496 | # define PNG_cHRM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 497 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 498 | #ifndef PNG_NO_READ_gAMA |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 499 | # define PNG_READ_gAMA_SUPPORTED |
| 500 | # define PNG_gAMA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 501 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 502 | #ifndef PNG_NO_READ_hIST |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 503 | # define PNG_READ_hIST_SUPPORTED |
| 504 | # define PNG_hIST_SUPPORTED |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 505 | #endif |
| 506 | #ifndef PNG_NO_READ_iCCP |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 507 | # define PNG_READ_iCCP_SUPPORTED |
| 508 | # define PNG_iCCP_SUPPORTED |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 509 | #endif |
| 510 | #ifndef PNG_NO_READ_iTXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 511 | # define PNG_READ_iTXt_SUPPORTED |
| 512 | # define PNG_iTXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 513 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 514 | #ifndef PNG_NO_READ_oFFs |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 515 | # define PNG_READ_oFFs_SUPPORTED |
| 516 | # define PNG_oFFs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 517 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 518 | #ifndef PNG_NO_READ_pCAL |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 519 | # define PNG_READ_pCAL_SUPPORTED |
| 520 | # define PNG_pCAL_SUPPORTED |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 521 | #endif |
| 522 | #ifndef PNG_NO_READ_sCAL |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 523 | # define PNG_READ_sCAL_SUPPORTED |
| 524 | # define PNG_sCAL_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 525 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 526 | #ifndef PNG_NO_READ_pHYs |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 527 | # define PNG_READ_pHYs_SUPPORTED |
| 528 | # define PNG_pHYs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 529 | #endif |
| 530 | #ifndef PNG_NO_READ_sBIT |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 531 | # define PNG_READ_sBIT_SUPPORTED |
| 532 | # define PNG_sBIT_SUPPORTED |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 533 | #endif |
| 534 | #ifndef PNG_NO_READ_sPLT |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 535 | # define PNG_READ_sPLT_SUPPORTED |
| 536 | # define PNG_sPLT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 537 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 538 | #ifndef PNG_NO_READ_sRGB |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 539 | # define PNG_READ_sRGB_SUPPORTED |
| 540 | # define PNG_sRGB_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 541 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 542 | #ifndef PNG_NO_READ_tEXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 543 | # define PNG_READ_tEXt_SUPPORTED |
| 544 | # define PNG_tEXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 545 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 546 | #ifndef PNG_NO_READ_tIME |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 547 | # define PNG_READ_tIME_SUPPORTED |
| 548 | # define PNG_tIME_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 549 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 550 | #ifndef PNG_NO_READ_tRNS |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 551 | # define PNG_READ_tRNS_SUPPORTED |
| 552 | # define PNG_tRNS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 553 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 554 | #ifndef PNG_NO_READ_zTXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 555 | # define PNG_READ_zTXt_SUPPORTED |
| 556 | # define PNG_zTXt_SUPPORTED |
| 557 | #endif |
| 558 | #ifndef PNG_NO_READ_USER_CHUNKS |
| 559 | # define PNG_READ_USER_CHUNKS_SUPPORTED |
| 560 | # define PNG_USER_CHUNKS_SUPPORTED |
| 561 | # ifdef PNG_NO_READ_UNKNOWN_CHUNKS |
| 562 | # undef PNG_NO_READ_UNKNOWN_CHUNKS |
| 563 | # endif |
| 564 | # ifdef PNG_NO_HANDLE_AS_UNKNOWN |
| 565 | # undef PNG_NO_HANDLE_AS_UNKNOWN |
| 566 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 567 | #endif |
| 568 | #ifndef PNG_NO_READ_UNKNOWN_CHUNKS |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 569 | # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED |
| 570 | # define PNG_UNKNOWN_CHUNKS_SUPPORTED |
| 571 | # ifndef PNG_NO_HANDLE_AS_UNKNOWN |
| 572 | # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED |
| 573 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 574 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 575 | #ifndef PNG_NO_READ_OPT_PLTE |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 576 | # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ |
| 577 | #endif /* optional PLTE chunk in RGB and RGBA images */ |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 578 | #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ |
| 579 | defined(PNG_READ_zTXt_SUPPORTED) |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 580 | # define PNG_READ_TEXT_SUPPORTED |
| 581 | # define PNG_TEXT_SUPPORTED |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 582 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 583 | #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 584 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 585 | #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 586 | #ifdef PNG_NO_WRITE_TEXT |
| 587 | # define PNG_NO_WRITE_iTXt |
| 588 | # define PNG_NO_WRITE_tEXt |
| 589 | # define PNG_NO_WRITE_zTXt |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 590 | #endif |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 591 | #ifndef PNG_NO_WRITE_bKGD |
| 592 | # define PNG_WRITE_bKGD_SUPPORTED |
| 593 | # ifndef PNG_bKGD_SUPPORTED |
| 594 | # define PNG_bKGD_SUPPORTED |
| 595 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 596 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 597 | #ifndef PNG_NO_WRITE_cHRM |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 598 | # define PNG_WRITE_cHRM_SUPPORTED |
| 599 | # ifndef PNG_cHRM_SUPPORTED |
| 600 | # define PNG_cHRM_SUPPORTED |
| 601 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 602 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 603 | #ifndef PNG_NO_WRITE_gAMA |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 604 | # define PNG_WRITE_gAMA_SUPPORTED |
| 605 | # ifndef PNG_gAMA_SUPPORTED |
| 606 | # define PNG_gAMA_SUPPORTED |
| 607 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 608 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 609 | #ifndef PNG_NO_WRITE_hIST |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 610 | # define PNG_WRITE_hIST_SUPPORTED |
| 611 | # ifndef PNG_hIST_SUPPORTED |
| 612 | # define PNG_hIST_SUPPORTED |
| 613 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 614 | #endif |
| 615 | #ifndef PNG_NO_WRITE_iCCP |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 616 | # define PNG_WRITE_iCCP_SUPPORTED |
| 617 | # ifndef PNG_iCCP_SUPPORTED |
| 618 | # define PNG_iCCP_SUPPORTED |
| 619 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 620 | #endif |
| 621 | #ifndef PNG_NO_WRITE_iTXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 622 | # define PNG_WRITE_iTXt_SUPPORTED |
| 623 | # ifndef PNG_iTXt_SUPPORTED |
| 624 | # define PNG_iTXt_SUPPORTED |
| 625 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 626 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 627 | #ifndef PNG_NO_WRITE_oFFs |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 628 | # define PNG_WRITE_oFFs_SUPPORTED |
| 629 | # ifndef PNG_oFFs_SUPPORTED |
| 630 | # define PNG_oFFs_SUPPORTED |
| 631 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 632 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 633 | #ifndef PNG_NO_WRITE_pCAL |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 634 | # define PNG_WRITE_pCAL_SUPPORTED |
| 635 | # ifndef PNG_pCAL_SUPPORTED |
| 636 | # define PNG_pCAL_SUPPORTED |
| 637 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 638 | #endif |
| 639 | #ifndef PNG_NO_WRITE_sCAL |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 640 | # define PNG_WRITE_sCAL_SUPPORTED |
| 641 | # ifndef PNG_sCAL_SUPPORTED |
| 642 | # define PNG_sCAL_SUPPORTED |
| 643 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 644 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 645 | #ifndef PNG_NO_WRITE_pHYs |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 646 | # define PNG_WRITE_pHYs_SUPPORTED |
| 647 | # ifndef PNG_pHYs_SUPPORTED |
| 648 | # define PNG_pHYs_SUPPORTED |
| 649 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 650 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 651 | #ifndef PNG_NO_WRITE_sBIT |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 652 | # define PNG_WRITE_sBIT_SUPPORTED |
| 653 | # ifndef PNG_sBIT_SUPPORTED |
| 654 | # define PNG_sBIT_SUPPORTED |
| 655 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 656 | #endif |
| 657 | #ifndef PNG_NO_WRITE_sPLT |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 658 | # define PNG_WRITE_sPLT_SUPPORTED |
| 659 | # ifndef PNG_sPLT_SUPPORTED |
| 660 | # define PNG_sPLT_SUPPORTED |
| 661 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 662 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 663 | #ifndef PNG_NO_WRITE_sRGB |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 664 | # define PNG_WRITE_sRGB_SUPPORTED |
| 665 | # ifndef PNG_sRGB_SUPPORTED |
| 666 | # define PNG_sRGB_SUPPORTED |
| 667 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 668 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 669 | #ifndef PNG_NO_WRITE_tEXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 670 | # define PNG_WRITE_tEXt_SUPPORTED |
| 671 | # ifndef PNG_tEXt_SUPPORTED |
| 672 | # define PNG_tEXt_SUPPORTED |
| 673 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 674 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 675 | #ifndef PNG_NO_WRITE_tIME |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 676 | # define PNG_WRITE_tIME_SUPPORTED |
| 677 | # ifndef PNG_tIME_SUPPORTED |
| 678 | # define PNG_tIME_SUPPORTED |
| 679 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 680 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 681 | #ifndef PNG_NO_WRITE_tRNS |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 682 | # define PNG_WRITE_tRNS_SUPPORTED |
| 683 | # ifndef PNG_tRNS_SUPPORTED |
| 684 | # define PNG_tRNS_SUPPORTED |
| 685 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 686 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 687 | #ifndef PNG_NO_WRITE_zTXt |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 688 | # define PNG_WRITE_zTXt_SUPPORTED |
| 689 | # ifndef PNG_zTXt_SUPPORTED |
| 690 | # define PNG_zTXt_SUPPORTED |
| 691 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 692 | #endif |
| 693 | #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 694 | # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED |
| 695 | # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED |
| 696 | # define PNG_UNKNOWN_CHUNKS_SUPPORTED |
| 697 | # endif |
| 698 | # ifndef PNG_NO_HANDLE_AS_UNKNOWN |
| 699 | # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED |
| 700 | # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED |
| 701 | # endif |
| 702 | # endif |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 703 | #endif |
| 704 | #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ |
| 705 | defined(PNG_WRITE_zTXt_SUPPORTED) |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 706 | # define PNG_WRITE_TEXT_SUPPORTED |
| 707 | # ifndef PNG_TEXT_SUPPORTED |
| 708 | # define PNG_TEXT_SUPPORTED |
| 709 | # endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 710 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 711 | #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 712 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 713 | /* Turn this off to disable png_read_png() and |
| 714 | * png_write_png() and leave the image_bits member |
| 715 | * out of the info structure. |
| 716 | */ |
| 717 | #ifndef PNG_NO_INFO_IMAGE |
| 718 | # define PNG_INFO_IMAGE_SUPPORTED |
| 719 | #endif |
| 720 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 721 | /* need the time information for reading tIME chunks */ |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 722 | #if defined(PNG_tIME_SUPPORTED) |
| 723 | # include <time.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 724 | #endif |
| 725 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 726 | /* Some typedefs to get us started. These should be safe on most of the |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 727 | * common platforms. The typedefs should be at least as large as the |
| 728 | * numbers suggest (a png_uint_32 must be at least 32 bits long), but they |
| 729 | * don't have to be exactly that size. Some compilers dislike passing |
| 730 | * unsigned shorts as function parameters, so you may be better off using |
| 731 | * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may |
| 732 | * want to have unsigned int for png_uint_32 instead of unsigned long. |
| 733 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 734 | |
| 735 | typedef unsigned long png_uint_32; |
| 736 | typedef long png_int_32; |
| 737 | typedef unsigned short png_uint_16; |
| 738 | typedef short png_int_16; |
| 739 | typedef unsigned char png_byte; |
| 740 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 741 | /* This is usually size_t. It is typedef'ed just in case you need it to |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 742 | change (I'm not sure if you will or not, so I thought I'd be safe) */ |
| 743 | typedef size_t png_size_t; |
| 744 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 745 | /* The following is needed for medium model support. It cannot be in the |
| 746 | * PNG_INTERNAL section. Needs modification for other compilers besides |
| 747 | * MSC. Model independent support declares all arrays and pointers to be |
| 748 | * large using the far keyword. The zlib version used must also support |
| 749 | * model independent data. As of version zlib 1.0.4, the necessary changes |
| 750 | * have been made in zlib. The USE_FAR_KEYWORD define triggers other |
| 751 | * changes that are needed. (Tim Wegner) |
| 752 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 753 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 754 | /* Separate compiler dependencies (problem here is that zlib.h always |
| 755 | defines FAR. (SJT) */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 756 | #ifdef __BORLANDC__ |
| 757 | #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) |
| 758 | #define LDATA 1 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 759 | #else |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 760 | #define LDATA 0 |
| 761 | #endif |
| 762 | |
| 763 | #if !defined(__WIN32__) && !defined(__FLAT__) |
| 764 | #define PNG_MAX_MALLOC_64K |
| 765 | #if (LDATA != 1) |
| 766 | #ifndef FAR |
| 767 | #define FAR __far |
| 768 | #endif |
| 769 | #define USE_FAR_KEYWORD |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 770 | #endif /* LDATA != 1 */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 771 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 772 | /* Possibly useful for moving data out of default segment. |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 773 | * Uncomment it if you want. Could also define FARDATA as |
| 774 | * const if your compiler supports it. (SJT) |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 775 | # define FARDATA FAR |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 776 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 777 | #endif /* __WIN32__, __FLAT__ */ |
| 778 | |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 779 | #endif /* __BORLANDC__ */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 780 | |
| 781 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 782 | /* Suggest testing for specific compiler first before testing for |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 783 | * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, |
| 784 | * making reliance oncertain keywords suspect. (SJT) |
| 785 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 786 | |
| 787 | /* MSC Medium model */ |
| 788 | #if defined(FAR) |
| 789 | # if defined(M_I86MM) |
| 790 | # define USE_FAR_KEYWORD |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 791 | # define FARDATA FAR |
| 792 | # include <dos.h> |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 793 | # endif |
| 794 | #endif |
| 795 | |
| 796 | /* SJT: default case */ |
| 797 | #ifndef FAR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 798 | # define FAR |
| 799 | #endif |
| 800 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 801 | /* At this point FAR is always defined */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 802 | #ifndef FARDATA |
| 803 | #define FARDATA |
| 804 | #endif |
| 805 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 806 | /* Typedef for floating-point numbers that are converted |
| 807 | to fixed-point with a multiple of 100,000, e.g., int_gamma */ |
| 808 | typedef png_int_32 png_fixed_point; |
| 809 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 810 | /* Add typedefs for pointers */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 811 | typedef void FAR * png_voidp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 812 | typedef png_byte FAR * png_bytep; |
| 813 | typedef png_uint_32 FAR * png_uint_32p; |
| 814 | typedef png_int_32 FAR * png_int_32p; |
| 815 | typedef png_uint_16 FAR * png_uint_16p; |
| 816 | typedef png_int_16 FAR * png_int_16p; |
| 817 | typedef PNG_CONST char FAR * png_const_charp; |
| 818 | typedef char FAR * png_charp; |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 819 | typedef png_fixed_point FAR * png_fixed_point_p; |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 820 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 821 | typedef double FAR * png_doublep; |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 822 | #endif |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 823 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 824 | /* Pointers to pointers; i.e. arrays */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 825 | typedef png_byte FAR * FAR * png_bytepp; |
| 826 | typedef png_uint_32 FAR * FAR * png_uint_32pp; |
| 827 | typedef png_int_32 FAR * FAR * png_int_32pp; |
| 828 | typedef png_uint_16 FAR * FAR * png_uint_16pp; |
| 829 | typedef png_int_16 FAR * FAR * png_int_16pp; |
| 830 | typedef PNG_CONST char FAR * FAR * png_const_charpp; |
| 831 | typedef char FAR * FAR * png_charpp; |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 832 | typedef png_fixed_point FAR * FAR * png_fixed_point_pp; |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 833 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 834 | typedef double FAR * FAR * png_doublepp; |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 835 | #endif |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 836 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 837 | /* Pointers to pointers to pointers; i.e. pointer to array */ |
| 838 | typedef char FAR * FAR * FAR * png_charppp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 839 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 840 | /* libpng typedefs for types in zlib. If zlib changes |
| 841 | * or another compression library is used, then change these. |
| 842 | * Eliminates need to change all the source files. |
| 843 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 844 | typedef charf * png_zcharp; |
| 845 | typedef charf * FAR * png_zcharpp; |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 846 | typedef z_stream FAR * png_zstreamp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 847 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 848 | |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 849 | #ifndef PNG_EXPORT |
| 850 | /* allow for compilation as dll under MS Windows */ |
| 851 | # ifdef __WIN32DLL__ |
| 852 | # define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol |
| 853 | # endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 854 | |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 855 | /* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */ |
| 856 | # ifdef ALT_WIN32_DLL |
| 857 | # define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol |
| 858 | # endif |
| 859 | |
| 860 | /* allow for compilation as dll with Borland C++ 5.0 */ |
| 861 | # if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__) |
| 862 | # define PNG_EXPORT(type,symbol) type _export symbol |
| 863 | # endif |
| 864 | |
| 865 | /* allow for compilation as shared lib under BeOS */ |
| 866 | # ifdef __BEOSDLL__ |
| 867 | # define PNG_EXPORT(type,symbol) __declspec(export) type symbol |
| 868 | # endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 869 | #endif |
| 870 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 871 | #ifndef PNG_EXPORT |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 872 | # define PNG_EXPORT(type,symbol) type symbol |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 873 | #endif |
| 874 | |
Glenn Randers-Pehrson | 074af5e | 1999-11-28 23:32:18 -0600 | [diff] [blame] | 875 | #if defined(__MINGW32__) || defined(__CYGWIN32__) |
| 876 | # define PNG_ATTR_DLLIMP |
| 877 | #endif |
| 878 | |
| 879 | #ifndef PNG_EXPORT_VAR |
| 880 | # ifdef PNG_DECL_DLLEXP |
| 881 | # define PNG_EXPORT_VAR(type) extern __declspec(dllexport) type |
| 882 | # endif |
| 883 | # ifdef PNG_ATTR_DLLEXP |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 884 | # define PNG_EXPORT_VAR(type) extern type __attribute__((dllexport)) |
Glenn Randers-Pehrson | 074af5e | 1999-11-28 23:32:18 -0600 | [diff] [blame] | 885 | # endif |
| 886 | # ifdef PNG_DECL_DLLIMP |
| 887 | # define PNG_EXPORT_VAR(type) extern __declspec(dllimport) type |
| 888 | # endif |
| 889 | # ifdef PNG_ATTR_DLLIMP |
| 890 | # define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport)) |
| 891 | # endif |
| 892 | #endif |
| 893 | |
| 894 | #ifndef PNG_EXPORT_VAR |
| 895 | # define PNG_EXPORT_VAR(type) extern type |
| 896 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 897 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 898 | /* User may want to use these so not in PNG_INTERNAL. Any library functions |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 899 | * that are passed far data must be model independent. |
| 900 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 901 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame^] | 902 | #ifndef PNG_ABORT |
| 903 | # define PNG_ABORT() abort() |
| 904 | #endif |
| 905 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 906 | #if defined(USE_FAR_KEYWORD) /* memory model independent fns */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 907 | /* use this to make far-to-near assignments */ |
| 908 | # define CHECK 1 |
| 909 | # define NOCHECK 0 |
Glenn Randers-Pehrson | a357b99 | 1998-02-08 20:56:40 -0600 | [diff] [blame] | 910 | # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) |
| 911 | # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 912 | # define png_strcpy _fstrcpy |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 913 | # define png_strlen _fstrlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 914 | # define png_memcmp _fmemcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 915 | # define png_memcpy _fmemcpy |
| 916 | # define png_memset _fmemset |
| 917 | #else /* use the usual functions */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 918 | # define CVT_PTR(ptr) (ptr) |
| 919 | # define CVT_PTR_NOCHECK(ptr) (ptr) |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 920 | # define png_strcpy strcpy |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 921 | # define png_strlen strlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 922 | # define png_memcmp memcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 923 | # define png_memcpy memcpy |
| 924 | # define png_memset memset |
| 925 | #endif |
| 926 | /* End of memory model independent support */ |
| 927 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 928 | /* Just a little check that someone hasn't tried to define something |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 929 | * contradictory. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 930 | */ |
| 931 | #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K) |
| 932 | #undef PNG_ZBUF_SIZE |
| 933 | #define PNG_ZBUF_SIZE 65536 |
| 934 | #endif |
| 935 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 936 | #endif /* PNGCONF_H */ |
| 937 | |