blob: 16e1e7785569e3679daf52a6809662b14157c9f4 [file] [log] [blame]
Guy Schalnat51f0eb41995-09-26 05:22:39 -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-Pehrson61c32d92000-02-04 23:40:16 -06004 * libpng 1.0.5q - February 5, 2000
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06005 * For conditions of distribution and use, see copyright notice in png.h
6 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
7 * Copyright (c) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -06008 * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
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
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060020/* This is the size of the compression buffer, and thus the size of
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060021 * an IDAT chunk. Make this whatever size you feel is best for your
22 * machine. One of these will be allocated per png_struct. When this
23 * is full, it writes the data to the disk, and does some other
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060024 * calculations. Making this an extremely small size will slow
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060025 * the library down, but you may want to experiment to determine
26 * where it becomes significant, if you are concerned with memory
27 * usage. Note that zlib allocates at least 32Kb also. For readers,
28 * this describes the size of the buffer available to read the data in.
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060029 * Unless this gets smaller than the size of a row (compressed),
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060030 * it should not make much difference how big this is.
31 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050032
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060033#ifndef PNG_ZBUF_SIZE
Guy Schalnatb2e01bd1996-01-26 01:38:47 -060034#define PNG_ZBUF_SIZE 8192
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060035#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -050036
Andreas Dilger47a0c421997-05-16 02:46:07 -050037/* If you are running on a machine where you cannot allocate more
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060038 * than 64K of memory at once, uncomment this. While libpng will not
39 * normally need that much memory in a chunk (unless you load up a very
40 * large file), zlib needs to know how big of a chunk it can use, and
41 * libpng thus makes sure to check any memory allocation to verify it
42 * will fit into memory.
Andreas Dilger47a0c421997-05-16 02:46:07 -050043#define PNG_MAX_MALLOC_64K
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060044 */
Andreas Dilger47a0c421997-05-16 02:46:07 -050045#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
46#define PNG_MAX_MALLOC_64K
Guy Schalnat51f0eb41995-09-26 05:22:39 -050047#endif
48
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -050049/* This protects us against compilers that run on a windowing system
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060050 * and thus don't have or would rather us not use the stdio types:
51 * stdin, stdout, and stderr. The only one currently used is stderr
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060052 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
53 * prevent these from being compiled and used. #defining PNG_NO_STDIO
54 * will also prevent these, plus will prevent the entire set of stdio
55 * macros and functions (FILE *, printf, etc.) from being compiled and used,
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050056 * unless (PNG_DEBUG > 0) has been #defined.
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060057 *
58 * #define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060059 * #define PNG_NO_STDIO
60 */
Guy Schalnat6d764711995-12-19 03:22:19 -060061
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060062# ifdef PNG_NO_STDIO
63# ifndef PNG_NO_CONSOLE_IO
64# define PNG_NO_CONSOLE_IO
65# endif
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050066# ifdef PNG_DEBUG
67# if (PNG_DEBUG > 0)
68# include <stdio.h>
69# endif
70# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060071# else
72# include <stdio.h>
73# endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060074
75/* This macro protects us against machines that don't have function
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060076 * prototypes (ie K&R style headers). If your compiler does not handle
77 * function prototypes, define this macro and use the included ansi2knr.
78 * I've always been able to use _NO_PROTO as the indicator, but you may
79 * need to drag the empty declaration out in front of here, or change the
80 * ifdef to suit your own needs.
81 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050082#ifndef PNGARG
83
Andreas Dilger47a0c421997-05-16 02:46:07 -050084#ifdef OF /* zlib prototype munger */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050085#define PNGARG(arglist) OF(arglist)
86#else
87
88#ifdef _NO_PROTO
Guy Schalnat6d764711995-12-19 03:22:19 -060089#define PNGARG(arglist) ()
Guy Schalnat51f0eb41995-09-26 05:22:39 -050090#else
91#define PNGARG(arglist) arglist
92#endif /* _NO_PROTO */
93
94#endif /* OF */
95
96#endif /* PNGARG */
97
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060098/* Try to determine if we are compiling on a Mac. Note that testing for
99 * just __MWERKS__ is not good enough, because the Codewarrior is now used
100 * on non-Mac platforms.
101 */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600102#ifndef MACOS
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600103#if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600104 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600105#define MACOS
106#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600107#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600108
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500109/* enough people need this for various reasons to include it here */
Guy Schalnate5a37791996-06-05 15:50:50 -0500110#if !defined(MACOS) && !defined(RISCOS)
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500111#include <sys/types.h>
112#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600113
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600114#ifndef PNG_SETJMP_NOT_SUPPORTED
115# define PNG_SETJMP_SUPPORTED
116#endif
117
118#ifdef PNG_SETJMP_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500119/* This is an attempt to force a single setjmp behaviour on Linux. If
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600120 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
121 */
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600122# ifdef __linux__
123# ifdef _BSD_SOURCE
124# define _PNG_SAVE_BSD_SOURCE
125# undef _BSD_SOURCE
126# endif
127# ifdef _SETJMP_H
128 __png.h__ already includes setjmp.h
129 __dont__ include it again
130# endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600131#endif /* __linux__ */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500132
133/* include setjmp.h for error handling */
134#include <setjmp.h>
135
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600136# ifdef __linux__
137# ifdef _PNG_SAVE_BSD_SOURCE
138# define _BSD_SOURCE
139# undef _PNG_SAVE_BSD_SOURCE
140# endif
141# endif /* __linux__ */
142#endif /* PNG_SETJMP_SUPPORTED */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600143
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500144#ifdef BSD
145#include <strings.h>
146#else
147#include <string.h>
148#endif
149
Andreas Dilger47a0c421997-05-16 02:46:07 -0500150/* Other defines for things like memory and the like can go here. */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500151#ifdef PNG_INTERNAL
152#include <stdlib.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500153
154/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
155 * aren't usually used outside the library (as far as I know), so it is
156 * debatable if they should be exported at all. In the future, when it is
157 * possible to have run-time registry of chunk-handling functions, some of
158 * these will be made available again.
159#define PNG_EXTERN extern
160 */
161#define PNG_EXTERN
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500162
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600163/* Other defines specific to compilers can go here. Try to keep
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600164 * them inside an appropriate ifdef/endif pair for portability.
165 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500166
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600167#if !defined(PNG_NO_FLOATING_POINT_SUPPORTED)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500168#if defined(MACOS)
169/* We need to check that <math.h> hasn't already been included earlier
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600170 * as it seems it doesn't agree with <fp.h>, yet we should really use
171 * <fp.h> if possible.
172 */
Andreas Dilger47a0c421997-05-16 02:46:07 -0500173#if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600174#include <fp.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500175#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600176#else
177#include <math.h>
178#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600179#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600180
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600181/* Codewarrior on NT has linking problems without this. */
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500182#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600183#define PNG_ALWAYS_EXTERN
184#endif
185
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600186/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600187 * stdlib.h like it should (I think). Or perhaps this is a C++
188 * "feature"?
189 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500190#ifdef __TURBOC__
191#include <mem.h>
192#include "alloc.h"
193#endif
194
195#ifdef _MSC_VER
196#include <malloc.h>
197#endif
198
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600199/* This controls how fine the dithering gets. As this allocates
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600200 * a largish chunk of memory (32K), those who are not as concerned
201 * with dithering quality can decrease some or all of these.
202 */
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600203#ifndef PNG_DITHER_RED_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500204#define PNG_DITHER_RED_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600205#endif
206#ifndef PNG_DITHER_GREEN_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500207#define PNG_DITHER_GREEN_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600208#endif
209#ifndef PNG_DITHER_BLUE_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500210#define PNG_DITHER_BLUE_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600211#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500212
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600213/* This controls how fine the gamma correction becomes when you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600214 * are only interested in 8 bits anyway. Increasing this value
215 * results in more memory being used, and more pow() functions
216 * being called to fill in the gamma tables. Don't set this value
217 * less then 8, and even that may not work (I haven't tested it).
218 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500219
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600220#ifndef PNG_MAX_GAMMA_8
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500221#define PNG_MAX_GAMMA_8 11
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600222#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500223
Andreas Dilger47a0c421997-05-16 02:46:07 -0500224/* This controls how much a difference in gamma we can tolerate before
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600225 * we actually start doing gamma conversion.
226 */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600227#ifndef PNG_GAMMA_THRESHOLD
Andreas Dilger47a0c421997-05-16 02:46:07 -0500228#define PNG_GAMMA_THRESHOLD 0.05
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600229#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500230
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500231#endif /* PNG_INTERNAL */
232
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600233/* The following uses const char * instead of char * for error
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600234 * and warning message functions, so some compilers won't complain.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600235 * If you do not want to use const, define PNG_NO_CONST here.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600236 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600237
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600238#ifndef PNG_NO_CONST
Guy Schalnat6d764711995-12-19 03:22:19 -0600239# define PNG_CONST const
240#else
241# define PNG_CONST
242#endif
243
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600244/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600245 * library that you will not be using. I wish I could figure out how to
246 * automate this, but I can't do that without making it seriously hard
247 * on the users. So if you are not using an ability, change the #define
248 * to and #undef, and that part of the library will not be compiled. If
249 * your linker can't find a function, you may want to make sure the
250 * ability is defined here. Some of these depend upon some others being
251 * defined. I haven't figured out all the interactions here, so you may
252 * have to experiment awhile to get everything to compile. If you are
253 * creating or using a shared library, you probably shouldn't touch this,
254 * as it will affect the size of the structures, and this will cause bad
255 * things to happen if the library and/or application ever change.
256 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500257
258/* Any transformations you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600259
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600260/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500261 to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
262 on the compile line, then pick and choose which ones to define without
263 having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
264 if you only want to have a png-compliant reader/writer but don't need
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600265 any of the extra transformations. This saves about 80 kbytes in a
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500266 typical installation of the library. (PNG_NO_* form added in version
267 1.0.1c, for consistency)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600268 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600269
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600270
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600271
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500272#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
273 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600274#define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600275#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500276#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
277 !defined(PNG_NO_WRITE_TRANSFORMS)
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600278#define PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600279#endif
280
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600281#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500282#ifndef PNG_NO_READ_EXPAND
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500283#define PNG_READ_EXPAND_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500284#endif
285#ifndef PNG_NO_READ_SHIFT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500286#define PNG_READ_SHIFT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500287#endif
288#ifndef PNG_NO_READ_PACK
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500289#define PNG_READ_PACK_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500290#endif
291#ifndef PNG_NO_READ_BGR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500292#define PNG_READ_BGR_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500293#endif
294#ifndef PNG_NO_READ_SWAP
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500295#define PNG_READ_SWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500296#endif
297#ifndef PNG_NO_READ_PACKSWAP
Andreas Dilger47a0c421997-05-16 02:46:07 -0500298#define PNG_READ_PACKSWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500299#endif
300#ifndef PNG_NO_READ_INVERT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500301#define PNG_READ_INVERT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500302#endif
303#ifndef PNG_NO_READ_DITHER
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500304#define PNG_READ_DITHER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500305#endif
306#ifndef PNG_NO_READ_BACKGROUND
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500307#define PNG_READ_BACKGROUND_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500308#endif
309#ifndef PNG_NO_READ_16_TO_8
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500310#define PNG_READ_16_TO_8_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500311#endif
312#ifndef PNG_NO_READ_FILLER
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500313#define PNG_READ_FILLER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500314#endif
315#ifndef PNG_NO_READ_GAMMA
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500316#define PNG_READ_GAMMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500317#endif
318#ifndef PNG_NO_READ_GRAY_TO_RGB
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500319#define PNG_READ_GRAY_TO_RGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500320#endif
321#ifndef PNG_NO_READ_SWAP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500322#define PNG_READ_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500323#endif
324#ifndef PNG_NO_READ_INVERT_ALPHA
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600325#define PNG_READ_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500326#endif
327#ifndef PNG_NO_READ_STRIP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500328#define PNG_READ_STRIP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500329#endif
330#ifndef PNG_NO_READ_USER_TRANSFORM
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600331#define PNG_READ_USER_TRANSFORM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500332#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500333#ifndef PNG_NO_READ_RGB_TO_GRAY
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600334#define PNG_READ_RGB_TO_GRAY_SUPPORTED
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500335#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600336#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600337
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500338#if !defined(PNG_NO_PROGRESSIVE_READ) && \
339 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600340#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
341#endif /* about interlacing capability! You'll */
342 /* still have interlacing unless you change the following line: */
343#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500344
345#ifndef PNG_NO_READ_COMPOSITED_NODIV
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600346#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500347#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500348
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500349#ifndef PNG_NO_READ_EMPTY_PLTE
350#define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */
351#endif
352
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600353#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500354#ifndef PNG_NO_WRITE_SHIFT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500355#define PNG_WRITE_SHIFT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500356#endif
357#ifndef PNG_NO_WRITE_PACK
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500358#define PNG_WRITE_PACK_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500359#endif
360#ifndef PNG_NO_WRITE_BGR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500361#define PNG_WRITE_BGR_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500362#endif
363#ifndef PNG_NO_WRITE_SWAP
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500364#define PNG_WRITE_SWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500365#endif
366#ifndef PNG_NO_WRITE_PACKSWAP
Andreas Dilger47a0c421997-05-16 02:46:07 -0500367#define PNG_WRITE_PACKSWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500368#endif
369#ifndef PNG_NO_WRITE_INVERT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500370#define PNG_WRITE_INVERT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500371#endif
372#ifndef PNG_NO_WRITE_FILLER
Andreas Dilger47a0c421997-05-16 02:46:07 -0500373#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500374#endif
375#ifndef PNG_NO_WRITE_SWAP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500376#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500377#endif
378#ifndef PNG_NO_WRITE_INVERT_ALPHA
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600379#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500380#endif
381#ifndef PNG_NO_WRITE_USER_TRANSFORM
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600382#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500383#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600384#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600385
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600386#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
387 encoders, but can cause trouble
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600388 if left undefined */
389
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500390#ifndef PNG_NO_WRITE_WEIGHTED_FILTER
391#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
392#endif
393
394#ifndef PNG_NO_WRITE_FLUSH
395#define PNG_WRITE_FLUSH_SUPPORTED
396#endif
397
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500398#ifndef PNG_NO_WRITE_EMPTY_PLTE
399#define PNG_WRITE_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */
400#endif
401
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500402#ifndef PNG_NO_STDIO
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600403#define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600404#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500405
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600406/* This adds extra functions in pngget.c for accessing data from the
407 * info pointer (added in version 0.99)
408 * png_get_image_width()
409 * png_get_image_height()
410 * png_get_bit_depth()
411 * png_get_color_type()
412 * png_get_compression_type()
413 * png_get_filter_type()
414 * png_get_interlace_type()
415 * png_get_pixel_aspect_ratio()
416 * png_get_pixels_per_meter()
417 * png_get_x_offset_pixels()
418 * png_get_y_offset_pixels()
419 * png_get_x_offset_microns()
420 * png_get_y_offset_microns()
421 */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500422#ifndef PNG_NO_EASY_ACCESS
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600423#define PNG_EASY_ACCESS_SUPPORTED
424#endif
425
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500426#ifndef PNG_NO_ASSEMBLER_CODE
427#define PNG_ASSEMBLER_CODE_SUPPORTED
428#endif
429
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600430#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
431#define PNG_FLOATING_POINT_SUPPORTED
432#endif
433
434#ifndef PNG_NO_FIXED_POINT_SUPPORTED
435#define PNG_FIXED_POINT_SUPPORTED
436#endif
437
Glenn Randers-Pehrson5379b241999-11-27 10:22:33 -0600438/* Do not use global arrays (helps with building DLL's)
439 * They are no longer used in libpng itself, since version 1.0.5c,
440 * but might be required for some pre-1.0.5c applications.
441 */
Glenn Randers-Pehrson074af5e1999-11-28 23:32:18 -0600442#ifdef PNG_NO_GLOBAL_ARRAYS
443#define PNG_USE_LOCAL_ARRAYS
444#else
445#define PNG_USE_GLOBAL_ARRAYS
Glenn Randers-Pehrson5379b241999-11-27 10:22:33 -0600446#endif
447
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600448/* These are currently experimental features, define them if you want */
449
450/* very little testing */
451/*
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600452#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500453#define PNG_USER_MEM_SUPPORTED
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600454*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500455
456/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600457/* some testing */
458/*
459#define PNG_READ_BIG_ENDIAN_SUPPORTED
460*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500461
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600462/* These functions are turned off by default, as they will be phased out. */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600463/*
464#define PNG_USELESS_TESTS_SUPPORTED
465#define PNG_CORRECT_PALETTE_SUPPORTED
466*/
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600467
Andreas Dilger47a0c421997-05-16 02:46:07 -0500468/* Any chunks you are not interested in, you can undef here. The
469 * ones that allocate memory may be expecially important (hIST,
470 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600471 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500472 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500473
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500474#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
475 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600476#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
477#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500478#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
479 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600480#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
481#endif
482
483#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600484
485#ifdef PNG_NO_READ_TEXT
486# define PNG_NO_READ_iTXt
487# define PNG_NO_READ_tEXt
488# define PNG_NO_READ_zTXt
489#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500490#ifndef PNG_NO_READ_bKGD
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600491# define PNG_READ_bKGD_SUPPORTED
492# define PNG_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500493#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500494#ifndef PNG_NO_READ_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600495# define PNG_READ_cHRM_SUPPORTED
496# define PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500497#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500498#ifndef PNG_NO_READ_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600499# define PNG_READ_gAMA_SUPPORTED
500# define PNG_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500501#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500502#ifndef PNG_NO_READ_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600503# define PNG_READ_hIST_SUPPORTED
504# define PNG_hIST_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600505#endif
506#ifndef PNG_NO_READ_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600507# define PNG_READ_iCCP_SUPPORTED
508# define PNG_iCCP_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600509#endif
510#ifndef PNG_NO_READ_iTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600511# define PNG_READ_iTXt_SUPPORTED
512# define PNG_iTXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500513#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500514#ifndef PNG_NO_READ_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600515# define PNG_READ_oFFs_SUPPORTED
516# define PNG_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500517#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500518#ifndef PNG_NO_READ_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600519# define PNG_READ_pCAL_SUPPORTED
520# define PNG_pCAL_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600521#endif
522#ifndef PNG_NO_READ_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600523# define PNG_READ_sCAL_SUPPORTED
524# define PNG_sCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500525#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500526#ifndef PNG_NO_READ_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600527# define PNG_READ_pHYs_SUPPORTED
528# define PNG_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500529#endif
530#ifndef PNG_NO_READ_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600531# define PNG_READ_sBIT_SUPPORTED
532# define PNG_sBIT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600533#endif
534#ifndef PNG_NO_READ_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600535# define PNG_READ_sPLT_SUPPORTED
536# define PNG_sPLT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500537#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500538#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600539# define PNG_READ_sRGB_SUPPORTED
540# define PNG_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500541#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500542#ifndef PNG_NO_READ_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600543# define PNG_READ_tEXt_SUPPORTED
544# define PNG_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500545#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500546#ifndef PNG_NO_READ_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600547# define PNG_READ_tIME_SUPPORTED
548# define PNG_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500549#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500550#ifndef PNG_NO_READ_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600551# define PNG_READ_tRNS_SUPPORTED
552# define PNG_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500553#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500554#ifndef PNG_NO_READ_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600555# define PNG_READ_zTXt_SUPPORTED
556# define PNG_zTXt_SUPPORTED
557#endif
558#ifndef PNG_NO_READ_USER_CHUNKS
559# define PNG_READ_USER_CHUNKS_SUPPORTED
560# define PNG_USER_CHUNKS_SUPPORTED
561# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
562# undef PNG_NO_READ_UNKNOWN_CHUNKS
563# endif
564# ifdef PNG_NO_HANDLE_AS_UNKNOWN
565# undef PNG_NO_HANDLE_AS_UNKNOWN
566# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600567#endif
568#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600569# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
570# define PNG_UNKNOWN_CHUNKS_SUPPORTED
571# ifndef PNG_NO_HANDLE_AS_UNKNOWN
572# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
573# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500574#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500575#ifndef PNG_NO_READ_OPT_PLTE
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600576# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
577#endif /* optional PLTE chunk in RGB and RGBA images */
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600578#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
579 defined(PNG_READ_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600580# define PNG_READ_TEXT_SUPPORTED
581# define PNG_TEXT_SUPPORTED
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600582#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600583#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500584
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600585#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600586#ifdef PNG_NO_WRITE_TEXT
587# define PNG_NO_WRITE_iTXt
588# define PNG_NO_WRITE_tEXt
589# define PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600590#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600591#ifndef PNG_NO_WRITE_bKGD
592# define PNG_WRITE_bKGD_SUPPORTED
593# ifndef PNG_bKGD_SUPPORTED
594# define PNG_bKGD_SUPPORTED
595# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500596#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500597#ifndef PNG_NO_WRITE_cHRM
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600598# define PNG_WRITE_cHRM_SUPPORTED
599# ifndef PNG_cHRM_SUPPORTED
600# define PNG_cHRM_SUPPORTED
601# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500602#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500603#ifndef PNG_NO_WRITE_gAMA
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600604# define PNG_WRITE_gAMA_SUPPORTED
605# ifndef PNG_gAMA_SUPPORTED
606# define PNG_gAMA_SUPPORTED
607# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500608#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500609#ifndef PNG_NO_WRITE_hIST
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600610# define PNG_WRITE_hIST_SUPPORTED
611# ifndef PNG_hIST_SUPPORTED
612# define PNG_hIST_SUPPORTED
613# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600614#endif
615#ifndef PNG_NO_WRITE_iCCP
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600616# define PNG_WRITE_iCCP_SUPPORTED
617# ifndef PNG_iCCP_SUPPORTED
618# define PNG_iCCP_SUPPORTED
619# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600620#endif
621#ifndef PNG_NO_WRITE_iTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600622# define PNG_WRITE_iTXt_SUPPORTED
623# ifndef PNG_iTXt_SUPPORTED
624# define PNG_iTXt_SUPPORTED
625# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500626#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500627#ifndef PNG_NO_WRITE_oFFs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600628# define PNG_WRITE_oFFs_SUPPORTED
629# ifndef PNG_oFFs_SUPPORTED
630# define PNG_oFFs_SUPPORTED
631# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500632#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500633#ifndef PNG_NO_WRITE_pCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600634# define PNG_WRITE_pCAL_SUPPORTED
635# ifndef PNG_pCAL_SUPPORTED
636# define PNG_pCAL_SUPPORTED
637# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600638#endif
639#ifndef PNG_NO_WRITE_sCAL
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600640# define PNG_WRITE_sCAL_SUPPORTED
641# ifndef PNG_sCAL_SUPPORTED
642# define PNG_sCAL_SUPPORTED
643# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500644#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500645#ifndef PNG_NO_WRITE_pHYs
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600646# define PNG_WRITE_pHYs_SUPPORTED
647# ifndef PNG_pHYs_SUPPORTED
648# define PNG_pHYs_SUPPORTED
649# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500650#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500651#ifndef PNG_NO_WRITE_sBIT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600652# define PNG_WRITE_sBIT_SUPPORTED
653# ifndef PNG_sBIT_SUPPORTED
654# define PNG_sBIT_SUPPORTED
655# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600656#endif
657#ifndef PNG_NO_WRITE_sPLT
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600658# define PNG_WRITE_sPLT_SUPPORTED
659# ifndef PNG_sPLT_SUPPORTED
660# define PNG_sPLT_SUPPORTED
661# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500662#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500663#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600664# define PNG_WRITE_sRGB_SUPPORTED
665# ifndef PNG_sRGB_SUPPORTED
666# define PNG_sRGB_SUPPORTED
667# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500668#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500669#ifndef PNG_NO_WRITE_tEXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600670# define PNG_WRITE_tEXt_SUPPORTED
671# ifndef PNG_tEXt_SUPPORTED
672# define PNG_tEXt_SUPPORTED
673# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500674#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500675#ifndef PNG_NO_WRITE_tIME
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600676# define PNG_WRITE_tIME_SUPPORTED
677# ifndef PNG_tIME_SUPPORTED
678# define PNG_tIME_SUPPORTED
679# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500680#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500681#ifndef PNG_NO_WRITE_tRNS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600682# define PNG_WRITE_tRNS_SUPPORTED
683# ifndef PNG_tRNS_SUPPORTED
684# define PNG_tRNS_SUPPORTED
685# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500686#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500687#ifndef PNG_NO_WRITE_zTXt
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600688# define PNG_WRITE_zTXt_SUPPORTED
689# ifndef PNG_zTXt_SUPPORTED
690# define PNG_zTXt_SUPPORTED
691# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600692#endif
693#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600694# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
695# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
696# define PNG_UNKNOWN_CHUNKS_SUPPORTED
697# endif
698# ifndef PNG_NO_HANDLE_AS_UNKNOWN
699# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
700# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
701# endif
702# endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600703#endif
704#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
705 defined(PNG_WRITE_zTXt_SUPPORTED)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600706# define PNG_WRITE_TEXT_SUPPORTED
707# ifndef PNG_TEXT_SUPPORTED
708# define PNG_TEXT_SUPPORTED
709# endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500710#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600711#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500712
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600713/* Turn this off to disable png_read_png() and
714 * png_write_png() and leave the image_bits member
715 * out of the info structure.
716 */
717#ifndef PNG_NO_INFO_IMAGE
718# define PNG_INFO_IMAGE_SUPPORTED
719#endif
720
Andreas Dilger47a0c421997-05-16 02:46:07 -0500721/* need the time information for reading tIME chunks */
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600722#if defined(PNG_tIME_SUPPORTED)
723# include <time.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500724#endif
725
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600726/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -0500727 * common platforms. The typedefs should be at least as large as the
728 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
729 * don't have to be exactly that size. Some compilers dislike passing
730 * unsigned shorts as function parameters, so you may be better off using
731 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
732 * want to have unsigned int for png_uint_32 instead of unsigned long.
733 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500734
735typedef unsigned long png_uint_32;
736typedef long png_int_32;
737typedef unsigned short png_uint_16;
738typedef short png_int_16;
739typedef unsigned char png_byte;
740
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600741/* This is usually size_t. It is typedef'ed just in case you need it to
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500742 change (I'm not sure if you will or not, so I thought I'd be safe) */
743typedef size_t png_size_t;
744
Andreas Dilger47a0c421997-05-16 02:46:07 -0500745/* The following is needed for medium model support. It cannot be in the
746 * PNG_INTERNAL section. Needs modification for other compilers besides
747 * MSC. Model independent support declares all arrays and pointers to be
748 * large using the far keyword. The zlib version used must also support
749 * model independent data. As of version zlib 1.0.4, the necessary changes
750 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
751 * changes that are needed. (Tim Wegner)
752 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500753
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600754/* Separate compiler dependencies (problem here is that zlib.h always
755 defines FAR. (SJT) */
Guy Schalnat6d764711995-12-19 03:22:19 -0600756#ifdef __BORLANDC__
757#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
758#define LDATA 1
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500759#else
Guy Schalnat6d764711995-12-19 03:22:19 -0600760#define LDATA 0
761#endif
762
763#if !defined(__WIN32__) && !defined(__FLAT__)
764#define PNG_MAX_MALLOC_64K
765#if (LDATA != 1)
766#ifndef FAR
767#define FAR __far
768#endif
769#define USE_FAR_KEYWORD
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600770#endif /* LDATA != 1 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600771
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600772/* Possibly useful for moving data out of default segment.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600773 * Uncomment it if you want. Could also define FARDATA as
774 * const if your compiler supports it. (SJT)
Guy Schalnat6d764711995-12-19 03:22:19 -0600775# define FARDATA FAR
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600776 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600777#endif /* __WIN32__, __FLAT__ */
778
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600779#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -0600780
781
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600782/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600783 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
784 * making reliance oncertain keywords suspect. (SJT)
785 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600786
787/* MSC Medium model */
788#if defined(FAR)
789# if defined(M_I86MM)
790# define USE_FAR_KEYWORD
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600791# define FARDATA FAR
792# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -0600793# endif
794#endif
795
796/* SJT: default case */
797#ifndef FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500798# define FAR
799#endif
800
Andreas Dilger47a0c421997-05-16 02:46:07 -0500801/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -0600802#ifndef FARDATA
803#define FARDATA
804#endif
805
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600806/* Typedef for floating-point numbers that are converted
807 to fixed-point with a multiple of 100,000, e.g., int_gamma */
808typedef png_int_32 png_fixed_point;
809
Andreas Dilger47a0c421997-05-16 02:46:07 -0500810/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600811typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600812typedef png_byte FAR * png_bytep;
813typedef png_uint_32 FAR * png_uint_32p;
814typedef png_int_32 FAR * png_int_32p;
815typedef png_uint_16 FAR * png_uint_16p;
816typedef png_int_16 FAR * png_int_16p;
817typedef PNG_CONST char FAR * png_const_charp;
818typedef char FAR * png_charp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600819typedef png_fixed_point FAR * png_fixed_point_p;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600820#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500821typedef double FAR * png_doublep;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600822#endif
Guy Schalnat6d764711995-12-19 03:22:19 -0600823
Andreas Dilger47a0c421997-05-16 02:46:07 -0500824/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -0600825typedef png_byte FAR * FAR * png_bytepp;
826typedef png_uint_32 FAR * FAR * png_uint_32pp;
827typedef png_int_32 FAR * FAR * png_int_32pp;
828typedef png_uint_16 FAR * FAR * png_uint_16pp;
829typedef png_int_16 FAR * FAR * png_int_16pp;
830typedef PNG_CONST char FAR * FAR * png_const_charpp;
831typedef char FAR * FAR * png_charpp;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600832typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600833#ifdef PNG_FLOATING_POINT_SUPPORTED
Andreas Dilger47a0c421997-05-16 02:46:07 -0500834typedef double FAR * FAR * png_doublepp;
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600835#endif
Guy Schalnat6d764711995-12-19 03:22:19 -0600836
Andreas Dilger47a0c421997-05-16 02:46:07 -0500837/* Pointers to pointers to pointers; i.e. pointer to array */
838typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600839
Andreas Dilger47a0c421997-05-16 02:46:07 -0500840/* libpng typedefs for types in zlib. If zlib changes
841 * or another compression library is used, then change these.
842 * Eliminates need to change all the source files.
843 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600844typedef charf * png_zcharp;
845typedef charf * FAR * png_zcharpp;
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600846typedef z_stream FAR * png_zstreamp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600847
Andreas Dilger47a0c421997-05-16 02:46:07 -0500848
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500849#ifndef PNG_EXPORT
850 /* allow for compilation as dll under MS Windows */
851# ifdef __WIN32DLL__
852# define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
853# endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600854
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500855 /* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */
856# ifdef ALT_WIN32_DLL
857# define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol
858# endif
859
860 /* allow for compilation as dll with Borland C++ 5.0 */
861# if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
862# define PNG_EXPORT(type,symbol) type _export symbol
863# endif
864
865 /* allow for compilation as shared lib under BeOS */
866# ifdef __BEOSDLL__
867# define PNG_EXPORT(type,symbol) __declspec(export) type symbol
868# endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600869#endif
870
Andreas Dilger47a0c421997-05-16 02:46:07 -0500871#ifndef PNG_EXPORT
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500872# define PNG_EXPORT(type,symbol) type symbol
Andreas Dilger47a0c421997-05-16 02:46:07 -0500873#endif
874
Glenn Randers-Pehrson074af5e1999-11-28 23:32:18 -0600875#if defined(__MINGW32__) || defined(__CYGWIN32__)
876# define PNG_ATTR_DLLIMP
877#endif
878
879#ifndef PNG_EXPORT_VAR
880# ifdef PNG_DECL_DLLEXP
881# define PNG_EXPORT_VAR(type) extern __declspec(dllexport) type
882# endif
883# ifdef PNG_ATTR_DLLEXP
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600884# define PNG_EXPORT_VAR(type) extern type __attribute__((dllexport))
Glenn Randers-Pehrson074af5e1999-11-28 23:32:18 -0600885# endif
886# ifdef PNG_DECL_DLLIMP
887# define PNG_EXPORT_VAR(type) extern __declspec(dllimport) type
888# endif
889# ifdef PNG_ATTR_DLLIMP
890# define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport))
891# endif
892#endif
893
894#ifndef PNG_EXPORT_VAR
895# define PNG_EXPORT_VAR(type) extern type
896#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500897
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500898/* User may want to use these so not in PNG_INTERNAL. Any library functions
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600899 * that are passed far data must be model independent.
900 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600901
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600902#ifndef PNG_ABORT
903# define PNG_ABORT() abort()
904#endif
905
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500906#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600907/* use this to make far-to-near assignments */
908# define CHECK 1
909# define NOCHECK 0
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600910# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
911# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500912# define png_strcpy _fstrcpy
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500913# define png_strlen _fstrlen
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600914# define png_memcmp _fmemcmp /* SJT: added */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500915# define png_memcpy _fmemcpy
916# define png_memset _fmemset
917#else /* use the usual functions */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600918# define CVT_PTR(ptr) (ptr)
919# define CVT_PTR_NOCHECK(ptr) (ptr)
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500920# define png_strcpy strcpy
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500921# define png_strlen strlen
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600922# define png_memcmp memcmp /* SJT: added */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500923# define png_memcpy memcpy
924# define png_memset memset
925#endif
926/* End of memory model independent support */
927
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600928/* Just a little check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600929 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500930 */
931#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
932#undef PNG_ZBUF_SIZE
933#define PNG_ZBUF_SIZE 65536
934#endif
935
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500936#endif /* PNGCONF_H */
937