Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -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 | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame^] | 4 | * libpng 1.0.4 - September 18, 1999 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 5 | * For conditions of distribution and use, see copyright notice in png.h |
| 6 | * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. |
| 7 | * Copyright (c) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | 87544ac | 1999-01-13 22:06:39 -0600 | [diff] [blame] | 8 | * Copyright (c) 1998, 1999 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 9 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 10 | |
| 11 | /* Any machine specific code is near the front of this file, so if you |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 12 | * are configuring libpng for a machine, you may want to read the section |
| 13 | * starting here down to where it starts to typedef png_color, png_text, |
| 14 | * and png_info. |
| 15 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 16 | |
| 17 | #ifndef PNGCONF_H |
| 18 | #define PNGCONF_H |
| 19 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 20 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 21 | /* 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] | 22 | * an IDAT chunk. Make this whatever size you feel is best for your |
| 23 | * machine. One of these will be allocated per png_struct. When this |
| 24 | * 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] | 25 | * calculations. Making this an extremely small size will slow |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 26 | * the library down, but you may want to experiment to determine |
| 27 | * where it becomes significant, if you are concerned with memory |
| 28 | * usage. Note that zlib allocates at least 32Kb also. For readers, |
| 29 | * 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] | 30 | * Unless this gets smaller than the size of a row (compressed), |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 31 | * it should not make much difference how big this is. |
| 32 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 33 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 34 | #ifndef PNG_ZBUF_SIZE |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 35 | #define PNG_ZBUF_SIZE 8192 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 36 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 37 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 38 | /* 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] | 39 | * than 64K of memory at once, uncomment this. While libpng will not |
| 40 | * normally need that much memory in a chunk (unless you load up a very |
| 41 | * large file), zlib needs to know how big of a chunk it can use, and |
| 42 | * libpng thus makes sure to check any memory allocation to verify it |
| 43 | * will fit into memory. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 44 | #define PNG_MAX_MALLOC_64K |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 45 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 46 | #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) |
| 47 | #define PNG_MAX_MALLOC_64K |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 48 | #endif |
| 49 | |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 50 | /* This protects us against compilers that run on a windowing system |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 51 | * and thus don't have or would rather us not use the stdio types: |
| 52 | * stdin, stdout, and stderr. The only one currently used is stderr |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 53 | * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will |
| 54 | * prevent these from being compiled and used. #defining PNG_NO_STDIO |
| 55 | * will also prevent these, plus will prevent the entire set of stdio |
| 56 | * macros and functions (FILE *, printf, etc.) from being compiled and used, |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 57 | * unless (PNG_DEBUG > 0) has been #defined. |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 58 | * |
| 59 | * #define PNG_NO_CONSOLE_IO |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 60 | * #define PNG_NO_STDIO |
| 61 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 62 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 63 | # ifdef PNG_NO_STDIO |
| 64 | # ifndef PNG_NO_CONSOLE_IO |
| 65 | # define PNG_NO_CONSOLE_IO |
| 66 | # endif |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 67 | # ifdef PNG_DEBUG |
| 68 | # if (PNG_DEBUG > 0) |
| 69 | # include <stdio.h> |
| 70 | # endif |
| 71 | # endif |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 72 | # else |
| 73 | # include <stdio.h> |
| 74 | # endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 75 | |
| 76 | /* This macro protects us against machines that don't have function |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 77 | * prototypes (ie K&R style headers). If your compiler does not handle |
| 78 | * function prototypes, define this macro and use the included ansi2knr. |
| 79 | * I've always been able to use _NO_PROTO as the indicator, but you may |
| 80 | * need to drag the empty declaration out in front of here, or change the |
| 81 | * ifdef to suit your own needs. |
| 82 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 83 | #ifndef PNGARG |
| 84 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 85 | #ifdef OF /* zlib prototype munger */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 86 | #define PNGARG(arglist) OF(arglist) |
| 87 | #else |
| 88 | |
| 89 | #ifdef _NO_PROTO |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 90 | #define PNGARG(arglist) () |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 91 | #else |
| 92 | #define PNGARG(arglist) arglist |
| 93 | #endif /* _NO_PROTO */ |
| 94 | |
| 95 | #endif /* OF */ |
| 96 | |
| 97 | #endif /* PNGARG */ |
| 98 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 99 | /* Try to determine if we are compiling on a Mac. Note that testing for |
| 100 | * just __MWERKS__ is not good enough, because the Codewarrior is now used |
| 101 | * on non-Mac platforms. |
| 102 | */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 103 | #ifndef MACOS |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 104 | #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 105 | defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 106 | #define MACOS |
| 107 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 108 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 109 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 110 | /* enough people need this for various reasons to include it here */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 111 | #if !defined(MACOS) && !defined(RISCOS) |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 112 | #include <sys/types.h> |
| 113 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 114 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 115 | /* This is an attempt to force a single setjmp behaviour on Linux. If |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 116 | * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. |
| 117 | */ |
| 118 | #ifdef __linux__ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 119 | #ifdef _BSD_SOURCE |
| 120 | #define _PNG_SAVE_BSD_SOURCE |
| 121 | #undef _BSD_SOURCE |
| 122 | #endif |
| 123 | #ifdef _SETJMP_H |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 124 | __png.h__ already includes setjmp.h |
| 125 | __dont__ include it again |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 126 | #endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 127 | #endif /* __linux__ */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 128 | |
| 129 | /* include setjmp.h for error handling */ |
| 130 | #include <setjmp.h> |
| 131 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 132 | #ifdef __linux__ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 133 | #ifdef _PNG_SAVE_BSD_SOURCE |
| 134 | #define _BSD_SOURCE |
| 135 | #undef _PNG_SAVE_BSD_SOURCE |
| 136 | #endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 137 | #endif /* __linux__ */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 138 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 139 | #ifdef BSD |
| 140 | #include <strings.h> |
| 141 | #else |
| 142 | #include <string.h> |
| 143 | #endif |
| 144 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 145 | /* Other defines for things like memory and the like can go here. */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 146 | #ifdef PNG_INTERNAL |
| 147 | #include <stdlib.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 148 | |
| 149 | /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which |
| 150 | * aren't usually used outside the library (as far as I know), so it is |
| 151 | * debatable if they should be exported at all. In the future, when it is |
| 152 | * possible to have run-time registry of chunk-handling functions, some of |
| 153 | * these will be made available again. |
| 154 | #define PNG_EXTERN extern |
| 155 | */ |
| 156 | #define PNG_EXTERN |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 157 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 158 | /* Other defines specific to compilers can go here. Try to keep |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 159 | * them inside an appropriate ifdef/endif pair for portability. |
| 160 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 161 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 162 | #if defined(MACOS) |
| 163 | /* We need to check that <math.h> hasn't already been included earlier |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 164 | * as it seems it doesn't agree with <fp.h>, yet we should really use |
| 165 | * <fp.h> if possible. |
| 166 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 167 | #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 168 | #include <fp.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 169 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 170 | #else |
| 171 | #include <math.h> |
| 172 | #endif |
| 173 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 174 | /* Codewarrior on NT has linking problems without this. */ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 175 | #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 176 | #define PNG_ALWAYS_EXTERN |
| 177 | #endif |
| 178 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 179 | /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 180 | * stdlib.h like it should (I think). Or perhaps this is a C++ |
| 181 | * "feature"? |
| 182 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 183 | #ifdef __TURBOC__ |
| 184 | #include <mem.h> |
| 185 | #include "alloc.h" |
| 186 | #endif |
| 187 | |
| 188 | #ifdef _MSC_VER |
| 189 | #include <malloc.h> |
| 190 | #endif |
| 191 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 192 | /* This controls how fine the dithering gets. As this allocates |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 193 | * a largish chunk of memory (32K), those who are not as concerned |
| 194 | * with dithering quality can decrease some or all of these. |
| 195 | */ |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 196 | #ifndef PNG_DITHER_RED_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 197 | #define PNG_DITHER_RED_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 198 | #endif |
| 199 | #ifndef PNG_DITHER_GREEN_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 200 | #define PNG_DITHER_GREEN_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 201 | #endif |
| 202 | #ifndef PNG_DITHER_BLUE_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 203 | #define PNG_DITHER_BLUE_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 204 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 205 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 206 | /* This controls how fine the gamma correction becomes when you |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 207 | * are only interested in 8 bits anyway. Increasing this value |
| 208 | * results in more memory being used, and more pow() functions |
| 209 | * being called to fill in the gamma tables. Don't set this value |
| 210 | * less then 8, and even that may not work (I haven't tested it). |
| 211 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 212 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 213 | #ifndef PNG_MAX_GAMMA_8 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 214 | #define PNG_MAX_GAMMA_8 11 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 215 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 216 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 217 | /* This controls how much a difference in gamma we can tolerate before |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 218 | * we actually start doing gamma conversion. |
| 219 | */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 220 | #ifndef PNG_GAMMA_THRESHOLD |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 221 | #define PNG_GAMMA_THRESHOLD 0.05 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 222 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 223 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 224 | #endif /* PNG_INTERNAL */ |
| 225 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 226 | /* The following uses const char * instead of char * for error |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 227 | * and warning message functions, so some compilers won't complain. |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 228 | * 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] | 229 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 230 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 231 | #ifndef PNG_NO_CONST |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 232 | # define PNG_CONST const |
| 233 | #else |
| 234 | # define PNG_CONST |
| 235 | #endif |
| 236 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 237 | /* 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] | 238 | * library that you will not be using. I wish I could figure out how to |
| 239 | * automate this, but I can't do that without making it seriously hard |
| 240 | * on the users. So if you are not using an ability, change the #define |
| 241 | * to and #undef, and that part of the library will not be compiled. If |
| 242 | * your linker can't find a function, you may want to make sure the |
| 243 | * ability is defined here. Some of these depend upon some others being |
| 244 | * defined. I haven't figured out all the interactions here, so you may |
| 245 | * have to experiment awhile to get everything to compile. If you are |
| 246 | * creating or using a shared library, you probably shouldn't touch this, |
| 247 | * as it will affect the size of the structures, and this will cause bad |
| 248 | * things to happen if the library and/or application ever change. |
| 249 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 250 | |
| 251 | /* Any transformations you will not be using can be undef'ed here */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 252 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 253 | /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 254 | to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS |
| 255 | on the compile line, then pick and choose which ones to define without |
| 256 | having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED |
| 257 | if you only want to have a png-compliant reader/writer but don't need |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 258 | any of the extra transformations. This saves about 80 kbytes in a |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 259 | typical installation of the library. (PNG_NO_* form added in version |
| 260 | 1.0.1c, for consistency) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 261 | */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 262 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 263 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 264 | #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ |
| 265 | !defined(PNG_NO_READ_TRANSFORMS) |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 266 | #define PNG_READ_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 267 | #endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 268 | #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ |
| 269 | !defined(PNG_NO_WRITE_TRANSFORMS) |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 270 | #define PNG_WRITE_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 271 | #endif |
| 272 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 273 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 274 | #ifndef PNG_NO_READ_EXPAND |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 275 | #define PNG_READ_EXPAND_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 276 | #endif |
| 277 | #ifndef PNG_NO_READ_SHIFT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 278 | #define PNG_READ_SHIFT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 279 | #endif |
| 280 | #ifndef PNG_NO_READ_PACK |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 281 | #define PNG_READ_PACK_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 282 | #endif |
| 283 | #ifndef PNG_NO_READ_BGR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 284 | #define PNG_READ_BGR_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 285 | #endif |
| 286 | #ifndef PNG_NO_READ_SWAP |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 287 | #define PNG_READ_SWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 288 | #endif |
| 289 | #ifndef PNG_NO_READ_PACKSWAP |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 290 | #define PNG_READ_PACKSWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 291 | #endif |
| 292 | #ifndef PNG_NO_READ_INVERT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 293 | #define PNG_READ_INVERT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 294 | #endif |
| 295 | #ifndef PNG_NO_READ_DITHER |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 296 | #define PNG_READ_DITHER_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 297 | #endif |
| 298 | #ifndef PNG_NO_READ_BACKGROUND |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 299 | #define PNG_READ_BACKGROUND_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 300 | #endif |
| 301 | #ifndef PNG_NO_READ_16_TO_8 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 302 | #define PNG_READ_16_TO_8_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 303 | #endif |
| 304 | #ifndef PNG_NO_READ_FILLER |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 305 | #define PNG_READ_FILLER_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 306 | #endif |
| 307 | #ifndef PNG_NO_READ_GAMMA |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 308 | #define PNG_READ_GAMMA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 309 | #endif |
| 310 | #ifndef PNG_NO_READ_GRAY_TO_RGB |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 311 | #define PNG_READ_GRAY_TO_RGB_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 312 | #endif |
| 313 | #ifndef PNG_NO_READ_SWAP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 314 | #define PNG_READ_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 315 | #endif |
| 316 | #ifndef PNG_NO_READ_INVERT_ALPHA |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 317 | #define PNG_READ_INVERT_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 318 | #endif |
| 319 | #ifndef PNG_NO_READ_STRIP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 320 | #define PNG_READ_STRIP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 321 | #endif |
| 322 | #ifndef PNG_NO_READ_USER_TRANSFORM |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 323 | #define PNG_READ_USER_TRANSFORM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 324 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 325 | #ifndef PNG_NO_READ_RGB_TO_GRAY |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 326 | #define PNG_READ_RGB_TO_GRAY_SUPPORTED |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 327 | #endif |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 328 | #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 329 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 330 | #if !defined(PNG_NO_PROGRESSIVE_READ) && \ |
| 331 | !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 332 | #define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ |
| 333 | #endif /* about interlacing capability! You'll */ |
| 334 | /* still have interlacing unless you change the following line: */ |
| 335 | #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 336 | |
| 337 | #ifndef PNG_NO_READ_COMPOSITED_NODIV |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 338 | #define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 339 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 340 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 341 | #ifndef PNG_NO_READ_EMPTY_PLTE |
| 342 | #define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */ |
| 343 | #endif |
| 344 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 345 | #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 346 | #ifndef PNG_NO_WRITE_SHIFT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 347 | #define PNG_WRITE_SHIFT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 348 | #endif |
| 349 | #ifndef PNG_NO_WRITE_PACK |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 350 | #define PNG_WRITE_PACK_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 351 | #endif |
| 352 | #ifndef PNG_NO_WRITE_BGR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 353 | #define PNG_WRITE_BGR_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 354 | #endif |
| 355 | #ifndef PNG_NO_WRITE_SWAP |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 356 | #define PNG_WRITE_SWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 357 | #endif |
| 358 | #ifndef PNG_NO_WRITE_PACKSWAP |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 359 | #define PNG_WRITE_PACKSWAP_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 360 | #endif |
| 361 | #ifndef PNG_NO_WRITE_INVERT |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 362 | #define PNG_WRITE_INVERT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 363 | #endif |
| 364 | #ifndef PNG_NO_WRITE_FILLER |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 365 | #define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 366 | #endif |
| 367 | #ifndef PNG_NO_WRITE_SWAP_ALPHA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 368 | #define PNG_WRITE_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 369 | #endif |
| 370 | #ifndef PNG_NO_WRITE_INVERT_ALPHA |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 371 | #define PNG_WRITE_INVERT_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 372 | #endif |
| 373 | #ifndef PNG_NO_WRITE_USER_TRANSFORM |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 374 | #define PNG_WRITE_USER_TRANSFORM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 375 | #endif |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 376 | #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 377 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 378 | #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant |
| 379 | encoders, but can cause trouble |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 380 | if left undefined */ |
| 381 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 382 | #ifndef PNG_NO_WRITE_WEIGHTED_FILTER |
| 383 | #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED |
| 384 | #endif |
| 385 | |
| 386 | #ifndef PNG_NO_WRITE_FLUSH |
| 387 | #define PNG_WRITE_FLUSH_SUPPORTED |
| 388 | #endif |
| 389 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 390 | #ifndef PNG_NO_WRITE_EMPTY_PLTE |
| 391 | #define PNG_WRITE_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */ |
| 392 | #endif |
| 393 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 394 | #ifndef PNG_NO_STDIO |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 395 | #define PNG_TIME_RFC1123_SUPPORTED |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 396 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 397 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 398 | /* This adds extra functions in pngget.c for accessing data from the |
| 399 | * info pointer (added in version 0.99) |
| 400 | * png_get_image_width() |
| 401 | * png_get_image_height() |
| 402 | * png_get_bit_depth() |
| 403 | * png_get_color_type() |
| 404 | * png_get_compression_type() |
| 405 | * png_get_filter_type() |
| 406 | * png_get_interlace_type() |
| 407 | * png_get_pixel_aspect_ratio() |
| 408 | * png_get_pixels_per_meter() |
| 409 | * png_get_x_offset_pixels() |
| 410 | * png_get_y_offset_pixels() |
| 411 | * png_get_x_offset_microns() |
| 412 | * png_get_y_offset_microns() |
| 413 | */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 414 | #ifndef PNG_NO_EASY_ACCESS |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 415 | #define PNG_EASY_ACCESS_SUPPORTED |
| 416 | #endif |
| 417 | |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 418 | #ifndef PNG_NO_ASSEMBLER_CODE |
| 419 | #define PNG_ASSEMBLER_CODE_SUPPORTED |
| 420 | #endif |
| 421 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 422 | /* These are currently experimental features, define them if you want */ |
| 423 | |
| 424 | /* very little testing */ |
| 425 | /* |
Glenn Randers-Pehrson | cbe52d8 | 1998-02-28 07:00:24 -0600 | [diff] [blame] | 426 | #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 427 | #define PNG_USER_MEM_SUPPORTED |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 428 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 429 | |
| 430 | /* This is only for PowerPC big-endian and 680x0 systems */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 431 | /* some testing */ |
| 432 | /* |
| 433 | #define PNG_READ_BIG_ENDIAN_SUPPORTED |
| 434 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 435 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 436 | /* These functions are turned off by default, as they will be phased out. */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 437 | /* |
| 438 | #define PNG_USELESS_TESTS_SUPPORTED |
| 439 | #define PNG_CORRECT_PALETTE_SUPPORTED |
| 440 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 441 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 442 | /* Any chunks you are not interested in, you can undef here. The |
| 443 | * ones that allocate memory may be expecially important (hIST, |
| 444 | * 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] | 445 | * a bit smaller. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 446 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 447 | |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 448 | #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ |
| 449 | !defined(PNG_NO_READ_ANCILLARY_CHUNKS) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 450 | #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
| 451 | #endif |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 452 | #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ |
| 453 | !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 454 | #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
| 455 | #endif |
| 456 | |
| 457 | #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 458 | #ifndef PNG_NO_READ_bKGD |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 459 | #define PNG_READ_bKGD_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 460 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 461 | #ifndef PNG_NO_READ_cHRM |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 462 | #define PNG_READ_cHRM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 463 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 464 | #ifndef PNG_NO_READ_gAMA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 465 | #define PNG_READ_gAMA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 466 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 467 | #ifndef PNG_NO_READ_hIST |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 468 | #define PNG_READ_hIST_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 469 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 470 | #ifndef PNG_NO_READ_oFFs |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 471 | #define PNG_READ_oFFs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 472 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 473 | #ifndef PNG_NO_READ_pCAL |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 474 | #define PNG_READ_pCAL_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 475 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 476 | #ifndef PNG_NO_READ_pHYs |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 477 | #define PNG_READ_pHYs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 478 | #endif |
| 479 | #ifndef PNG_NO_READ_sBIT |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 480 | #define PNG_READ_sBIT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 481 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 482 | #ifndef PNG_NO_READ_sRGB |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 483 | #define PNG_READ_sRGB_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 484 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 485 | #ifndef PNG_NO_READ_tEXt |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 486 | #define PNG_READ_tEXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 487 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 488 | #ifndef PNG_NO_READ_tIME |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 489 | #define PNG_READ_tIME_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 490 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 491 | #ifndef PNG_NO_READ_tRNS |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 492 | #define PNG_READ_tRNS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 493 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 494 | #ifndef PNG_NO_READ_zTXt |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 495 | #define PNG_READ_zTXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 496 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 497 | #ifndef PNG_NO_READ_OPT_PLTE |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 498 | #define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */ |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 499 | #endif /* PLTE chunk in RGB and RGBA images */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 500 | #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 501 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 502 | #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 503 | #ifndef PNG_NO_WRITE_bKGD |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 504 | #define PNG_WRITE_bKGD_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 505 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 506 | #ifndef PNG_NO_WRITE_cHRM |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 507 | #define PNG_WRITE_cHRM_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 508 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 509 | #ifndef PNG_NO_WRITE_gAMA |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 510 | #define PNG_WRITE_gAMA_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 511 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 512 | #ifndef PNG_NO_WRITE_hIST |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 513 | #define PNG_WRITE_hIST_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 514 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 515 | #ifndef PNG_NO_WRITE_oFFs |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 516 | #define PNG_WRITE_oFFs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 517 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 518 | #ifndef PNG_NO_WRITE_pCAL |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 519 | #define PNG_WRITE_pCAL_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 520 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 521 | #ifndef PNG_NO_WRITE_pHYs |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 522 | #define PNG_WRITE_pHYs_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 523 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 524 | #ifndef PNG_NO_WRITE_sBIT |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 525 | #define PNG_WRITE_sBIT_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 526 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 527 | #ifndef PNG_NO_WRITE_sRGB |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 528 | #define PNG_WRITE_sRGB_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 529 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 530 | #ifndef PNG_NO_WRITE_tEXt |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 531 | #define PNG_WRITE_tEXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 532 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 533 | #ifndef PNG_NO_WRITE_tIME |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 534 | #define PNG_WRITE_tIME_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 535 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 536 | #ifndef PNG_NO_WRITE_tRNS |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 537 | #define PNG_WRITE_tRNS_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 538 | #endif |
Glenn Randers-Pehrson | 8686fff | 1998-05-21 09:27:50 -0500 | [diff] [blame] | 539 | #ifndef PNG_NO_WRITE_zTXt |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 540 | #define PNG_WRITE_zTXt_SUPPORTED |
Glenn Randers-Pehrson | d0dce40 | 1998-05-09 10:02:29 -0500 | [diff] [blame] | 541 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 542 | #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 543 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 544 | /* need the time information for reading tIME chunks */ |
| 545 | #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED) |
| 546 | #include <time.h> |
| 547 | #endif |
| 548 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 549 | /* 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] | 550 | * common platforms. The typedefs should be at least as large as the |
| 551 | * numbers suggest (a png_uint_32 must be at least 32 bits long), but they |
| 552 | * don't have to be exactly that size. Some compilers dislike passing |
| 553 | * unsigned shorts as function parameters, so you may be better off using |
| 554 | * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may |
| 555 | * want to have unsigned int for png_uint_32 instead of unsigned long. |
| 556 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 557 | |
| 558 | typedef unsigned long png_uint_32; |
| 559 | typedef long png_int_32; |
| 560 | typedef unsigned short png_uint_16; |
| 561 | typedef short png_int_16; |
| 562 | typedef unsigned char png_byte; |
| 563 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 564 | /* This is usually size_t. It is typedef'ed just in case you need it to |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 565 | change (I'm not sure if you will or not, so I thought I'd be safe) */ |
| 566 | typedef size_t png_size_t; |
| 567 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 568 | /* The following is needed for medium model support. It cannot be in the |
| 569 | * PNG_INTERNAL section. Needs modification for other compilers besides |
| 570 | * MSC. Model independent support declares all arrays and pointers to be |
| 571 | * large using the far keyword. The zlib version used must also support |
| 572 | * model independent data. As of version zlib 1.0.4, the necessary changes |
| 573 | * have been made in zlib. The USE_FAR_KEYWORD define triggers other |
| 574 | * changes that are needed. (Tim Wegner) |
| 575 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 576 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 577 | /* Separate compiler dependencies (problem here is that zlib.h always |
| 578 | defines FAR. (SJT) */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 579 | #ifdef __BORLANDC__ |
| 580 | #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) |
| 581 | #define LDATA 1 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 582 | #else |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 583 | #define LDATA 0 |
| 584 | #endif |
| 585 | |
| 586 | #if !defined(__WIN32__) && !defined(__FLAT__) |
| 587 | #define PNG_MAX_MALLOC_64K |
| 588 | #if (LDATA != 1) |
| 589 | #ifndef FAR |
| 590 | #define FAR __far |
| 591 | #endif |
| 592 | #define USE_FAR_KEYWORD |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 593 | #endif /* LDATA != 1 */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 594 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 595 | /* Possibly useful for moving data out of default segment. |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 596 | * Uncomment it if you want. Could also define FARDATA as |
| 597 | * const if your compiler supports it. (SJT) |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 598 | # define FARDATA FAR |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 599 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 600 | #endif /* __WIN32__, __FLAT__ */ |
| 601 | |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 602 | #endif /* __BORLANDC__ */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 603 | |
| 604 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 605 | /* Suggest testing for specific compiler first before testing for |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 606 | * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, |
| 607 | * making reliance oncertain keywords suspect. (SJT) |
| 608 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 609 | |
| 610 | /* MSC Medium model */ |
| 611 | #if defined(FAR) |
| 612 | # if defined(M_I86MM) |
| 613 | # define USE_FAR_KEYWORD |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 614 | # define FARDATA FAR |
| 615 | # include <dos.h> |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 616 | # endif |
| 617 | #endif |
| 618 | |
| 619 | /* SJT: default case */ |
| 620 | #ifndef FAR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 621 | # define FAR |
| 622 | #endif |
| 623 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 624 | /* At this point FAR is always defined */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 625 | #ifndef FARDATA |
| 626 | #define FARDATA |
| 627 | #endif |
| 628 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 629 | /* Add typedefs for pointers */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 630 | typedef void FAR * png_voidp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 631 | typedef png_byte FAR * png_bytep; |
| 632 | typedef png_uint_32 FAR * png_uint_32p; |
| 633 | typedef png_int_32 FAR * png_int_32p; |
| 634 | typedef png_uint_16 FAR * png_uint_16p; |
| 635 | typedef png_int_16 FAR * png_int_16p; |
| 636 | typedef PNG_CONST char FAR * png_const_charp; |
| 637 | typedef char FAR * png_charp; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 638 | typedef double FAR * png_doublep; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 639 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 640 | /* Pointers to pointers; i.e. arrays */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 641 | typedef png_byte FAR * FAR * png_bytepp; |
| 642 | typedef png_uint_32 FAR * FAR * png_uint_32pp; |
| 643 | typedef png_int_32 FAR * FAR * png_int_32pp; |
| 644 | typedef png_uint_16 FAR * FAR * png_uint_16pp; |
| 645 | typedef png_int_16 FAR * FAR * png_int_16pp; |
| 646 | typedef PNG_CONST char FAR * FAR * png_const_charpp; |
| 647 | typedef char FAR * FAR * png_charpp; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 648 | typedef double FAR * FAR * png_doublepp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 649 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 650 | /* Pointers to pointers to pointers; i.e. pointer to array */ |
| 651 | typedef char FAR * FAR * FAR * png_charppp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 652 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 653 | /* libpng typedefs for types in zlib. If zlib changes |
| 654 | * or another compression library is used, then change these. |
| 655 | * Eliminates need to change all the source files. |
| 656 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 657 | typedef charf * png_zcharp; |
| 658 | typedef charf * FAR * png_zcharpp; |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 659 | typedef z_stream FAR * png_zstreamp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 660 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 661 | |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame^] | 662 | #ifndef PNG_EXPORT |
| 663 | /* allow for compilation as dll under MS Windows */ |
| 664 | # ifdef __WIN32DLL__ |
| 665 | # define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol |
| 666 | # endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 667 | |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame^] | 668 | /* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */ |
| 669 | # ifdef ALT_WIN32_DLL |
| 670 | # define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol |
| 671 | # endif |
| 672 | |
| 673 | /* allow for compilation as dll with Borland C++ 5.0 */ |
| 674 | # if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__) |
| 675 | # define PNG_EXPORT(type,symbol) type _export symbol |
| 676 | # endif |
| 677 | |
| 678 | /* allow for compilation as shared lib under BeOS */ |
| 679 | # ifdef __BEOSDLL__ |
| 680 | # define PNG_EXPORT(type,symbol) __declspec(export) type symbol |
| 681 | # endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 682 | #endif |
| 683 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 684 | #ifndef PNG_EXPORT |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame^] | 685 | # define PNG_EXPORT(type,symbol) type symbol |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 686 | #endif |
| 687 | |
| 688 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 689 | /* User may want to use these so not in PNG_INTERNAL. Any library functions |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 690 | * that are passed far data must be model independent. |
| 691 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 692 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 693 | #if defined(USE_FAR_KEYWORD) /* memory model independent fns */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 694 | /* use this to make far-to-near assignments */ |
| 695 | # define CHECK 1 |
| 696 | # define NOCHECK 0 |
Glenn Randers-Pehrson | a357b99 | 1998-02-08 20:56:40 -0600 | [diff] [blame] | 697 | # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) |
| 698 | # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 699 | # define png_strcpy _fstrcpy |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 700 | # define png_strlen _fstrlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 701 | # define png_memcmp _fmemcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 702 | # define png_memcpy _fmemcpy |
| 703 | # define png_memset _fmemset |
| 704 | #else /* use the usual functions */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 705 | # define CVT_PTR(ptr) (ptr) |
| 706 | # define CVT_PTR_NOCHECK(ptr) (ptr) |
Glenn Randers-Pehrson | f7d1a17 | 1998-06-06 15:31:35 -0500 | [diff] [blame] | 707 | # define png_strcpy strcpy |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 708 | # define png_strlen strlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 709 | # define png_memcmp memcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 710 | # define png_memcpy memcpy |
| 711 | # define png_memset memset |
| 712 | #endif |
| 713 | /* End of memory model independent support */ |
| 714 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 715 | /* Just a double check that someone hasn't tried to define something |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 716 | * contradictory. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 717 | */ |
| 718 | #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K) |
| 719 | #undef PNG_ZBUF_SIZE |
| 720 | #define PNG_ZBUF_SIZE 65536 |
| 721 | #endif |
| 722 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 723 | #endif /* PNGCONF_H */ |
| 724 | |