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