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