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