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 | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame^] | 4 | * libpng 1.0.1b |
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 | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 8 | * Copyright (c) 1998, Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame^] | 9 | * May 2, 1998 |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 10 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 11 | |
| 12 | /* 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] | 13 | * are configuring libpng for a machine, you may want to read the section |
| 14 | * starting here down to where it starts to typedef png_color, png_text, |
| 15 | * and png_info. |
| 16 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 17 | |
| 18 | #ifndef PNGCONF_H |
| 19 | #define PNGCONF_H |
| 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 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 50 | /* This protects us against compilers which 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 |
| 53 | * in png_error() and png_warning(). #defining PNG_NO_STDIO will |
| 54 | * prevent these from being compiled and used. |
| 55 | * #define PNG_NO_STDIO |
| 56 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 57 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 58 | #ifndef PNG_NO_STDIO |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 59 | #include <stdio.h> |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 60 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 61 | |
| 62 | /* This macro protects us against machines that don't have function |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 63 | * prototypes (ie K&R style headers). If your compiler does not handle |
| 64 | * function prototypes, define this macro and use the included ansi2knr. |
| 65 | * I've always been able to use _NO_PROTO as the indicator, but you may |
| 66 | * need to drag the empty declaration out in front of here, or change the |
| 67 | * ifdef to suit your own needs. |
| 68 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 69 | #ifndef PNGARG |
| 70 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 71 | #ifdef OF /* zlib prototype munger */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 72 | #define PNGARG(arglist) OF(arglist) |
| 73 | #else |
| 74 | |
| 75 | #ifdef _NO_PROTO |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 76 | #define PNGARG(arglist) () |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 77 | #else |
| 78 | #define PNGARG(arglist) arglist |
| 79 | #endif /* _NO_PROTO */ |
| 80 | |
| 81 | #endif /* OF */ |
| 82 | |
| 83 | #endif /* PNGARG */ |
| 84 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 85 | /* Try to determine if we are compiling on a Mac. Note that testing for |
| 86 | * just __MWERKS__ is not good enough, because the Codewarrior is now used |
| 87 | * on non-Mac platforms. |
| 88 | */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 89 | #ifndef MACOS |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 90 | #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 91 | defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 92 | #define MACOS |
| 93 | #endif |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 94 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 95 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 96 | /* enough people need this for various reasons to include it here */ |
Guy Schalnat | e5a3779 | 1996-06-05 15:50:50 -0500 | [diff] [blame] | 97 | #if !defined(MACOS) && !defined(RISCOS) |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 98 | #include <sys/types.h> |
| 99 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 100 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 101 | /* 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] | 102 | * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. |
| 103 | */ |
| 104 | #ifdef __linux__ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 105 | #ifdef _BSD_SOURCE |
| 106 | #define _PNG_SAVE_BSD_SOURCE |
| 107 | #undef _BSD_SOURCE |
| 108 | #endif |
| 109 | #ifdef _SETJMP_H |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 110 | __png.h__ already includes setjmp.h |
| 111 | __dont__ include it again |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 112 | #endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 113 | #endif /* __linux__ */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 114 | |
| 115 | /* include setjmp.h for error handling */ |
| 116 | #include <setjmp.h> |
| 117 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 118 | #ifdef __linux__ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 119 | #ifdef _PNG_SAVE_BSD_SOURCE |
| 120 | #define _BSD_SOURCE |
| 121 | #undef _PNG_SAVE_BSD_SOURCE |
| 122 | #endif |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 123 | #endif /* __linux__ */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 124 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 125 | #ifdef BSD |
| 126 | #include <strings.h> |
| 127 | #else |
| 128 | #include <string.h> |
| 129 | #endif |
| 130 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 131 | /* Other defines for things like memory and the like can go here. */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 132 | #ifdef PNG_INTERNAL |
| 133 | #include <stdlib.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 134 | |
| 135 | /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which |
| 136 | * aren't usually used outside the library (as far as I know), so it is |
| 137 | * debatable if they should be exported at all. In the future, when it is |
| 138 | * possible to have run-time registry of chunk-handling functions, some of |
| 139 | * these will be made available again. |
| 140 | #define PNG_EXTERN extern |
| 141 | */ |
| 142 | #define PNG_EXTERN |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 143 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 144 | /* Other defines specific to compilers can go here. Try to keep |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 145 | * them inside an appropriate ifdef/endif pair for portability. |
| 146 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 147 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 148 | #if defined(MACOS) |
| 149 | /* 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] | 150 | * as it seems it doesn't agree with <fp.h>, yet we should really use |
| 151 | * <fp.h> if possible. |
| 152 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 153 | #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 154 | #include <fp.h> |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 155 | #endif |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 156 | #else |
| 157 | #include <math.h> |
| 158 | #endif |
| 159 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 160 | /* Codewarrior on NT has linking problems without this. */ |
| 161 | #if defined(__MWERKS__) && defined(WIN32) |
| 162 | #define PNG_ALWAYS_EXTERN |
| 163 | #endif |
| 164 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 165 | /* 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] | 166 | * stdlib.h like it should (I think). Or perhaps this is a C++ |
| 167 | * "feature"? |
| 168 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 169 | #ifdef __TURBOC__ |
| 170 | #include <mem.h> |
| 171 | #include "alloc.h" |
| 172 | #endif |
| 173 | |
| 174 | #ifdef _MSC_VER |
| 175 | #include <malloc.h> |
| 176 | #endif |
| 177 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 178 | /* This controls how fine the dithering gets. As this allocates |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 179 | * a largish chunk of memory (32K), those who are not as concerned |
| 180 | * with dithering quality can decrease some or all of these. |
| 181 | */ |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 182 | #ifndef PNG_DITHER_RED_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 183 | #define PNG_DITHER_RED_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 184 | #endif |
| 185 | #ifndef PNG_DITHER_GREEN_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 186 | #define PNG_DITHER_GREEN_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 187 | #endif |
| 188 | #ifndef PNG_DITHER_BLUE_BITS |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 189 | #define PNG_DITHER_BLUE_BITS 5 |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 190 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 191 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 192 | /* This controls how fine the gamma correction becomes when you |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 193 | * are only interested in 8 bits anyway. Increasing this value |
| 194 | * results in more memory being used, and more pow() functions |
| 195 | * being called to fill in the gamma tables. Don't set this value |
| 196 | * less then 8, and even that may not work (I haven't tested it). |
| 197 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 198 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 199 | #ifndef PNG_MAX_GAMMA_8 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 200 | #define PNG_MAX_GAMMA_8 11 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 201 | #endif |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 202 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 203 | /* 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] | 204 | * we actually start doing gamma conversion. |
| 205 | */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 206 | #ifndef PNG_GAMMA_THRESHOLD |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 207 | #define PNG_GAMMA_THRESHOLD 0.05 |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 208 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 209 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 210 | #endif /* PNG_INTERNAL */ |
| 211 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 212 | /* The following uses const char * instead of char * for error |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 213 | * and warning message functions, so some compilers won't complain. |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 214 | * 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] | 215 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 216 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 217 | #ifndef PNG_NO_CONST |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 218 | # define PNG_CONST const |
| 219 | #else |
| 220 | # define PNG_CONST |
| 221 | #endif |
| 222 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 223 | /* 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] | 224 | * library that you will not be using. I wish I could figure out how to |
| 225 | * automate this, but I can't do that without making it seriously hard |
| 226 | * on the users. So if you are not using an ability, change the #define |
| 227 | * to and #undef, and that part of the library will not be compiled. If |
| 228 | * your linker can't find a function, you may want to make sure the |
| 229 | * ability is defined here. Some of these depend upon some others being |
| 230 | * defined. I haven't figured out all the interactions here, so you may |
| 231 | * have to experiment awhile to get everything to compile. If you are |
| 232 | * creating or using a shared library, you probably shouldn't touch this, |
| 233 | * as it will affect the size of the structures, and this will cause bad |
| 234 | * things to happen if the library and/or application ever change. |
| 235 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 236 | |
| 237 | /* 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] | 238 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 239 | /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user |
| 240 | to turn it off with "*TRANSFORMS_NOT_SUPPORTED" on the compile line, |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 241 | then pick and choose which ones to define without having to edit |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 242 | this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED if you |
| 243 | only want to have a png-compliant reader/writer but don't need |
| 244 | any of the extra transformations. This saves about 80 kbytes in a |
| 245 | typical installation of the library. |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 246 | */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 247 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 248 | |
| 249 | #ifndef PNG_READ_TRANSFORMS_NOT_SUPPORTED |
| 250 | #define PNG_READ_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 251 | #endif |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 252 | #ifndef PNG_WRITE_TRANSFORMS_NOT_SUPPORTED |
| 253 | #define PNG_WRITE_TRANSFORMS_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 254 | #endif |
| 255 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 256 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 257 | #define PNG_READ_EXPAND_SUPPORTED |
| 258 | #define PNG_READ_SHIFT_SUPPORTED |
| 259 | #define PNG_READ_PACK_SUPPORTED |
| 260 | #define PNG_READ_BGR_SUPPORTED |
| 261 | #define PNG_READ_SWAP_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 262 | #define PNG_READ_PACKSWAP_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 263 | #define PNG_READ_INVERT_SUPPORTED |
| 264 | #define PNG_READ_DITHER_SUPPORTED |
| 265 | #define PNG_READ_BACKGROUND_SUPPORTED |
| 266 | #define PNG_READ_16_TO_8_SUPPORTED |
| 267 | #define PNG_READ_FILLER_SUPPORTED |
| 268 | #define PNG_READ_GAMMA_SUPPORTED |
| 269 | #define PNG_READ_GRAY_TO_RGB_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 270 | #define PNG_READ_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 271 | #define PNG_READ_INVERT_ALPHA_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 272 | #define PNG_READ_STRIP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 273 | #define PNG_READ_USER_TRANSFORM_SUPPORTED |
| 274 | /* the following aren't implemented yet |
| 275 | #define PNG_READ_RGB_TO_GRAY_SUPPORTED |
| 276 | */ |
| 277 | #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 278 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 279 | #ifndef PNG_PROGRESSIVE_READ_NOT_SUPPORTED /* if you don't do progressive */ |
| 280 | #define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ |
| 281 | #endif /* about interlacing capability! You'll */ |
| 282 | /* still have interlacing unless you change the following line: */ |
| 283 | #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ |
| 284 | #define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 285 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 286 | #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 287 | #define PNG_WRITE_SHIFT_SUPPORTED |
| 288 | #define PNG_WRITE_PACK_SUPPORTED |
| 289 | #define PNG_WRITE_BGR_SUPPORTED |
| 290 | #define PNG_WRITE_SWAP_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 291 | #define PNG_WRITE_PACKSWAP_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 292 | #define PNG_WRITE_INVERT_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 293 | #define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */ |
Guy Schalnat | 0f71645 | 1995-11-28 11:22:13 -0600 | [diff] [blame] | 294 | #define PNG_WRITE_FLUSH_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 295 | #define PNG_WRITE_SWAP_ALPHA_SUPPORTED |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 296 | #define PNG_WRITE_INVERT_ALPHA_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 297 | #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 298 | #define PNG_WRITE_USER_TRANSFORM_SUPPORTED |
| 299 | #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 300 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 301 | #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant |
| 302 | encoders, but can cause trouble |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 303 | if left undefined */ |
| 304 | |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 305 | #if !defined(PNG_NO_STDIO) |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 306 | #define PNG_TIME_RFC1123_SUPPORTED |
Glenn Randers-Pehrson | 70e3f54 | 1998-01-03 22:40:55 -0600 | [diff] [blame] | 307 | #endif |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 308 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 309 | /* This adds extra functions in pngget.c for accessing data from the |
| 310 | * info pointer (added in version 0.99) |
| 311 | * png_get_image_width() |
| 312 | * png_get_image_height() |
| 313 | * png_get_bit_depth() |
| 314 | * png_get_color_type() |
| 315 | * png_get_compression_type() |
| 316 | * png_get_filter_type() |
| 317 | * png_get_interlace_type() |
| 318 | * png_get_pixel_aspect_ratio() |
| 319 | * png_get_pixels_per_meter() |
| 320 | * png_get_x_offset_pixels() |
| 321 | * png_get_y_offset_pixels() |
| 322 | * png_get_x_offset_microns() |
| 323 | * png_get_y_offset_microns() |
| 324 | */ |
| 325 | #if !defined(PNG_NO_EASY_ACCESS) |
| 326 | #define PNG_EASY_ACCESS_SUPPORTED |
| 327 | #endif |
| 328 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 329 | /* These are currently experimental features, define them if you want */ |
| 330 | |
| 331 | /* very little testing */ |
| 332 | /* |
Glenn Randers-Pehrson | cbe52d8 | 1998-02-28 07:00:24 -0600 | [diff] [blame] | 333 | #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 334 | */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 335 | |
| 336 | /* This is only for PowerPC big-endian and 680x0 systems */ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 337 | /* some testing */ |
| 338 | /* |
| 339 | #define PNG_READ_BIG_ENDIAN_SUPPORTED |
| 340 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 341 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 342 | /* 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] | 343 | /* |
| 344 | #define PNG_USELESS_TESTS_SUPPORTED |
| 345 | #define PNG_CORRECT_PALETTE_SUPPORTED |
| 346 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 347 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 348 | /* Any chunks you are not interested in, you can undef here. The |
| 349 | * ones that allocate memory may be expecially important (hIST, |
| 350 | * 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] | 351 | * a bit smaller. |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 352 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 353 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 354 | #ifndef PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED |
| 355 | #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
| 356 | #endif |
| 357 | #ifndef PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED |
| 358 | #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
| 359 | #endif |
| 360 | |
| 361 | #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 362 | #define PNG_READ_bKGD_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 363 | #define PNG_READ_cHRM_SUPPORTED |
| 364 | #define PNG_READ_gAMA_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 365 | #define PNG_READ_hIST_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 366 | #define PNG_READ_oFFs_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 367 | #define PNG_READ_pCAL_SUPPORTED |
| 368 | #define PNG_READ_pHYs_SUPPORTED |
| 369 | #define PNG_READ_sBIT_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 370 | #define PNG_READ_sRGB_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 371 | #define PNG_READ_tEXt_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 372 | #define PNG_READ_tIME_SUPPORTED |
| 373 | #define PNG_READ_tRNS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 374 | #define PNG_READ_zTXt_SUPPORTED |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 375 | #define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */ |
| 376 | /* PLTE chunk in RGB and RGBA images */ |
| 377 | #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 378 | |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 379 | #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 380 | #define PNG_WRITE_bKGD_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 381 | #define PNG_WRITE_cHRM_SUPPORTED |
| 382 | #define PNG_WRITE_gAMA_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 383 | #define PNG_WRITE_hIST_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 384 | #define PNG_WRITE_oFFs_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 385 | #define PNG_WRITE_pCAL_SUPPORTED |
| 386 | #define PNG_WRITE_pHYs_SUPPORTED |
| 387 | #define PNG_WRITE_sBIT_SUPPORTED |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 388 | #define PNG_WRITE_sRGB_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 389 | #define PNG_WRITE_tEXt_SUPPORTED |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 390 | #define PNG_WRITE_tIME_SUPPORTED |
| 391 | #define PNG_WRITE_tRNS_SUPPORTED |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 392 | #define PNG_WRITE_zTXt_SUPPORTED |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 393 | #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 394 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 395 | /* need the time information for reading tIME chunks */ |
| 396 | #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED) |
| 397 | #include <time.h> |
| 398 | #endif |
| 399 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 400 | /* 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] | 401 | * common platforms. The typedefs should be at least as large as the |
| 402 | * numbers suggest (a png_uint_32 must be at least 32 bits long), but they |
| 403 | * don't have to be exactly that size. Some compilers dislike passing |
| 404 | * unsigned shorts as function parameters, so you may be better off using |
| 405 | * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may |
| 406 | * want to have unsigned int for png_uint_32 instead of unsigned long. |
| 407 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 408 | |
| 409 | typedef unsigned long png_uint_32; |
| 410 | typedef long png_int_32; |
| 411 | typedef unsigned short png_uint_16; |
| 412 | typedef short png_int_16; |
| 413 | typedef unsigned char png_byte; |
| 414 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 415 | /* 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] | 416 | change (I'm not sure if you will or not, so I thought I'd be safe) */ |
| 417 | typedef size_t png_size_t; |
| 418 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 419 | /* The following is needed for medium model support. It cannot be in the |
| 420 | * PNG_INTERNAL section. Needs modification for other compilers besides |
| 421 | * MSC. Model independent support declares all arrays and pointers to be |
| 422 | * large using the far keyword. The zlib version used must also support |
| 423 | * model independent data. As of version zlib 1.0.4, the necessary changes |
| 424 | * have been made in zlib. The USE_FAR_KEYWORD define triggers other |
| 425 | * changes that are needed. (Tim Wegner) |
| 426 | */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 427 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 428 | /* Separate compiler dependencies (problem here is that zlib.h always |
| 429 | defines FAR. (SJT) */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 430 | #ifdef __BORLANDC__ |
| 431 | #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) |
| 432 | #define LDATA 1 |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 433 | #else |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 434 | #define LDATA 0 |
| 435 | #endif |
| 436 | |
| 437 | #if !defined(__WIN32__) && !defined(__FLAT__) |
| 438 | #define PNG_MAX_MALLOC_64K |
| 439 | #if (LDATA != 1) |
| 440 | #ifndef FAR |
| 441 | #define FAR __far |
| 442 | #endif |
| 443 | #define USE_FAR_KEYWORD |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 444 | #endif /* LDATA != 1 */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 445 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 446 | /* Possibly useful for moving data out of default segment. |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 447 | * Uncomment it if you want. Could also define FARDATA as |
| 448 | * const if your compiler supports it. (SJT) |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 449 | # define FARDATA FAR |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 450 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 451 | #endif /* __WIN32__, __FLAT__ */ |
| 452 | |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 453 | #endif /* __BORLANDC__ */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 454 | |
| 455 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 456 | /* Suggest testing for specific compiler first before testing for |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 457 | * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, |
| 458 | * making reliance oncertain keywords suspect. (SJT) |
| 459 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 460 | |
| 461 | /* MSC Medium model */ |
| 462 | #if defined(FAR) |
| 463 | # if defined(M_I86MM) |
| 464 | # define USE_FAR_KEYWORD |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 465 | # define FARDATA FAR |
| 466 | # include <dos.h> |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 467 | # endif |
| 468 | #endif |
| 469 | |
| 470 | /* SJT: default case */ |
| 471 | #ifndef FAR |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 472 | # define FAR |
| 473 | #endif |
| 474 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 475 | /* At this point FAR is always defined */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 476 | #ifndef FARDATA |
| 477 | #define FARDATA |
| 478 | #endif |
| 479 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 480 | /* Add typedefs for pointers */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 481 | typedef void FAR * png_voidp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 482 | typedef png_byte FAR * png_bytep; |
| 483 | typedef png_uint_32 FAR * png_uint_32p; |
| 484 | typedef png_int_32 FAR * png_int_32p; |
| 485 | typedef png_uint_16 FAR * png_uint_16p; |
| 486 | typedef png_int_16 FAR * png_int_16p; |
| 487 | typedef PNG_CONST char FAR * png_const_charp; |
| 488 | typedef char FAR * png_charp; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 489 | typedef double FAR * png_doublep; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 490 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 491 | /* Pointers to pointers; i.e. arrays */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 492 | typedef png_byte FAR * FAR * png_bytepp; |
| 493 | typedef png_uint_32 FAR * FAR * png_uint_32pp; |
| 494 | typedef png_int_32 FAR * FAR * png_int_32pp; |
| 495 | typedef png_uint_16 FAR * FAR * png_uint_16pp; |
| 496 | typedef png_int_16 FAR * FAR * png_int_16pp; |
| 497 | typedef PNG_CONST char FAR * FAR * png_const_charpp; |
| 498 | typedef char FAR * FAR * png_charpp; |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 499 | typedef double FAR * FAR * png_doublepp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 500 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 501 | /* Pointers to pointers to pointers; i.e. pointer to array */ |
| 502 | typedef char FAR * FAR * FAR * png_charppp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 503 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 504 | /* libpng typedefs for types in zlib. If zlib changes |
| 505 | * or another compression library is used, then change these. |
| 506 | * Eliminates need to change all the source files. |
| 507 | */ |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 508 | typedef charf * png_zcharp; |
| 509 | typedef charf * FAR * png_zcharpp; |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 510 | typedef z_stream FAR * png_zstreamp; |
Guy Schalnat | 6d76471 | 1995-12-19 03:22:19 -0600 | [diff] [blame] | 511 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 512 | /* allow for compilation as dll under MS Windows */ |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 513 | #ifdef __WIN32DLL__ |
| 514 | #define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol |
| 515 | #endif |
| 516 | |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 517 | /* allow for compilation as dll with BORLAND C++ 5.0 */ |
| 518 | #if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__) |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 519 | # define PNG_EXPORT(type,symbol) type _export symbol |
Glenn Randers-Pehrson | b6ce43d | 1998-01-01 07:13:13 -0600 | [diff] [blame] | 520 | #endif |
| 521 | |
| 522 | /* allow for compilation as shared lib under BeOS */ |
| 523 | #ifdef __BEOSDLL__ |
| 524 | #define PNG_EXPORT(type,symbol) __declspec(export) type symbol |
| 525 | #endif |
| 526 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 527 | #ifndef PNG_EXPORT |
Glenn Randers-Pehrson | 46f61e2 | 1998-01-30 21:45:12 -0600 | [diff] [blame] | 528 | #define PNG_EXPORT(type,symbol) type symbol |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 529 | #endif |
| 530 | |
| 531 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 532 | /* 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] | 533 | * that are passed far data must be model independent. |
| 534 | */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 535 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 536 | #if defined(USE_FAR_KEYWORD) /* memory model independent fns */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 537 | /* use this to make far-to-near assignments */ |
| 538 | # define CHECK 1 |
| 539 | # define NOCHECK 0 |
Glenn Randers-Pehrson | a357b99 | 1998-02-08 20:56:40 -0600 | [diff] [blame] | 540 | # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) |
| 541 | # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 542 | # define png_strlen _fstrlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 543 | # define png_memcmp _fmemcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 544 | # define png_memcpy _fmemcpy |
| 545 | # define png_memset _fmemset |
| 546 | #else /* use the usual functions */ |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 547 | # define CVT_PTR(ptr) (ptr) |
| 548 | # define CVT_PTR_NOCHECK(ptr) (ptr) |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 549 | # define png_strlen strlen |
Guy Schalnat | b2e01bd | 1996-01-26 01:38:47 -0600 | [diff] [blame] | 550 | # define png_memcmp memcmp /* SJT: added */ |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 551 | # define png_memcpy memcpy |
| 552 | # define png_memset memset |
| 553 | #endif |
| 554 | /* End of memory model independent support */ |
| 555 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 556 | /* Just a double check that someone hasn't tried to define something |
| 557 | * contradictory. |
| 558 | */ |
| 559 | #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K) |
| 560 | #undef PNG_ZBUF_SIZE |
| 561 | #define PNG_ZBUF_SIZE 65536 |
| 562 | #endif |
| 563 | |
Guy Schalnat | 51f0eb4 | 1995-09-26 05:22:39 -0500 | [diff] [blame] | 564 | #endif /* PNGCONF_H */ |
| 565 | |