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