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