blob: a7e0412127c75fd6671c66671a60e38bc2baf9c6 [file] [log] [blame]
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -06001/* pngconf.h - machine configurable file for libpng
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06002 *
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06003 * libpng 1.0.9beta3 - November 23, 2000
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06004 * For conditions of distribution and use, see copyright notice in png.h
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06005 * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05006 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06008 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05009
10/* Any machine specific code is near the front of this file, so if you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060011 * are configuring libpng for a machine, you may want to read the section
12 * starting here down to where it starts to typedef png_color, png_text,
13 * and png_info.
14 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050015
16#ifndef PNGCONF_H
17#define PNGCONF_H
18
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060019/* This is the size of the compression buffer, and thus the size of
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060020 * an IDAT chunk. Make this whatever size you feel is best for your
21 * machine. One of these will be allocated per png_struct. When this
22 * is full, it writes the data to the disk, and does some other
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060023 * calculations. Making this an extremely small size will slow
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060024 * the library down, but you may want to experiment to determine
25 * where it becomes significant, if you are concerned with memory
26 * usage. Note that zlib allocates at least 32Kb also. For readers,
27 * this describes the size of the buffer available to read the data in.
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060028 * Unless this gets smaller than the size of a row (compressed),
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060029 * it should not make much difference how big this is.
30 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050031
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060032#ifndef PNG_ZBUF_SIZE
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -060033#define PNG_ZBUF_SIZE 8192
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060034#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -050035
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060036#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -060037#define PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -050038#endif
39
Andreas Dilger47a0c421997-05-16 02:46:07 -050040/* If you are running on a machine where you cannot allocate more
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060041 * than 64K of memory at once, uncomment this. While libpng will not
42 * normally need that much memory in a chunk (unless you load up a very
43 * large file), zlib needs to know how big of a chunk it can use, and
44 * libpng thus makes sure to check any memory allocation to verify it
45 * will fit into memory.
Andreas Dilger47a0c421997-05-16 02:46:07 -050046#define PNG_MAX_MALLOC_64K
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060047 */
Andreas Dilger47a0c421997-05-16 02:46:07 -050048#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -060049#define PNG_MAX_MALLOC_64K
Guy Schalnat51f0eb41995-09-26 05:22:39 -050050#endif
51
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -050052/* Special munging to support doing things the 'cygwin' way:
53 * 'Normal' png-on-win32 defines/defaults:
54 * PNG_BUILD_DLL -- building dll
55 * PNG_USE_DLL -- building an application, linking to dll
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060056 * (no define) -- building static library, or building an
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -050057 * application and linking to the static lib
58 * 'Cygwin' defines/defaults:
59 * PNG_BUILD_DLL -- building the dll
60 * (no define) -- building an application, linking to the dll
61 * PNG_STATIC -- building the static lib, or building an application
62 * which links to the static lib.
63 * Thus,
64 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
65 * this bit of #ifdefs will define the 'correct' config variables based on
66 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
67 * unnecessary.
68 */
69#if defined(__CYGWIN__)
70# if defined(PNG_BUILD_DLL)
71# if defined(PNG_USE_DLL)
72# undef PNG_USE_DLL
73# endif
74# if !defined(PNG_DLL)
75# define PNG_DLL
76# endif
77# if defined(PNG_STATIC)
78# undef PNG_STATIC
79# endif
80# else
81# if defined(PNG_STATIC)
82# if defined(PNG_USE_DLL)
83# undef PNG_USE_DLL
84# endif
85# if defined(PNG_DLL)
86# undef PNG_DLL
87# endif
88# else
89# if defined(PNG_USE_DLL)
90# if !defined(PNG_DLL)
91# define PNG_DLL
92# endif
93# else
94# if defined(PNG_DLL)
95# define PNG_USE_DLL
96# else
97# define PNG_USE_DLL
98# define PNG_DLL
99# endif
100# endif
101# endif
102# endif
103#endif
104
105
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500106/* This protects us against compilers that run on a windowing system
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600107 * and thus don't have or would rather us not use the stdio types:
108 * stdin, stdout, and stderr. The only one currently used is stderr
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600109 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
110 * prevent these from being compiled and used. #defining PNG_NO_STDIO
111 * will also prevent these, plus will prevent the entire set of stdio
112 * macros and functions (FILE *, printf, etc.) from being compiled and used,
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500113 * unless (PNG_DEBUG > 0) has been #defined.
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600114 *
115 * #define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600116 * #define PNG_NO_STDIO
117 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600118
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500119#if defined(_WIN32_WCE)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600120#include <windows.h>
121/* Console I/O functions are not supported on WindowsCE */
122#define PNG_NO_CONSOLE_IO
123#ifdef PNG_DEBUG
124# undef PNG_DEBUG
125#endif
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500126#endif
127
Glenn Randers-Pehrson1ef65b62000-05-12 06:19:53 -0500128#ifdef PNG_BUILD_DLL
129# ifndef PNG_CONSOLE_IO_SUPPORTED
130# ifndef PNG_NO_CONSOLE_IO
131# define PNG_NO_CONSOLE_IO
132# endif
133# endif
134#endif
135
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600136# ifdef PNG_NO_STDIO
137# ifndef PNG_NO_CONSOLE_IO
138# define PNG_NO_CONSOLE_IO
139# endif
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500140# ifdef PNG_DEBUG
141# if (PNG_DEBUG > 0)
142# include <stdio.h>
143# endif
144# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600145# else
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500146# if !defined(_WIN32_WCE)
147/* "stdio.h" functions are not supported on WindowsCE */
148# include <stdio.h>
149# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600150# endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600151
152/* This macro protects us against machines that don't have function
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600153 * prototypes (ie K&R style headers). If your compiler does not handle
154 * function prototypes, define this macro and use the included ansi2knr.
155 * I've always been able to use _NO_PROTO as the indicator, but you may
156 * need to drag the empty declaration out in front of here, or change the
157 * ifdef to suit your own needs.
158 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500159#ifndef PNGARG
160
Andreas Dilger47a0c421997-05-16 02:46:07 -0500161#ifdef OF /* zlib prototype munger */
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600162#define PNGARG(arglist) OF(arglist)
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500163#else
164
165#ifdef _NO_PROTO
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600166#define PNGARG(arglist) ()
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500167#else
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600168#define PNGARG(arglist) arglist
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500169#endif /* _NO_PROTO */
170
171#endif /* OF */
172
173#endif /* PNGARG */
174
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600175/* Try to determine if we are compiling on a Mac. Note that testing for
176 * just __MWERKS__ is not good enough, because the Codewarrior is now used
177 * on non-Mac platforms.
178 */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600179#ifndef MACOS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600180#if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
181 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
182#define MACOS
183#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600184#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600185
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500186/* enough people need this for various reasons to include it here */
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500187#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600188#include <sys/types.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500189#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600190
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600191#ifndef PNG_SETJMP_NOT_SUPPORTED
192# define PNG_SETJMP_SUPPORTED
193#endif
194
195#ifdef PNG_SETJMP_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500196/* This is an attempt to force a single setjmp behaviour on Linux. If
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600197 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
198 */
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500199
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600200# ifdef __linux__
201# ifdef _BSD_SOURCE
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500202# define PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600203# undef _BSD_SOURCE
204# endif
205# ifdef _SETJMP_H
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500206 __png.h__ already includes setjmp.h;
207 __dont__ include it again.;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600208# endif
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600209#endif /* __linux__ */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500210
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600211/* include setjmp.h for error handling */
212#include <setjmp.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500213
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600214# ifdef __linux__
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500215# ifdef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600216# define _BSD_SOURCE
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500217# undef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600218# endif
219# endif /* __linux__ */
220#endif /* PNG_SETJMP_SUPPORTED */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600221
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500222#if defined(_AIX) && defined(__xlC__)
223/* This prevents "AIX/xlC" from generating an "index(s,c)" macro in strings.h
224 * that conflicts with libpng's png_color_16.index */
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600225#undef __STR__
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500226#endif
227
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500228#ifdef BSD
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600229#include <strings.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500230#else
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600231#include <string.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500232#endif
233
Andreas Dilger47a0c421997-05-16 02:46:07 -0500234/* Other defines for things like memory and the like can go here. */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500235#ifdef PNG_INTERNAL
236#include <stdlib.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500237
238/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
239 * aren't usually used outside the library (as far as I know), so it is
240 * debatable if they should be exported at all. In the future, when it is
241 * possible to have run-time registry of chunk-handling functions, some of
242 * these will be made available again.
243#define PNG_EXTERN extern
244 */
245#define PNG_EXTERN
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500246
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600247/* Other defines specific to compilers can go here. Try to keep
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600248 * them inside an appropriate ifdef/endif pair for portability.
249 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500250
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500251#if defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600252#if defined(MACOS)
253/* We need to check that <math.h> hasn't already been included earlier
254 * as it seems it doesn't agree with <fp.h>, yet we should really use
255 * <fp.h> if possible.
256 */
257#if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
258#include <fp.h>
259#endif
260#else
261#include <math.h>
262#endif
263#if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
264/* Amiga SAS/C: We must include builtin FPU functions when compiling using
265 * MATH=68881
266 */
267#include <m68881.h>
268#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600269#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600270
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600271/* Codewarrior on NT has linking problems without this. */
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500272#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600273#define PNG_ALWAYS_EXTERN
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600274#endif
275
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600276/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600277 * stdlib.h like it should (I think). Or perhaps this is a C++
278 * "feature"?
279 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500280#ifdef __TURBOC__
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600281#include <mem.h>
282#include "alloc.h"
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500283#endif
284
285#ifdef _MSC_VER
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600286#include <malloc.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500287#endif
288
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600289/* This controls how fine the dithering gets. As this allocates
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600290 * a largish chunk of memory (32K), those who are not as concerned
291 * with dithering quality can decrease some or all of these.
292 */
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600293#ifndef PNG_DITHER_RED_BITS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600294#define PNG_DITHER_RED_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600295#endif
296#ifndef PNG_DITHER_GREEN_BITS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600297#define PNG_DITHER_GREEN_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600298#endif
299#ifndef PNG_DITHER_BLUE_BITS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600300#define PNG_DITHER_BLUE_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600301#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500302
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600303/* This controls how fine the gamma correction becomes when you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600304 * are only interested in 8 bits anyway. Increasing this value
305 * results in more memory being used, and more pow() functions
306 * being called to fill in the gamma tables. Don't set this value
307 * less then 8, and even that may not work (I haven't tested it).
308 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500309
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600310#ifndef PNG_MAX_GAMMA_8
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600311#define PNG_MAX_GAMMA_8 11
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600312#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500313
Andreas Dilger47a0c421997-05-16 02:46:07 -0500314/* This controls how much a difference in gamma we can tolerate before
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600315 * we actually start doing gamma conversion.
316 */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600317#ifndef PNG_GAMMA_THRESHOLD
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600318#define PNG_GAMMA_THRESHOLD 0.05
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600319#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500320
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500321#endif /* PNG_INTERNAL */
322
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600323/* The following uses const char * instead of char * for error
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600324 * and warning message functions, so some compilers won't complain.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600325 * If you do not want to use const, define PNG_NO_CONST here.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600326 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600327
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600328#ifndef PNG_NO_CONST
Guy Schalnat6d764711995-12-19 03:22:19 -0600329# define PNG_CONST const
330#else
331# define PNG_CONST
332#endif
333
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600334/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600335 * library that you will not be using. I wish I could figure out how to
336 * automate this, but I can't do that without making it seriously hard
337 * on the users. So if you are not using an ability, change the #define
338 * to and #undef, and that part of the library will not be compiled. If
339 * your linker can't find a function, you may want to make sure the
340 * ability is defined here. Some of these depend upon some others being
341 * defined. I haven't figured out all the interactions here, so you may
342 * have to experiment awhile to get everything to compile. If you are
343 * creating or using a shared library, you probably shouldn't touch this,
344 * as it will affect the size of the structures, and this will cause bad
345 * things to happen if the library and/or application ever change.
346 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500347
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500348/* Any features you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600349
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600350/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500351 * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
352 * on the compile line, then pick and choose which ones to define without
353 * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
354 * if you only want to have a png-compliant reader/writer but don't need
355 * any of the extra transformations. This saves about 80 kbytes in a
356 * typical installation of the library. (PNG_NO_* form added in version
357 * 1.0.1c, for consistency)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600358 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600359
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500360/* The size of the png_text structure changed in libpng-1.0.6 when
361 * iTXt is supported. It is turned off by default, to support old apps
362 * that malloc the png_text structure instead of calling png_set_text()
363 * and letting libpng malloc it. It will be turned on by default in
364 * libpng-2.0.0.
365 */
366
367#ifndef PNG_iTXt_SUPPORTED
368# ifndef PNG_READ_iTXt_SUPPORTED
369# define PNG_NO_READ_iTXt
370# endif
371# ifndef PNG_WRITE_iTXt_SUPPORTED
372# define PNG_NO_WRITE_iTXt
373# endif
374#endif
375
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500376/* The following support, added after version 1.0.0, can be turned off here en
377 * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
378 * with old applications that require the length of png_struct and png_info
379 * to remain unchanged.
380 */
381
382#ifdef PNG_LEGACY_SUPPORTED
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600383#define PNG_NO_FREE_ME
384#define PNG_NO_READ_UNKNOWN_CHUNKS
385#define PNG_NO_WRITE_UNKNOWN_CHUNKS
386#define PNG_NO_READ_USER_CHUNKS
387#define PNG_NO_READ_iCCP
388#define PNG_NO_WRITE_iCCP
389#define PNG_NO_READ_iTXt
390#define PNG_NO_WRITE_iTXt
391#define PNG_NO_READ_sCAL
392#define PNG_NO_WRITE_sCAL
393#define PNG_NO_READ_sPLT
394#define PNG_NO_WRITE_sPLT
395#define PNG_NO_INFO_IMAGE
396#define PNG_NO_READ_RGB_TO_GRAY
397#define PNG_NO_READ_USER_TRANSFORM
398#define PNG_NO_WRITE_USER_TRANSFORM
399#define PNG_NO_USER_MEM
400#define PNG_NO_READ_EMPTY_PLTE
401#define PNG_NO_MNG_FEATURES
402#define PNG_NO_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500403#endif
404
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500405/* Ignore attempt to turn off both floating and fixed point support */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500406#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600407 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
408#define PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500409#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600410
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500411#ifndef PNG_NO_FREE_ME
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600412#define PNG_FREE_ME_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500413#endif
414
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500415#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
416 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600417#define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600418#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500419#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
420 !defined(PNG_NO_WRITE_TRANSFORMS)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600421#define PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600422#endif
423
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600424#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600425#ifndef PNG_NO_READ_EXPAND
426#define PNG_READ_EXPAND_SUPPORTED
427#endif
428#ifndef PNG_NO_READ_SHIFT
429#define PNG_READ_SHIFT_SUPPORTED
430#endif
431#ifndef PNG_NO_READ_PACK
432#define PNG_READ_PACK_SUPPORTED
433#endif
434#ifndef PNG_NO_READ_BGR
435#define PNG_READ_BGR_SUPPORTED
436#endif
437#ifndef PNG_NO_READ_SWAP
438#define PNG_READ_SWAP_SUPPORTED
439#endif
440#ifndef PNG_NO_READ_PACKSWAP
441#define PNG_READ_PACKSWAP_SUPPORTED
442#endif
443#ifndef PNG_NO_READ_INVERT
444#define PNG_READ_INVERT_SUPPORTED
445#endif
446#ifndef PNG_NO_READ_DITHER
447#define PNG_READ_DITHER_SUPPORTED
448#endif
449#ifndef PNG_NO_READ_BACKGROUND
450#define PNG_READ_BACKGROUND_SUPPORTED
451#endif
452#ifndef PNG_NO_READ_16_TO_8
453#define PNG_READ_16_TO_8_SUPPORTED
454#endif
455#ifndef PNG_NO_READ_FILLER
456#define PNG_READ_FILLER_SUPPORTED
457#endif
458#ifndef PNG_NO_READ_GAMMA
459#define PNG_READ_GAMMA_SUPPORTED
460#endif
461#ifndef PNG_NO_READ_GRAY_TO_RGB
462#define PNG_READ_GRAY_TO_RGB_SUPPORTED
463#endif
464#ifndef PNG_NO_READ_SWAP_ALPHA
465#define PNG_READ_SWAP_ALPHA_SUPPORTED
466#endif
467#ifndef PNG_NO_READ_INVERT_ALPHA
468#define PNG_READ_INVERT_ALPHA_SUPPORTED
469#endif
470#ifndef PNG_NO_READ_STRIP_ALPHA
471#define PNG_READ_STRIP_ALPHA_SUPPORTED
472#endif
473#ifndef PNG_NO_READ_USER_TRANSFORM
474#define PNG_READ_USER_TRANSFORM_SUPPORTED
475#endif
476#ifndef PNG_NO_READ_RGB_TO_GRAY
477#define PNG_READ_RGB_TO_GRAY_SUPPORTED
478#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600479#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600480
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500481#if !defined(PNG_NO_PROGRESSIVE_READ) && \
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600482 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
483#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600484#endif /* about interlacing capability! You'll */
485 /* still have interlacing unless you change the following line: */
486#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500487
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500488#ifndef PNG_NO_READ_COMPOSITE_NODIV
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600489#ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
490#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
491#endif
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500492#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500493
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -0600494#ifndef PNG_NO_MNG_FEATURES
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600495#define PNG_MNG_FEATURES_SUPPORTED /* Useful for MNG applications */
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -0600496#endif
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600497/* Deprecated, will be removed */
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500498#ifndef PNG_NO_READ_EMPTY_PLTE
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600499#define PNG_READ_EMPTY_PLTE_SUPPORTED
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500500#endif
501
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600502#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600503#ifndef PNG_NO_WRITE_SHIFT
504#define PNG_WRITE_SHIFT_SUPPORTED
505#endif
506#ifndef PNG_NO_WRITE_PACK
507#define PNG_WRITE_PACK_SUPPORTED
508#endif
509#ifndef PNG_NO_WRITE_BGR
510#define PNG_WRITE_BGR_SUPPORTED
511#endif
512#ifndef PNG_NO_WRITE_SWAP
513#define PNG_WRITE_SWAP_SUPPORTED
514#endif
515#ifndef PNG_NO_WRITE_PACKSWAP
516#define PNG_WRITE_PACKSWAP_SUPPORTED
517#endif
518#ifndef PNG_NO_WRITE_INVERT
519#define PNG_WRITE_INVERT_SUPPORTED
520#endif
521#ifndef PNG_NO_WRITE_FILLER
522#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
523#endif
524#ifndef PNG_NO_WRITE_SWAP_ALPHA
525#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
526#endif
527#ifndef PNG_NO_WRITE_INVERT_ALPHA
528#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
529#endif
530#ifndef PNG_NO_WRITE_USER_TRANSFORM
531#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
532#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600533#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600534
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500535#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600536defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
537#ifndef PNG_NO_USER_TRANSFORM_PTR
538#define PNG_USER_TRANSFORM_PTR_SUPPORTED
539#endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500540#endif
541
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600542#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
543 encoders, but can cause trouble
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600544 if left undefined */
545
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500546#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
547 defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600548#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500549#endif
550
551#ifndef PNG_NO_WRITE_FLUSH
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600552#define PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500553#endif
554
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -0600555/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500556#ifndef PNG_NO_WRITE_EMPTY_PLTE
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600557#define PNG_WRITE_EMPTY_PLTE_SUPPORTED
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500558#endif
559
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500560#ifndef PNG_NO_STDIO
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600561#define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600562#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500563
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600564/* This adds extra functions in pngget.c for accessing data from the
565 * info pointer (added in version 0.99)
566 * png_get_image_width()
567 * png_get_image_height()
568 * png_get_bit_depth()
569 * png_get_color_type()
570 * png_get_compression_type()
571 * png_get_filter_type()
572 * png_get_interlace_type()
573 * png_get_pixel_aspect_ratio()
574 * png_get_pixels_per_meter()
575 * png_get_x_offset_pixels()
576 * png_get_y_offset_pixels()
577 * png_get_x_offset_microns()
578 * png_get_y_offset_microns()
579 */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500580#ifndef PNG_NO_EASY_ACCESS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600581#define PNG_EASY_ACCESS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600582#endif
583
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600584#if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD) && \
585 !defined(PNG_NO_ASSEMBLER_CODE)
586#define PNG_ASSEMBLER_CODE_SUPPORTED
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500587#endif
588
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600589/* These are currently experimental features, define them if you want */
590
591/* very little testing */
592/*
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600593#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500594#ifndef PNG_NO_USER_MEM
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600595#define PNG_USER_MEM_SUPPORTED
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500596#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500597#ifndef PNG_NO_ZALLOC_ZERO
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600598#define PNG_ZALLOC_ZERO
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500599#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600600*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500601
602/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600603/* some testing */
604/*
605#define PNG_READ_BIG_ENDIAN_SUPPORTED
606*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500607
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500608/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
609/*
610#define PNG_NO_POINTER_INDEXING
611*/
612
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600613/* These functions are turned off by default, as they will be phased out. */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600614/*
615#define PNG_USELESS_TESTS_SUPPORTED
616#define PNG_CORRECT_PALETTE_SUPPORTED
617*/
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600618
Andreas Dilger47a0c421997-05-16 02:46:07 -0500619/* Any chunks you are not interested in, you can undef here. The
620 * ones that allocate memory may be expecially important (hIST,
621 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600622 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500623 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500624
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500625#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
626 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600627#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600628#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500629#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
630 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600631#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600632#endif
633
634#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600635
636#ifdef PNG_NO_READ_TEXT
637# define PNG_NO_READ_iTXt
638# define PNG_NO_READ_tEXt
639# define PNG_NO_READ_zTXt
640#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500641#ifndef PNG_NO_READ_bKGD
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600642# define PNG_READ_bKGD_SUPPORTED
643# define PNG_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500644#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500645#ifndef PNG_NO_READ_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600646# define PNG_READ_cHRM_SUPPORTED
647# define PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500648#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500649#ifndef PNG_NO_READ_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600650# define PNG_READ_gAMA_SUPPORTED
651# define PNG_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500652#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500653#ifndef PNG_NO_READ_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600654# define PNG_READ_hIST_SUPPORTED
655# define PNG_hIST_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600656#endif
657#ifndef PNG_NO_READ_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600658# define PNG_READ_iCCP_SUPPORTED
659# define PNG_iCCP_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600660#endif
661#ifndef PNG_NO_READ_iTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600662# define PNG_READ_iTXt_SUPPORTED
663# define PNG_iTXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500664#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500665#ifndef PNG_NO_READ_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600666# define PNG_READ_oFFs_SUPPORTED
667# define PNG_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500668#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500669#ifndef PNG_NO_READ_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600670# define PNG_READ_pCAL_SUPPORTED
671# define PNG_pCAL_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600672#endif
673#ifndef PNG_NO_READ_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600674# define PNG_READ_sCAL_SUPPORTED
675# define PNG_sCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500676#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500677#ifndef PNG_NO_READ_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600678# define PNG_READ_pHYs_SUPPORTED
679# define PNG_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500680#endif
681#ifndef PNG_NO_READ_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600682# define PNG_READ_sBIT_SUPPORTED
683# define PNG_sBIT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600684#endif
685#ifndef PNG_NO_READ_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600686# define PNG_READ_sPLT_SUPPORTED
687# define PNG_sPLT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500688#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500689#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600690# define PNG_READ_sRGB_SUPPORTED
691# define PNG_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500692#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500693#ifndef PNG_NO_READ_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600694# define PNG_READ_tEXt_SUPPORTED
695# define PNG_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500696#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500697#ifndef PNG_NO_READ_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600698# define PNG_READ_tIME_SUPPORTED
699# define PNG_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500700#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500701#ifndef PNG_NO_READ_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600702# define PNG_READ_tRNS_SUPPORTED
703# define PNG_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500704#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500705#ifndef PNG_NO_READ_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600706# define PNG_READ_zTXt_SUPPORTED
707# define PNG_zTXt_SUPPORTED
708#endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500709#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
710# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500711# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
712# define PNG_UNKNOWN_CHUNKS_SUPPORTED
713# endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500714# ifndef PNG_NO_HANDLE_AS_UNKNOWN
715# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
716# endif
717#endif
Glenn Randers-Pehrson3d5a5202000-07-01 15:37:28 -0500718#if !defined(PNG_NO_READ_USER_CHUNKS) && \
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500719 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600720# define PNG_READ_USER_CHUNKS_SUPPORTED
721# define PNG_USER_CHUNKS_SUPPORTED
722# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
723# undef PNG_NO_READ_UNKNOWN_CHUNKS
724# endif
725# ifdef PNG_NO_HANDLE_AS_UNKNOWN
726# undef PNG_NO_HANDLE_AS_UNKNOWN
727# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600728#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500729#ifndef PNG_NO_READ_OPT_PLTE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600730# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
731#endif /* optional PLTE chunk in RGB and RGBA images */
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600732#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600733 defined(PNG_READ_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600734# define PNG_READ_TEXT_SUPPORTED
735# define PNG_TEXT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600736#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600737#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500738
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600739#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600740#ifdef PNG_NO_WRITE_TEXT
741# define PNG_NO_WRITE_iTXt
742# define PNG_NO_WRITE_tEXt
743# define PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600744#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600745#ifndef PNG_NO_WRITE_bKGD
746# define PNG_WRITE_bKGD_SUPPORTED
747# ifndef PNG_bKGD_SUPPORTED
748# define PNG_bKGD_SUPPORTED
749# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500750#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500751#ifndef PNG_NO_WRITE_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600752# define PNG_WRITE_cHRM_SUPPORTED
753# ifndef PNG_cHRM_SUPPORTED
754# define PNG_cHRM_SUPPORTED
755# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500756#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500757#ifndef PNG_NO_WRITE_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600758# define PNG_WRITE_gAMA_SUPPORTED
759# ifndef PNG_gAMA_SUPPORTED
760# define PNG_gAMA_SUPPORTED
761# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500762#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500763#ifndef PNG_NO_WRITE_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600764# define PNG_WRITE_hIST_SUPPORTED
765# ifndef PNG_hIST_SUPPORTED
766# define PNG_hIST_SUPPORTED
767# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600768#endif
769#ifndef PNG_NO_WRITE_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600770# define PNG_WRITE_iCCP_SUPPORTED
771# ifndef PNG_iCCP_SUPPORTED
772# define PNG_iCCP_SUPPORTED
773# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600774#endif
775#ifndef PNG_NO_WRITE_iTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600776# define PNG_WRITE_iTXt_SUPPORTED
777# ifndef PNG_iTXt_SUPPORTED
778# define PNG_iTXt_SUPPORTED
779# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500780#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500781#ifndef PNG_NO_WRITE_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600782# define PNG_WRITE_oFFs_SUPPORTED
783# ifndef PNG_oFFs_SUPPORTED
784# define PNG_oFFs_SUPPORTED
785# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500786#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500787#ifndef PNG_NO_WRITE_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600788# define PNG_WRITE_pCAL_SUPPORTED
789# ifndef PNG_pCAL_SUPPORTED
790# define PNG_pCAL_SUPPORTED
791# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600792#endif
793#ifndef PNG_NO_WRITE_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600794# define PNG_WRITE_sCAL_SUPPORTED
795# ifndef PNG_sCAL_SUPPORTED
796# define PNG_sCAL_SUPPORTED
797# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500798#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500799#ifndef PNG_NO_WRITE_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600800# define PNG_WRITE_pHYs_SUPPORTED
801# ifndef PNG_pHYs_SUPPORTED
802# define PNG_pHYs_SUPPORTED
803# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500804#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500805#ifndef PNG_NO_WRITE_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600806# define PNG_WRITE_sBIT_SUPPORTED
807# ifndef PNG_sBIT_SUPPORTED
808# define PNG_sBIT_SUPPORTED
809# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600810#endif
811#ifndef PNG_NO_WRITE_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600812# define PNG_WRITE_sPLT_SUPPORTED
813# ifndef PNG_sPLT_SUPPORTED
814# define PNG_sPLT_SUPPORTED
815# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500816#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500817#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600818# define PNG_WRITE_sRGB_SUPPORTED
819# ifndef PNG_sRGB_SUPPORTED
820# define PNG_sRGB_SUPPORTED
821# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500822#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500823#ifndef PNG_NO_WRITE_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600824# define PNG_WRITE_tEXt_SUPPORTED
825# ifndef PNG_tEXt_SUPPORTED
826# define PNG_tEXt_SUPPORTED
827# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500828#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500829#ifndef PNG_NO_WRITE_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600830# define PNG_WRITE_tIME_SUPPORTED
831# ifndef PNG_tIME_SUPPORTED
832# define PNG_tIME_SUPPORTED
833# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500834#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500835#ifndef PNG_NO_WRITE_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600836# define PNG_WRITE_tRNS_SUPPORTED
837# ifndef PNG_tRNS_SUPPORTED
838# define PNG_tRNS_SUPPORTED
839# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500840#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500841#ifndef PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600842# define PNG_WRITE_zTXt_SUPPORTED
843# ifndef PNG_zTXt_SUPPORTED
844# define PNG_zTXt_SUPPORTED
845# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600846#endif
847#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600848# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
849# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
850# define PNG_UNKNOWN_CHUNKS_SUPPORTED
851# endif
852# ifndef PNG_NO_HANDLE_AS_UNKNOWN
853# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
854# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
855# endif
856# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600857#endif
858#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600859 defined(PNG_WRITE_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600860# define PNG_WRITE_TEXT_SUPPORTED
861# ifndef PNG_TEXT_SUPPORTED
862# define PNG_TEXT_SUPPORTED
863# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500864#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600865#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500866
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600867/* Turn this off to disable png_read_png() and
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600868 * png_write_png() and leave the row_pointers member
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600869 * out of the info structure.
870 */
871#ifndef PNG_NO_INFO_IMAGE
872# define PNG_INFO_IMAGE_SUPPORTED
873#endif
874
Andreas Dilger47a0c421997-05-16 02:46:07 -0500875/* need the time information for reading tIME chunks */
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600876#if defined(PNG_tIME_SUPPORTED)
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500877# if !defined(_WIN32_WCE)
878 /* "time.h" functions are not supported on WindowsCE */
879# include <time.h>
880# endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500881#endif
882
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600883/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -0500884 * common platforms. The typedefs should be at least as large as the
885 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
886 * don't have to be exactly that size. Some compilers dislike passing
887 * unsigned shorts as function parameters, so you may be better off using
888 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
889 * want to have unsigned int for png_uint_32 instead of unsigned long.
890 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500891
892typedef unsigned long png_uint_32;
893typedef long png_int_32;
894typedef unsigned short png_uint_16;
895typedef short png_int_16;
896typedef unsigned char png_byte;
897
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600898/* This is usually size_t. It is typedef'ed just in case you need it to
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500899 change (I'm not sure if you will or not, so I thought I'd be safe) */
900typedef size_t png_size_t;
901
Andreas Dilger47a0c421997-05-16 02:46:07 -0500902/* The following is needed for medium model support. It cannot be in the
903 * PNG_INTERNAL section. Needs modification for other compilers besides
904 * MSC. Model independent support declares all arrays and pointers to be
905 * large using the far keyword. The zlib version used must also support
906 * model independent data. As of version zlib 1.0.4, the necessary changes
907 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
908 * changes that are needed. (Tim Wegner)
909 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500910
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600911/* Separate compiler dependencies (problem here is that zlib.h always
912 defines FAR. (SJT) */
Guy Schalnat6d764711995-12-19 03:22:19 -0600913#ifdef __BORLANDC__
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600914#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
915#define LDATA 1
916#else
917#define LDATA 0
918#endif
919
920#if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
921#define PNG_MAX_MALLOC_64K
922#if (LDATA != 1)
923#ifndef FAR
924#define FAR __far
925#endif
926#define USE_FAR_KEYWORD
927#endif /* LDATA != 1 */
928
929/* Possibly useful for moving data out of default segment.
930 * Uncomment it if you want. Could also define FARDATA as
931 * const if your compiler supports it. (SJT)
932# define FARDATA FAR
933 */
934#endif /* __WIN32__, __FLAT__, __CYGWIN__ */
935
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600936#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -0600937
938
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600939/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600940 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
941 * making reliance oncertain keywords suspect. (SJT)
942 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600943
944/* MSC Medium model */
945#if defined(FAR)
946# if defined(M_I86MM)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600947# define USE_FAR_KEYWORD
948# define FARDATA FAR
949# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -0600950# endif
951#endif
952
953/* SJT: default case */
954#ifndef FAR
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600955# define FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500956#endif
957
Andreas Dilger47a0c421997-05-16 02:46:07 -0500958/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -0600959#ifndef FARDATA
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600960#define FARDATA
Guy Schalnat6d764711995-12-19 03:22:19 -0600961#endif
962
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600963/* Typedef for floating-point numbers that are converted
964 to fixed-point with a multiple of 100,000, e.g., int_gamma */
965typedef png_int_32 png_fixed_point;
966
Andreas Dilger47a0c421997-05-16 02:46:07 -0500967/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600968typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600969typedef png_byte FAR * png_bytep;
970typedef png_uint_32 FAR * png_uint_32p;
971typedef png_int_32 FAR * png_int_32p;
972typedef png_uint_16 FAR * png_uint_16p;
973typedef png_int_16 FAR * png_int_16p;
974typedef PNG_CONST char FAR * png_const_charp;
975typedef char FAR * png_charp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600976typedef png_fixed_point FAR * png_fixed_point_p;
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500977#if defined(_WIN32_WCE)
978typedef HANDLE png_FILE_p;
979#else
980typedef FILE * png_FILE_p;
981#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600982#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500983typedef double FAR * png_doublep;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600984#endif
Guy Schalnat6d764711995-12-19 03:22:19 -0600985
Andreas Dilger47a0c421997-05-16 02:46:07 -0500986/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -0600987typedef png_byte FAR * FAR * png_bytepp;
988typedef png_uint_32 FAR * FAR * png_uint_32pp;
989typedef png_int_32 FAR * FAR * png_int_32pp;
990typedef png_uint_16 FAR * FAR * png_uint_16pp;
991typedef png_int_16 FAR * FAR * png_int_16pp;
992typedef PNG_CONST char FAR * FAR * png_const_charpp;
993typedef char FAR * FAR * png_charpp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600994typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600995#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500996typedef double FAR * FAR * png_doublepp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600997#endif
Guy Schalnat6d764711995-12-19 03:22:19 -0600998
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -0600999/* Pointers to pointers to pointers; i.e. pointer to array */
Andreas Dilger47a0c421997-05-16 02:46:07 -05001000typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001001
Andreas Dilger47a0c421997-05-16 02:46:07 -05001002/* libpng typedefs for types in zlib. If zlib changes
1003 * or another compression library is used, then change these.
1004 * Eliminates need to change all the source files.
1005 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001006typedef charf * png_zcharp;
1007typedef charf * FAR * png_zcharpp;
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06001008typedef z_stream FAR * png_zstreamp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001009
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001010/*
1011 * Define PNG_BUILD_DLL if the module being built is a Windows
1012 * LIBPNG DLL.
1013 *
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001014 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001015 * It is equivalent to Microsoft predefined macro _DLL which is
1016 * automatically defined when you compile using the share
1017 * version of the CRT (C Run-Time library)
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001018 *
1019 * The cygwin mods make this behavior a little different:
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001020 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1021 * Define PNG_STATIC if you are building a static library for use with cygwin,
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001022 * -or- if you are building an application that you want to link to the
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001023 * static library.
1024 * PNG_USE_DLL is defined by default (no user action needed) unless one of
1025 * the other flags is defined.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001026 */
1027
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001028#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001029# define PNG_DLL
1030#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001031/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1032 * When building a static lib, default to no GLOBAL ARRAYS, but allow
1033 * command-line override
1034 */
1035#if defined(__CYGWIN__)
1036# if !defined(PNG_STATIC)
1037# if defined(PNG_USE_GLOBAL_ARRAYS)
1038# undef PNG_USE_GLOBAL_ARRAYS
1039# endif
1040# if !defined(PNG_USE_LOCAL_ARRAYS)
1041# define PNG_USE_LOCAL_ARRAYS
1042# endif
1043# else
1044# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1045# if defined(PNG_USE_GLOBAL_ARRAYS)
1046# undef PNG_USE_GLOBAL_ARRAYS
1047# endif
1048# endif
1049# endif
1050# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1051# define PNG_USE_LOCAL_ARRAYS
1052# endif
1053#endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001054
Glenn Randers-Pehrsonec61c232000-05-16 06:17:36 -05001055/* Do not use global arrays (helps with building DLL's)
1056 * They are no longer used in libpng itself, since version 1.0.5c,
1057 * but might be required for some pre-1.0.5c applications.
1058 */
1059#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1060# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
1061# define PNG_USE_LOCAL_ARRAYS
1062# else
1063# define PNG_USE_GLOBAL_ARRAYS
1064# endif
1065#endif
1066
Glenn Randers-Pehrsonfbbb5ec2001-01-15 22:01:20 -06001067#ifndef PNGAPI
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001068
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001069
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001070#if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF)
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001071# ifndef PNG_NO_MODULEDEF
1072# define PNG_NO_MODULEDEF
1073# endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001074#endif
1075
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001076#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001077# define PNG_IMPEXP
1078#endif
1079
1080#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001081 (( defined(_Windows) || defined(_WINDOWS) || \
1082 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
1083 ) && !defined(__CYGWIN__))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001084
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001085# ifdef __GNUC__
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001086# define PNGAPI __cdecl
1087# else
1088# define PNGAPI _cdecl
1089# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001090
1091# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1092 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1093# define PNG_IMPEXP
1094# endif
1095
1096# if !defined(PNG_IMPEXP)
1097
1098# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
1099# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
1100
1101 /* Borland/Microsoft */
1102# if defined(_MSC_VER) || defined(__BORLANDC__)
1103# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1104# define PNG_EXPORT PNG_EXPORT_TYPE1
1105# else
1106# define PNG_EXPORT PNG_EXPORT_TYPE2
1107# if defined(PNG_BUILD_DLL)
1108# define PNG_IMPEXP __export
1109# else
1110# define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in
1111 VC++*/
1112# endif /* Exists in Borland C++ for
1113 C++ classes (== huge) */
1114# endif
1115# endif
1116
1117# if !defined(PNG_IMPEXP)
1118# if defined(PNG_BUILD_DLL)
1119# define PNG_IMPEXP __declspec(dllexport)
1120# else
1121# define PNG_IMPEXP __declspec(dllimport)
1122# endif
1123# endif
1124# endif /* PNG_IMPEXP */
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001125#else /* !(DLL || non-cygwin WINDOWS) */
1126# if defined(__CYGWIN__) && !defined(PNG_DLL)
1127# if !defined(PNG_IMPEXP)
1128# define PNG_IMPEXP
1129# endif
1130# define PNGAPI __cdecl
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001131# else
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001132# if 0 /* ... other platforms, with other meanings */
1133# else
1134# define PNGAPI
1135# define PNG_IMPEXP
1136# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001137# endif
1138#endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001139#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001140
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -06001141#ifndef PNGAPI
1142# define PNGAPI
1143#endif
1144#ifndef PNG_IMPEXP
1145# define PNG_IMPEXP
1146#endif
1147
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05001148#ifndef PNG_EXPORT
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001149# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001150#endif
1151
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001152#ifdef PNG_USE_GLOBAL_ARRAYS
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001153#ifndef PNG_EXPORT_VAR
1154# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1155#endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001156#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001157
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001158/* User may want to use these so they are not in PNG_INTERNAL. Any library
1159 * functions that are passed far data must be model independent.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001160 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001161
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001162#ifndef PNG_ABORT
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001163# define PNG_ABORT() abort()
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001164#endif
1165
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001166#ifdef PNG_SETJMP_SUPPORTED
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001167# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06001168#else
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001169# define png_jmpbuf(png_ptr) \
1170 (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001171#endif
1172
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001173#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001174/* use this to make far-to-near assignments */
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001175# define CHECK 1
1176# define NOCHECK 0
1177# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1178# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1179# define png_strcpy _fstrcpy
1180# define png_strlen _fstrlen
1181# define png_memcmp _fmemcmp /* SJT: added */
1182# define png_memcpy _fmemcpy
1183# define png_memset _fmemset
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001184#else /* use the usual functions */
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001185# define CVT_PTR(ptr) (ptr)
1186# define CVT_PTR_NOCHECK(ptr) (ptr)
1187# define png_strcpy strcpy
1188# define png_strlen strlen
1189# define png_memcmp memcmp /* SJT: added */
1190# define png_memcpy memcpy
1191# define png_memset memset
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001192#endif
1193/* End of memory model independent support */
1194
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001195/* Just a little check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06001196 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001197 */
1198#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrsonf5ed0e12000-11-18 18:19:14 -06001199#undef PNG_ZBUF_SIZE
1200#define PNG_ZBUF_SIZE 65536
Andreas Dilger47a0c421997-05-16 02:46:07 -05001201#endif
1202
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001203#endif /* PNGCONF_H */
1204