blob: 5f757deda9766a9b35771939a67e922eba2d7ac1 [file] [log] [blame]
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -06002/* pngconf.h - machine configurable file for libpng
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06003 *
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -05004 * libpng version 1.4.0beta3 - May 10, 2006
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06005 * For conditions of distribution and use, see copyright notice in png.h
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -05006 * Copyright (c) 1998-2006 Glenn Randers-Pehrson
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05007 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06009 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050010
11/* Any machine specific code is near the front of this file, so if you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060012 * are configuring libpng for a machine, you may want to read the section
13 * starting here down to where it starts to typedef png_color, png_text,
14 * and png_info.
15 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050016
17#ifndef PNGCONF_H
18#define PNGCONF_H
19
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050020/* Added at libpng-1.4.0 */
21/* Makefile-supplied defines go here: */
22/* End of Makefile-supplied defines. */
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060023
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050024/* Added at libpng-1.2.9 */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050025
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050026/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
27#ifdef PNG_CONFIGURE_LIBPNG
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060028#ifdef HAVE_CONFIG_H
Glenn Randers-Pehrsonb0270f72006-04-15 18:23:04 -050029#include "config.h"
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050030#endif
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060031#endif
32
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060033/*
34 * Added at libpng-1.2.8
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -050035 *
36 * PNG_USER_CONFIG has to be defined on the compiler command line. This
37 * includes the resource compiler for Windows DLL configurations.
38 */
39#ifdef PNG_USER_CONFIG
40# ifndef PNG_USER_PRIVATEBUILD
41# define PNG_USER_PRIVATEBUILD
42# endif
43#include "pngusr.h"
44#endif
45
46/*
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060047 * If you create a private DLL you need to define in "pngusr.h" the followings:
48 * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
49 * the DLL was built>
50 * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
51 * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
52 * distinguish your DLL from those of the official release. These
53 * correspond to the trailing letters that come after the version
54 * number and must match your private DLL name>
55 * e.g. // private DLL "libpng13gx.dll"
56 * #define PNG_USER_DLLFNAME_POSTFIX "gx"
57 *
58 * The following macros are also at your disposal if you want to complete the
59 * DLL VERSIONINFO structure.
60 * - PNG_USER_VERSIONINFO_COMMENTS
61 * - PNG_USER_VERSIONINFO_COMPANYNAME
62 * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
63 */
64
65#ifdef __STDC__
66#ifdef SPECIALBUILD
67# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
68 are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
69#endif
70
71#ifdef PRIVATEBUILD
Glenn Randers-Pehrson3a512032006-03-31 05:29:33 -060072# pragma message("PRIVATEBUILD is deprecated.\
73 Use PNG_USER_PRIVATEBUILD instead.")
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -060074# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
75#endif
76#endif /* __STDC__ */
77
78#ifndef PNG_VERSION_INFO_ONLY
79
80/* End of material added to libpng-1.2.8 */
Glenn Randers-Pehrson878b31e2004-11-12 22:04:56 -060081
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060082/* This is the size of the compression buffer, and thus the size of
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060083 * an IDAT chunk. Make this whatever size you feel is best for your
84 * machine. One of these will be allocated per png_struct. When this
85 * is full, it writes the data to the disk, and does some other
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060086 * calculations. Making this an extremely small size will slow
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060087 * the library down, but you may want to experiment to determine
88 * where it becomes significant, if you are concerned with memory
89 * usage. Note that zlib allocates at least 32Kb also. For readers,
90 * this describes the size of the buffer available to read the data in.
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060091 * Unless this gets smaller than the size of a row (compressed),
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060092 * it should not make much difference how big this is.
93 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050094
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060095#ifndef PNG_ZBUF_SIZE
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -060096# define PNG_ZBUF_SIZE 8192
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060097#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -050098
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060099/* Enable if you want a write-only libpng */
100
101#ifndef PNG_NO_READ_SUPPORTED
102# define PNG_READ_SUPPORTED
103#endif
104
105/* Enable if you want a read-only libpng */
106
107#ifndef PNG_NO_WRITE_SUPPORTED
108# define PNG_WRITE_SUPPORTED
109#endif
110
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500111/* Enabled by default in 1.2.0. You can disable this if you don't need to
112 support PNGs that are embedded in MNG datastreams */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500113#if !defined(PNG_NO_MNG_FEATURES)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600114# ifndef PNG_MNG_FEATURES_SUPPORTED
115# define PNG_MNG_FEATURES_SUPPORTED
116# endif
117#endif
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600118
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -0600119#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600120# ifndef PNG_FLOATING_POINT_SUPPORTED
121# define PNG_FLOATING_POINT_SUPPORTED
122# endif
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500123#endif
124
Andreas Dilger47a0c421997-05-16 02:46:07 -0500125/* If you are running on a machine where you cannot allocate more
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600126 * than 64K of memory at once, uncomment this. While libpng will not
127 * normally need that much memory in a chunk (unless you load up a very
128 * large file), zlib needs to know how big of a chunk it can use, and
129 * libpng thus makes sure to check any memory allocation to verify it
130 * will fit into memory.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500131#define PNG_MAX_MALLOC_64K
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600132 */
Andreas Dilger47a0c421997-05-16 02:46:07 -0500133#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600134# define PNG_MAX_MALLOC_64K
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500135#endif
136
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500137/* Special munging to support doing things the 'cygwin' way:
138 * 'Normal' png-on-win32 defines/defaults:
139 * PNG_BUILD_DLL -- building dll
140 * PNG_USE_DLL -- building an application, linking to dll
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -0600141 * (no define) -- building static library, or building an
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500142 * application and linking to the static lib
143 * 'Cygwin' defines/defaults:
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500144 * PNG_BUILD_DLL -- (ignored) building the dll
145 * (no define) -- (ignored) building an application, linking to the dll
146 * PNG_STATIC -- (ignored) building the static lib, or building an
147 * application that links to the static lib.
148 * ALL_STATIC -- (ignored) building various static libs, or building an
149 * application that links to the static libs.
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500150 * Thus,
151 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
152 * this bit of #ifdefs will define the 'correct' config variables based on
153 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
154 * unnecessary.
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500155 *
156 * Also, the precedence order is:
157 * ALL_STATIC (since we can't #undef something outside our namespace)
158 * PNG_BUILD_DLL
159 * PNG_STATIC
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500160 * (nothing) == PNG_USE_DLL
161 *
162 * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
163 * of auto-import in binutils, we no longer need to worry about
164 * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500165 * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
166 * to __declspec() stuff. However, we DO need to worry about
167 * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
168 * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500169 */
170#if defined(__CYGWIN__)
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500171# if defined(ALL_STATIC)
172# if defined(PNG_BUILD_DLL)
173# undef PNG_BUILD_DLL
174# endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500175# if defined(PNG_USE_DLL)
176# undef PNG_USE_DLL
177# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500178# if defined(PNG_DLL)
179# undef PNG_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500180# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500181# if !defined(PNG_STATIC)
Glenn Randers-Pehrsond4e81092001-01-31 05:56:52 -0600182# define PNG_STATIC
183# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500184# else
185# if defined (PNG_BUILD_DLL)
186# if defined(PNG_STATIC)
187# undef PNG_STATIC
188# endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500189# if defined(PNG_USE_DLL)
190# undef PNG_USE_DLL
191# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500192# if !defined(PNG_DLL)
193# define PNG_DLL
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500194# endif
195# else
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500196# if defined(PNG_STATIC)
197# if defined(PNG_USE_DLL)
198# undef PNG_USE_DLL
199# endif
200# if defined(PNG_DLL)
201# undef PNG_DLL
202# endif
203# else
204# if !defined(PNG_USE_DLL)
205# define PNG_USE_DLL
206# endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500207# if !defined(PNG_DLL)
208# define PNG_DLL
209# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500210# endif
211# endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -0500212# endif
213#endif
214
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500215/* This protects us against compilers that run on a windowing system
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600216 * and thus don't have or would rather us not use the stdio types:
217 * stdin, stdout, and stderr. The only one currently used is stderr
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600218 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
219 * prevent these from being compiled and used. #defining PNG_NO_STDIO
220 * will also prevent these, plus will prevent the entire set of stdio
221 * macros and functions (FILE *, printf, etc.) from being compiled and used,
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500222 * unless (PNG_DEBUG > 0) has been #defined.
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600223 *
224 * #define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600225 * #define PNG_NO_STDIO
226 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600227
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500228#if defined(_WIN32_WCE)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600229# include <windows.h>
230 /* Console I/O functions are not supported on WindowsCE */
231# define PNG_NO_CONSOLE_IO
232# ifdef PNG_DEBUG
233# undef PNG_DEBUG
234# endif
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500235#endif
236
Glenn Randers-Pehrson1ef65b62000-05-12 06:19:53 -0500237#ifdef PNG_BUILD_DLL
238# ifndef PNG_CONSOLE_IO_SUPPORTED
239# ifndef PNG_NO_CONSOLE_IO
240# define PNG_NO_CONSOLE_IO
241# endif
242# endif
243#endif
244
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600245# ifdef PNG_NO_STDIO
246# ifndef PNG_NO_CONSOLE_IO
247# define PNG_NO_CONSOLE_IO
248# endif
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500249# ifdef PNG_DEBUG
250# if (PNG_DEBUG > 0)
251# include <stdio.h>
252# endif
253# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600254# else
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500255# include <stdio.h>
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600256# endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600257
258/* This macro protects us against machines that don't have function
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600259 * prototypes (ie K&R style headers). If your compiler does not handle
260 * function prototypes, define this macro and use the included ansi2knr.
261 * I've always been able to use _NO_PROTO as the indicator, but you may
262 * need to drag the empty declaration out in front of here, or change the
263 * ifdef to suit your own needs.
264 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500265#ifndef PNGARG
266
Andreas Dilger47a0c421997-05-16 02:46:07 -0500267#ifdef OF /* zlib prototype munger */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600268# define PNGARG(arglist) OF(arglist)
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500269#else
270
271#ifdef _NO_PROTO
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600272# define PNGARG(arglist) ()
Glenn Randers-Pehrson5cded0b2001-11-07 07:10:08 -0600273# ifndef PNG_TYPECAST_NULL
274# define PNG_TYPECAST_NULL
275# endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500276#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600277# define PNGARG(arglist) arglist
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500278#endif /* _NO_PROTO */
279
280#endif /* OF */
281
282#endif /* PNGARG */
283
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600284/* Try to determine if we are compiling on a Mac. Note that testing for
285 * just __MWERKS__ is not good enough, because the Codewarrior is now used
286 * on non-Mac platforms.
287 */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600288#ifndef MACOS
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600289# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
290 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
291# define MACOS
292# endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600293#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600294
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500295/* enough people need this for various reasons to include it here */
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500296#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600297# include <sys/types.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500298#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600299
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -0500300#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600301# define PNG_SETJMP_SUPPORTED
302#endif
303
304#ifdef PNG_SETJMP_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500305/* This is an attempt to force a single setjmp behaviour on Linux. If
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600306 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
307 */
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500308
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600309# ifdef __linux__
310# ifdef _BSD_SOURCE
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500311# define PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600312# undef _BSD_SOURCE
313# endif
314# ifdef _SETJMP_H
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -0500315 /* If you encounter a compiler error here, see the explanation
316 * near the end of INSTALL.
317 */
318 __png.h__ already includes setjmp.h;
319 __dont__ include it again.;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600320# endif
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600321# endif /* __linux__ */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500322
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600323 /* include setjmp.h for error handling */
324# include <setjmp.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500325
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600326# ifdef __linux__
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500327# ifdef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600328# define _BSD_SOURCE
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -0500329# undef PNG_SAVE_BSD_SOURCE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600330# endif
331# endif /* __linux__ */
332#endif /* PNG_SETJMP_SUPPORTED */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600333
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500334#ifdef BSD
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600335# include <strings.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500336#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600337# include <string.h>
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500338#endif
339
Andreas Dilger47a0c421997-05-16 02:46:07 -0500340/* Other defines for things like memory and the like can go here. */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500341
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600342/* The following uses const char * instead of char * for error
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600343 * and warning message functions, so some compilers won't complain.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600344 * If you do not want to use const, define PNG_NO_CONST here.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600345 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600346
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600347#ifndef PNG_NO_CONST
Guy Schalnat6d764711995-12-19 03:22:19 -0600348# define PNG_CONST const
349#else
350# define PNG_CONST
351#endif
352
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600353/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600354 * library that you will not be using. I wish I could figure out how to
355 * automate this, but I can't do that without making it seriously hard
356 * on the users. So if you are not using an ability, change the #define
357 * to and #undef, and that part of the library will not be compiled. If
358 * your linker can't find a function, you may want to make sure the
359 * ability is defined here. Some of these depend upon some others being
360 * defined. I haven't figured out all the interactions here, so you may
361 * have to experiment awhile to get everything to compile. If you are
362 * creating or using a shared library, you probably shouldn't touch this,
363 * as it will affect the size of the structures, and this will cause bad
364 * things to happen if the library and/or application ever change.
365 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500366
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500367/* Any features you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600368
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600369/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500370 * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
371 * on the compile line, then pick and choose which ones to define without
372 * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
373 * if you only want to have a png-compliant reader/writer but don't need
374 * any of the extra transformations. This saves about 80 kbytes in a
375 * typical installation of the library. (PNG_NO_* form added in version
376 * 1.0.1c, for consistency)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600377 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600378
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500379/* The size of the png_text structure changed in libpng-1.0.6 when
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600380 * iTXt support was added. iTXt support was turned off by default through
381 * libpng-1.2.x, to support old apps that malloc the png_text structure
382 * instead of calling png_set_text() and letting libpng malloc it. It
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500383 * was turned on by default in libpng-1.4.0.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500384 */
385
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600386#if !defined(PNG_NO_iTXt_SUPPORTED)
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500387# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600388# define PNG_READ_iTXt
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500389# endif
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500390# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600391# define PNG_WRITE_iTXt
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500392# endif
393#endif
394
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500395/* The following support, added after version 1.0.0, can be turned off here en
396 * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
397 * with old applications that require the length of png_struct and png_info
398 * to remain unchanged.
399 */
400
401#ifdef PNG_LEGACY_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600402# define PNG_NO_FREE_ME
403# define PNG_NO_READ_UNKNOWN_CHUNKS
404# define PNG_NO_WRITE_UNKNOWN_CHUNKS
405# define PNG_NO_READ_USER_CHUNKS
406# define PNG_NO_READ_iCCP
407# define PNG_NO_WRITE_iCCP
408# define PNG_NO_READ_iTXt
409# define PNG_NO_WRITE_iTXt
410# define PNG_NO_READ_sCAL
411# define PNG_NO_WRITE_sCAL
412# define PNG_NO_READ_sPLT
413# define PNG_NO_WRITE_sPLT
414# define PNG_NO_INFO_IMAGE
415# define PNG_NO_READ_RGB_TO_GRAY
416# define PNG_NO_READ_USER_TRANSFORM
417# define PNG_NO_WRITE_USER_TRANSFORM
418# define PNG_NO_USER_MEM
419# define PNG_NO_READ_EMPTY_PLTE
420# define PNG_NO_MNG_FEATURES
421# define PNG_NO_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500422#endif
423
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500424/* Ignore attempt to turn off both floating and fixed point support */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500425#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600426 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
427# define PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500428#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600429
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500430#ifndef PNG_NO_FREE_ME
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600431# define PNG_FREE_ME_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500432#endif
433
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600434#if defined(PNG_READ_SUPPORTED)
435
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500436#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600437 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600438# define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600439#endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600440
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600441#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600442# ifndef PNG_NO_READ_EXPAND
443# define PNG_READ_EXPAND_SUPPORTED
444# endif
445# ifndef PNG_NO_READ_SHIFT
446# define PNG_READ_SHIFT_SUPPORTED
447# endif
448# ifndef PNG_NO_READ_PACK
449# define PNG_READ_PACK_SUPPORTED
450# endif
451# ifndef PNG_NO_READ_BGR
452# define PNG_READ_BGR_SUPPORTED
453# endif
454# ifndef PNG_NO_READ_SWAP
455# define PNG_READ_SWAP_SUPPORTED
456# endif
457# ifndef PNG_NO_READ_PACKSWAP
458# define PNG_READ_PACKSWAP_SUPPORTED
459# endif
460# ifndef PNG_NO_READ_INVERT
461# define PNG_READ_INVERT_SUPPORTED
462# endif
463# ifndef PNG_NO_READ_DITHER
464# define PNG_READ_DITHER_SUPPORTED
465# endif
466# ifndef PNG_NO_READ_BACKGROUND
467# define PNG_READ_BACKGROUND_SUPPORTED
468# endif
469# ifndef PNG_NO_READ_16_TO_8
470# define PNG_READ_16_TO_8_SUPPORTED
471# endif
472# ifndef PNG_NO_READ_FILLER
473# define PNG_READ_FILLER_SUPPORTED
474# endif
475# ifndef PNG_NO_READ_GAMMA
476# define PNG_READ_GAMMA_SUPPORTED
477# endif
478# ifndef PNG_NO_READ_GRAY_TO_RGB
479# define PNG_READ_GRAY_TO_RGB_SUPPORTED
480# endif
481# ifndef PNG_NO_READ_SWAP_ALPHA
482# define PNG_READ_SWAP_ALPHA_SUPPORTED
483# endif
484# ifndef PNG_NO_READ_INVERT_ALPHA
485# define PNG_READ_INVERT_ALPHA_SUPPORTED
486# endif
487# ifndef PNG_NO_READ_STRIP_ALPHA
488# define PNG_READ_STRIP_ALPHA_SUPPORTED
489# endif
490# ifndef PNG_NO_READ_USER_TRANSFORM
491# define PNG_READ_USER_TRANSFORM_SUPPORTED
492# endif
493# ifndef PNG_NO_READ_RGB_TO_GRAY
494# define PNG_READ_RGB_TO_GRAY_SUPPORTED
495# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600496#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600497
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500498#if !defined(PNG_NO_PROGRESSIVE_READ) && \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600499 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
500# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600501#endif /* about interlacing capability! You'll */
502 /* still have interlacing unless you change the following line: */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600503
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600504#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500505
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500506#ifndef PNG_NO_READ_COMPOSITE_NODIV
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600507# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
508# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
509# endif
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500510#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500511
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500512#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \
513 defined(PNG_READ_pCAL_SUPPORTED)
514# ifndef PNG_GET_INT_32_SUPPORTED
515# define PNG_GET_INT_32_SUPPORTED
516# endif
517#endif
518
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600519#endif /* PNG_READ_SUPPORTED */
520
521#if defined(PNG_WRITE_SUPPORTED)
522
523# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
524 !defined(PNG_NO_WRITE_TRANSFORMS)
525# define PNG_WRITE_TRANSFORMS_SUPPORTED
526#endif
527
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600528#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600529# ifndef PNG_NO_WRITE_SHIFT
530# define PNG_WRITE_SHIFT_SUPPORTED
531# endif
532# ifndef PNG_NO_WRITE_PACK
533# define PNG_WRITE_PACK_SUPPORTED
534# endif
535# ifndef PNG_NO_WRITE_BGR
536# define PNG_WRITE_BGR_SUPPORTED
537# endif
538# ifndef PNG_NO_WRITE_SWAP
539# define PNG_WRITE_SWAP_SUPPORTED
540# endif
541# ifndef PNG_NO_WRITE_PACKSWAP
542# define PNG_WRITE_PACKSWAP_SUPPORTED
543# endif
544# ifndef PNG_NO_WRITE_INVERT
545# define PNG_WRITE_INVERT_SUPPORTED
546# endif
547# ifndef PNG_NO_WRITE_FILLER
548# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
549# endif
550# ifndef PNG_NO_WRITE_SWAP_ALPHA
551# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
552# endif
553# ifndef PNG_NO_WRITE_INVERT_ALPHA
554# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
555# endif
556# ifndef PNG_NO_WRITE_USER_TRANSFORM
557# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
558# endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600559#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600560
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600561#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
562 !defined(PNG_WRITE_INTERLACING_SUPPORTED)
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600563#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
564 encoders, but can cause trouble
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600565 if left undefined */
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600566#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600567
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500568#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600569 !defined(PNG_WRITE_WEIGHTED_FILTER) && \
Glenn Randers-Pehrson38e6e772000-04-09 19:06:13 -0500570 defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600571# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500572#endif
573
574#ifndef PNG_NO_WRITE_FLUSH
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600575# define PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500576#endif
577
Glenn Randers-Pehrson86dc9812006-05-10 07:27:44 -0500578#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \
579 defined(PNG_WRITE_pCAL_SUPPORTED)
580# ifndef PNG_SAVE_INT_32_SUPPORTED
581# define PNG_SAVE_INT_32_SUPPORTED
582# endif
583#endif
584
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600585#endif /* PNG_WRITE_SUPPORTED */
586
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500587#ifndef PNG_NO_ERROR_NUMBERS
588# define PNG_ERROR_NUMBERS_SUPPORTED
589#endif
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500590
591#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
592 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
593# ifndef PNG_NO_USER_TRANSFORM_PTR
594# define PNG_USER_TRANSFORM_PTR_SUPPORTED
595# endif
596#endif
597
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500598#ifndef PNG_NO_STDIO
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600599# define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600600#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500601
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600602/* This adds extra functions in pngget.c for accessing data from the
603 * info pointer (added in version 0.99)
604 * png_get_image_width()
605 * png_get_image_height()
606 * png_get_bit_depth()
607 * png_get_color_type()
608 * png_get_compression_type()
609 * png_get_filter_type()
610 * png_get_interlace_type()
611 * png_get_pixel_aspect_ratio()
612 * png_get_pixels_per_meter()
613 * png_get_x_offset_pixels()
614 * png_get_y_offset_pixels()
615 * png_get_x_offset_microns()
616 * png_get_y_offset_microns()
617 */
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500618#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600619# define PNG_EASY_ACCESS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600620#endif
621
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500622/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
Glenn Randers-Pehrsoncdf140b2001-01-15 12:22:32 -0600623 even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500624#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
625# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
626# define PNG_ASSEMBLER_CODE_SUPPORTED
627# endif
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -0600628# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
629 defined(__MMX__)
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500630# define PNG_MMX_CODE_SUPPORTED
631# endif
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -0600632# if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500633 !defined(PNG_USE_PNGVCRD) && defined(__MMX__)
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -0600634# define PNG_USE_PNGGCCRD
635# endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500636#endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500637
Glenn Randers-Pehrson1ea0ff32001-08-07 22:25:59 -0500638/* If you are sure that you don't need thread safety and you are compiling
639 with PNG_USE_PNGCCRD for an MMX application, you can define this for
640 faster execution. See pnggccrd.c.
641#define PNG_THREAD_UNSAFE_OK
642*/
643
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -0500644#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
645# define PNG_USER_MEM_SUPPORTED
646#endif
647
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500648/* Added at libpng-1.2.6 */
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500649#ifndef PNG_SET_USER_LIMITS_SUPPORTED
650#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
651# define PNG_SET_USER_LIMITS_SUPPORTED
652#endif
653#endif
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500654
655/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
656 * how large, set these limits to 0x7fffffffL
657 */
658#ifndef PNG_USER_WIDTH_MAX
659# define PNG_USER_WIDTH_MAX 1000000L
660#endif
661#ifndef PNG_USER_HEIGHT_MAX
662# define PNG_USER_HEIGHT_MAX 1000000L
663#endif
664
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600665/* These are currently experimental features, define them if you want */
666
667/* very little testing */
668/*
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600669#ifdef PNG_READ_SUPPORTED
670# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
671# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
672# endif
673#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600674*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500675
676/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600677/* some testing */
678/*
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500679#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
680# define PNG_READ_BIG_ENDIAN_SUPPORTED
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600681#endif
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600682*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500683
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500684/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
685/*
686#define PNG_NO_POINTER_INDEXING
687*/
688
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600689/* These functions are turned off by default, as they will be phased out. */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600690/*
691#define PNG_USELESS_TESTS_SUPPORTED
692#define PNG_CORRECT_PALETTE_SUPPORTED
693*/
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600694
Andreas Dilger47a0c421997-05-16 02:46:07 -0500695/* Any chunks you are not interested in, you can undef here. The
696 * ones that allocate memory may be expecially important (hIST,
697 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600698 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500699 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500700
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600701#if defined(PNG_READ_SUPPORTED) && \
702 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500703 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600704# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600705#endif
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600706
707#if defined(PNG_WRITE_SUPPORTED) && \
708 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500709 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600710# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600711#endif
712
713#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600714
715#ifdef PNG_NO_READ_TEXT
716# define PNG_NO_READ_iTXt
717# define PNG_NO_READ_tEXt
718# define PNG_NO_READ_zTXt
719#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500720#ifndef PNG_NO_READ_bKGD
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600721# define PNG_READ_bKGD_SUPPORTED
722# define PNG_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500723#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500724#ifndef PNG_NO_READ_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600725# define PNG_READ_cHRM_SUPPORTED
726# define PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500727#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500728#ifndef PNG_NO_READ_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600729# define PNG_READ_gAMA_SUPPORTED
730# define PNG_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500731#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500732#ifndef PNG_NO_READ_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600733# define PNG_READ_hIST_SUPPORTED
734# define PNG_hIST_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600735#endif
736#ifndef PNG_NO_READ_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600737# define PNG_READ_iCCP_SUPPORTED
738# define PNG_iCCP_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600739#endif
740#ifndef PNG_NO_READ_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500741# ifndef PNG_READ_iTXt_SUPPORTED
742# define PNG_READ_iTXt_SUPPORTED
743# endif
744# ifndef PNG_iTXt_SUPPORTED
745# define PNG_iTXt_SUPPORTED
746# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500747#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500748#ifndef PNG_NO_READ_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600749# define PNG_READ_oFFs_SUPPORTED
750# define PNG_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500751#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500752#ifndef PNG_NO_READ_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600753# define PNG_READ_pCAL_SUPPORTED
754# define PNG_pCAL_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600755#endif
756#ifndef PNG_NO_READ_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600757# define PNG_READ_sCAL_SUPPORTED
758# define PNG_sCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500759#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500760#ifndef PNG_NO_READ_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600761# define PNG_READ_pHYs_SUPPORTED
762# define PNG_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500763#endif
764#ifndef PNG_NO_READ_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600765# define PNG_READ_sBIT_SUPPORTED
766# define PNG_sBIT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600767#endif
768#ifndef PNG_NO_READ_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600769# define PNG_READ_sPLT_SUPPORTED
770# define PNG_sPLT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500771#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500772#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600773# define PNG_READ_sRGB_SUPPORTED
774# define PNG_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500775#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500776#ifndef PNG_NO_READ_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600777# define PNG_READ_tEXt_SUPPORTED
778# define PNG_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500779#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500780#ifndef PNG_NO_READ_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600781# define PNG_READ_tIME_SUPPORTED
782# define PNG_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500783#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500784#ifndef PNG_NO_READ_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600785# define PNG_READ_tRNS_SUPPORTED
786# define PNG_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500787#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500788#ifndef PNG_NO_READ_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600789# define PNG_READ_zTXt_SUPPORTED
790# define PNG_zTXt_SUPPORTED
791#endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500792#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
793# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -0500794# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
795# define PNG_UNKNOWN_CHUNKS_SUPPORTED
796# endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500797# ifndef PNG_NO_HANDLE_AS_UNKNOWN
798# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
799# endif
800#endif
Glenn Randers-Pehrson3d5a5202000-07-01 15:37:28 -0500801#if !defined(PNG_NO_READ_USER_CHUNKS) && \
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500802 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600803# define PNG_READ_USER_CHUNKS_SUPPORTED
804# define PNG_USER_CHUNKS_SUPPORTED
805# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
806# undef PNG_NO_READ_UNKNOWN_CHUNKS
807# endif
808# ifdef PNG_NO_HANDLE_AS_UNKNOWN
809# undef PNG_NO_HANDLE_AS_UNKNOWN
810# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600811#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500812#ifndef PNG_NO_READ_OPT_PLTE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600813# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
814#endif /* optional PLTE chunk in RGB and RGBA images */
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600815#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600816 defined(PNG_READ_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600817# define PNG_READ_TEXT_SUPPORTED
818# define PNG_TEXT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600819#endif
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600820
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600821#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500822
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600823#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600824
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600825#ifdef PNG_NO_WRITE_TEXT
826# define PNG_NO_WRITE_iTXt
827# define PNG_NO_WRITE_tEXt
828# define PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600829#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600830#ifndef PNG_NO_WRITE_bKGD
831# define PNG_WRITE_bKGD_SUPPORTED
832# ifndef PNG_bKGD_SUPPORTED
833# define PNG_bKGD_SUPPORTED
834# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500835#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500836#ifndef PNG_NO_WRITE_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600837# define PNG_WRITE_cHRM_SUPPORTED
838# ifndef PNG_cHRM_SUPPORTED
839# define PNG_cHRM_SUPPORTED
840# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500841#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500842#ifndef PNG_NO_WRITE_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600843# define PNG_WRITE_gAMA_SUPPORTED
844# ifndef PNG_gAMA_SUPPORTED
845# define PNG_gAMA_SUPPORTED
846# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500847#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500848#ifndef PNG_NO_WRITE_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600849# define PNG_WRITE_hIST_SUPPORTED
850# ifndef PNG_hIST_SUPPORTED
851# define PNG_hIST_SUPPORTED
852# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600853#endif
854#ifndef PNG_NO_WRITE_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600855# define PNG_WRITE_iCCP_SUPPORTED
856# ifndef PNG_iCCP_SUPPORTED
857# define PNG_iCCP_SUPPORTED
858# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600859#endif
860#ifndef PNG_NO_WRITE_iTXt
Glenn Randers-Pehrson5a0be342001-10-18 20:55:13 -0500861# ifndef PNG_WRITE_iTXt_SUPPORTED
862# define PNG_WRITE_iTXt_SUPPORTED
863# endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600864# ifndef PNG_iTXt_SUPPORTED
865# define PNG_iTXt_SUPPORTED
866# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500867#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500868#ifndef PNG_NO_WRITE_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600869# define PNG_WRITE_oFFs_SUPPORTED
870# ifndef PNG_oFFs_SUPPORTED
871# define PNG_oFFs_SUPPORTED
872# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500873#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500874#ifndef PNG_NO_WRITE_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600875# define PNG_WRITE_pCAL_SUPPORTED
876# ifndef PNG_pCAL_SUPPORTED
877# define PNG_pCAL_SUPPORTED
878# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600879#endif
880#ifndef PNG_NO_WRITE_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600881# define PNG_WRITE_sCAL_SUPPORTED
882# ifndef PNG_sCAL_SUPPORTED
883# define PNG_sCAL_SUPPORTED
884# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500885#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500886#ifndef PNG_NO_WRITE_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600887# define PNG_WRITE_pHYs_SUPPORTED
888# ifndef PNG_pHYs_SUPPORTED
889# define PNG_pHYs_SUPPORTED
890# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500891#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500892#ifndef PNG_NO_WRITE_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600893# define PNG_WRITE_sBIT_SUPPORTED
894# ifndef PNG_sBIT_SUPPORTED
895# define PNG_sBIT_SUPPORTED
896# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600897#endif
898#ifndef PNG_NO_WRITE_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600899# define PNG_WRITE_sPLT_SUPPORTED
900# ifndef PNG_sPLT_SUPPORTED
901# define PNG_sPLT_SUPPORTED
902# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500903#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500904#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600905# define PNG_WRITE_sRGB_SUPPORTED
906# ifndef PNG_sRGB_SUPPORTED
907# define PNG_sRGB_SUPPORTED
908# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500909#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500910#ifndef PNG_NO_WRITE_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600911# define PNG_WRITE_tEXt_SUPPORTED
912# ifndef PNG_tEXt_SUPPORTED
913# define PNG_tEXt_SUPPORTED
914# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500915#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500916#ifndef PNG_NO_WRITE_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600917# define PNG_WRITE_tIME_SUPPORTED
918# ifndef PNG_tIME_SUPPORTED
919# define PNG_tIME_SUPPORTED
920# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500921#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500922#ifndef PNG_NO_WRITE_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600923# define PNG_WRITE_tRNS_SUPPORTED
924# ifndef PNG_tRNS_SUPPORTED
925# define PNG_tRNS_SUPPORTED
926# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500927#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500928#ifndef PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600929# define PNG_WRITE_zTXt_SUPPORTED
930# ifndef PNG_zTXt_SUPPORTED
931# define PNG_zTXt_SUPPORTED
932# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600933#endif
934#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600935# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
936# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
937# define PNG_UNKNOWN_CHUNKS_SUPPORTED
938# endif
939# ifndef PNG_NO_HANDLE_AS_UNKNOWN
940# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
941# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
942# endif
943# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600944#endif
945#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600946 defined(PNG_WRITE_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600947# define PNG_WRITE_TEXT_SUPPORTED
948# ifndef PNG_TEXT_SUPPORTED
949# define PNG_TEXT_SUPPORTED
950# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500951#endif
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600952
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600953#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500954
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600955/* Turn this off to disable png_read_png() and
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600956 * png_write_png() and leave the row_pointers member
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600957 * out of the info structure.
958 */
959#ifndef PNG_NO_INFO_IMAGE
960# define PNG_INFO_IMAGE_SUPPORTED
961#endif
962
Andreas Dilger47a0c421997-05-16 02:46:07 -0500963/* need the time information for reading tIME chunks */
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600964#if defined(PNG_tIME_SUPPORTED)
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -0500965# if !defined(_WIN32_WCE)
966 /* "time.h" functions are not supported on WindowsCE */
967# include <time.h>
968# endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500969#endif
970
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600971/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -0500972 * common platforms. The typedefs should be at least as large as the
973 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
974 * don't have to be exactly that size. Some compilers dislike passing
975 * unsigned shorts as function parameters, so you may be better off using
976 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
977 * want to have unsigned int for png_uint_32 instead of unsigned long.
978 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500979
980typedef unsigned long png_uint_32;
981typedef long png_int_32;
982typedef unsigned short png_uint_16;
983typedef short png_int_16;
984typedef unsigned char png_byte;
985
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600986/* This is usually size_t. It is typedef'ed just in case you need it to
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500987 change (I'm not sure if you will or not, so I thought I'd be safe) */
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -0500988#ifdef PNG_SIZE_T
989 typedef PNG_SIZE_T png_size_t;
990# define png_sizeof(x) png_convert_size(sizeof (x))
991#else
992 typedef size_t png_size_t;
993# define png_sizeof(x) sizeof (x)
994#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500995
Andreas Dilger47a0c421997-05-16 02:46:07 -0500996/* The following is needed for medium model support. It cannot be in the
997 * PNG_INTERNAL section. Needs modification for other compilers besides
998 * MSC. Model independent support declares all arrays and pointers to be
999 * large using the far keyword. The zlib version used must also support
1000 * model independent data. As of version zlib 1.0.4, the necessary changes
1001 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
1002 * changes that are needed. (Tim Wegner)
1003 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001004
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001005/* Separate compiler dependencies (problem here is that zlib.h always
1006 defines FAR. (SJT) */
Guy Schalnat6d764711995-12-19 03:22:19 -06001007#ifdef __BORLANDC__
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001008# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1009# define LDATA 1
1010# else
1011# define LDATA 0
1012# endif
1013 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
1014# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1015# define PNG_MAX_MALLOC_64K
1016# if (LDATA != 1)
1017# ifndef FAR
1018# define FAR __far
1019# endif
1020# define USE_FAR_KEYWORD
1021# endif /* LDATA != 1 */
1022 /* Possibly useful for moving data out of default segment.
1023 * Uncomment it if you want. Could also define FARDATA as
1024 * const if your compiler supports it. (SJT)
1025# define FARDATA FAR
1026 */
1027# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
Guy Schalnatb2e01bd1996-01-26 01:38:47 -06001028#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -06001029
1030
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001031/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001032 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1033 * making reliance oncertain keywords suspect. (SJT)
1034 */
Guy Schalnat6d764711995-12-19 03:22:19 -06001035
1036/* MSC Medium model */
1037#if defined(FAR)
1038# if defined(M_I86MM)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001039# define USE_FAR_KEYWORD
1040# define FARDATA FAR
1041# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -06001042# endif
1043#endif
1044
1045/* SJT: default case */
1046#ifndef FAR
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001047# define FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001048#endif
1049
Andreas Dilger47a0c421997-05-16 02:46:07 -05001050/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -06001051#ifndef FARDATA
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001052# define FARDATA
Guy Schalnat6d764711995-12-19 03:22:19 -06001053#endif
1054
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001055/* Typedef for floating-point numbers that are converted
1056 to fixed-point with a multiple of 100,000, e.g., int_gamma */
1057typedef png_int_32 png_fixed_point;
1058
Andreas Dilger47a0c421997-05-16 02:46:07 -05001059/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001060typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001061typedef png_byte FAR * png_bytep;
1062typedef png_uint_32 FAR * png_uint_32p;
1063typedef png_int_32 FAR * png_int_32p;
1064typedef png_uint_16 FAR * png_uint_16p;
1065typedef png_int_16 FAR * png_int_16p;
1066typedef PNG_CONST char FAR * png_const_charp;
1067typedef char FAR * png_charp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001068typedef png_fixed_point FAR * png_fixed_point_p;
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001069
1070#ifndef PNG_NO_STDIO
Glenn Randers-Pehrson316f97a2000-07-08 13:19:41 -05001071#if defined(_WIN32_WCE)
1072typedef HANDLE png_FILE_p;
1073#else
1074typedef FILE * png_FILE_p;
1075#endif
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -06001076#endif
1077
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001078#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001079typedef double FAR * png_doublep;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001080#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001081
Andreas Dilger47a0c421997-05-16 02:46:07 -05001082/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -06001083typedef png_byte FAR * FAR * png_bytepp;
1084typedef png_uint_32 FAR * FAR * png_uint_32pp;
1085typedef png_int_32 FAR * FAR * png_int_32pp;
1086typedef png_uint_16 FAR * FAR * png_uint_16pp;
1087typedef png_int_16 FAR * FAR * png_int_16pp;
1088typedef PNG_CONST char FAR * FAR * png_const_charpp;
1089typedef char FAR * FAR * png_charpp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06001090typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001091#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -05001092typedef double FAR * FAR * png_doublepp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001093#endif
Guy Schalnat6d764711995-12-19 03:22:19 -06001094
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001095/* Pointers to pointers to pointers; i.e., pointer to array */
Andreas Dilger47a0c421997-05-16 02:46:07 -05001096typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -06001097
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001098/*
1099 * Define PNG_BUILD_DLL if the module being built is a Windows
1100 * LIBPNG DLL.
1101 *
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001102 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
Glenn Randers-Pehrsond4e81092001-01-31 05:56:52 -06001103 * It is equivalent to Microsoft predefined macro _DLL that is
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001104 * automatically defined when you compile using the share
1105 * version of the CRT (C Run-Time library)
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001106 *
1107 * The cygwin mods make this behavior a little different:
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001108 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1109 * Define PNG_STATIC if you are building a static library for use with cygwin,
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001110 * -or- if you are building an application that you want to link to the
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001111 * static library.
1112 * PNG_USE_DLL is defined by default (no user action needed) unless one of
1113 * the other flags is defined.
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001114 */
1115
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05001116#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001117# define PNG_DLL
1118#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001119/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1120 * When building a static lib, default to no GLOBAL ARRAYS, but allow
1121 * command-line override
1122 */
1123#if defined(__CYGWIN__)
1124# if !defined(PNG_STATIC)
1125# if defined(PNG_USE_GLOBAL_ARRAYS)
1126# undef PNG_USE_GLOBAL_ARRAYS
1127# endif
1128# if !defined(PNG_USE_LOCAL_ARRAYS)
1129# define PNG_USE_LOCAL_ARRAYS
1130# endif
1131# else
1132# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1133# if defined(PNG_USE_GLOBAL_ARRAYS)
1134# undef PNG_USE_GLOBAL_ARRAYS
1135# endif
1136# endif
1137# endif
1138# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1139# define PNG_USE_LOCAL_ARRAYS
1140# endif
1141#endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001142
Glenn Randers-Pehrsonec61c232000-05-16 06:17:36 -05001143/* Do not use global arrays (helps with building DLL's)
1144 * They are no longer used in libpng itself, since version 1.0.5c,
1145 * but might be required for some pre-1.0.5c applications.
1146 */
1147#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1148# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
1149# define PNG_USE_LOCAL_ARRAYS
1150# else
1151# define PNG_USE_GLOBAL_ARRAYS
1152# endif
1153#endif
1154
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001155#if defined(__CYGWIN__)
1156# undef PNGAPI
1157# define PNGAPI __cdecl
1158# undef PNG_IMPEXP
1159# define PNG_IMPEXP
1160#endif
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001161
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -05001162/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1163 * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1164 * Don't ignore those warnings; you must also reset the default calling
1165 * convention in your compiler to match your PNGAPI, and you must build
1166 * zlib and your applications the same way you build libpng.
1167 */
1168
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -05001169#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001170# ifndef PNG_NO_MODULEDEF
1171# define PNG_NO_MODULEDEF
1172# endif
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -06001173#endif
1174
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001175#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001176# define PNG_IMPEXP
1177#endif
1178
1179#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001180 (( defined(_Windows) || defined(_WINDOWS) || \
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05001181 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001182
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001183# ifndef PNGAPI
1184# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1185# define PNGAPI __cdecl
1186# else
1187# define PNGAPI _cdecl
1188# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001189# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001190
1191# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1192 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1193# define PNG_IMPEXP
1194# endif
1195
1196# if !defined(PNG_IMPEXP)
1197
1198# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
1199# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
1200
1201 /* Borland/Microsoft */
1202# if defined(_MSC_VER) || defined(__BORLANDC__)
1203# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1204# define PNG_EXPORT PNG_EXPORT_TYPE1
1205# else
1206# define PNG_EXPORT PNG_EXPORT_TYPE2
1207# if defined(PNG_BUILD_DLL)
1208# define PNG_IMPEXP __export
1209# else
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -05001210# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
1211 VC++ */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001212# endif /* Exists in Borland C++ for
1213 C++ classes (== huge) */
1214# endif
1215# endif
1216
1217# if !defined(PNG_IMPEXP)
1218# if defined(PNG_BUILD_DLL)
1219# define PNG_IMPEXP __declspec(dllexport)
1220# else
1221# define PNG_IMPEXP __declspec(dllimport)
1222# endif
1223# endif
1224# endif /* PNG_IMPEXP */
Glenn Randers-Pehrsona4d54bd2000-07-14 08:15:12 -05001225#else /* !(DLL || non-cygwin WINDOWS) */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001226# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
1227# ifndef PNGAPI
1228# define PNGAPI _System
Glenn Randers-Pehrsonf64a06f2001-04-11 07:38:00 -05001229# endif
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001230# else
1231# if 0 /* ... other platforms, with other meanings */
1232# endif
1233# endif
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001234#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001235
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -06001236#ifndef PNGAPI
1237# define PNGAPI
1238#endif
1239#ifndef PNG_IMPEXP
1240# define PNG_IMPEXP
1241#endif
1242
Glenn Randers-Pehrsonc3dda6d2004-11-27 18:22:29 -06001243#ifdef PNG_BUILDSYMS
1244# ifndef PNG_EXPORT
1245# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1246# endif
1247# ifdef PNG_USE_GLOBAL_ARRAYS
1248# ifndef PNG_EXPORT_VAR
1249# define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
1250# endif
1251# endif
1252#endif
1253
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05001254#ifndef PNG_EXPORT
Glenn Randers-Pehrson13944802000-06-24 07:42:42 -05001255# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001256#endif
1257
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001258#ifdef PNG_USE_GLOBAL_ARRAYS
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001259# ifndef PNG_EXPORT_VAR
1260# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1261# endif
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001262#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -05001263
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -05001264/* User may want to use these so they are not in PNG_INTERNAL. Any library
1265 * functions that are passed far data must be model independent.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001266 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001267
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001268#ifdef PNG_SETJMP_SUPPORTED
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001269# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -06001270#else
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001271# define png_jmpbuf(png_ptr) \
1272 (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -06001273#endif
1274
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001275/* memory model/platform independent fns */
1276#ifndef PNG_ABORT
1277# ifdef _WINDOWS_
1278# define PNG_ABORT() ExitProcess(0)
1279# else
1280# define PNG_ABORT() abort()
1281# endif
1282#endif
1283
1284#if defined(USE_FAR_KEYWORD)
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06001285/* use this to make far-to-near assignments */
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001286# define CHECK 1
1287# define NOCHECK 0
1288# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1289# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001290# define png_strcpy _fstrcpy
1291# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
1292# define png_strlen _fstrlen
1293# define png_memcmp _fmemcmp /* SJT: added */
1294# define png_memcpy _fmemcpy
1295# define png_memset _fmemset
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001296# define png_sprintf sprintf
1297#else
1298# if defined(_WINDOWS_) /* favor Windows over C runtime fns */
1299# define CVT_PTR(ptr) (ptr)
1300# define CVT_PTR_NOCHECK(ptr) (ptr)
1301# define png_strcpy lstrcpyA
1302# define png_strncpy lstrcpynA
1303# define png_strlen lstrlenA
1304# define png_memcmp memcmp
1305# define png_memcpy CopyMemory
1306# define png_memset memset
1307# define png_sprintf wsprintfA
1308# else
1309# define CVT_PTR(ptr) (ptr)
1310# define CVT_PTR_NOCHECK(ptr) (ptr)
1311# define png_strcpy strcpy
1312# define png_strncpy strncpy /* Added to v 1.2.6 */
1313# define png_strlen strlen
1314# define png_memcmp memcmp /* SJT: added */
1315# define png_memcpy memcpy
1316# define png_memset memset
1317# define png_sprintf sprintf
1318# endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001319#endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -05001320
1321#if defined(__TURBOC__) && !defined(__FLAT__)
1322# define png_mem_alloc farmalloc
1323# define png_mem_free farfree
1324 typedef unsigned long png_mem_size_t;
1325#else
1326# if defined(_MSC_VER) && defined(MAXSEG_64K)
1327# define png_mem_alloc(s) halloc(s, 1)
1328# define png_mem_free hfree
1329 typedef unsigned long png_mem_size_t;
1330#else
1331# if defined(_WINDOWS_)
1332# define png_mem_alloc(s) HeapAlloc(GetProcessHeap(), 0, s)
1333# define png_mem_free(p) HeapFree(GetProcessHeap(), 0, p)
1334 typedef SIZE_T png_mem_size_t;
1335# else
1336# define png_mem_alloc malloc
1337# define png_mem_free free
1338 typedef size_t png_mem_size_t;
1339# endif
1340# endif
1341#endif
1342/* End of memory model/platform independent support */
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001343
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -06001344/* Just a little check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06001345 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -05001346 */
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001347#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001348# undef PNG_ZBUF_SIZE
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -05001349# define PNG_ZBUF_SIZE 65536L
Andreas Dilger47a0c421997-05-16 02:46:07 -05001350#endif
1351
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -06001352
Glenn Randers-Pehrson5dd2b8e2004-11-24 07:50:16 -06001353/* Added at libpng-1.2.8 */
1354#endif /* PNG_VERSION_INFO_ONLY */
Glenn Randers-Pehrson40936072004-11-20 11:18:40 -06001355
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001356#endif /* PNGCONF_H */