42
|
1 /* pngconf.h - machine configurable file for libpng
|
|
2 *
|
|
3 * libpng 1.0.15 - October 3, 2002
|
|
4 * For conditions of distribution and use, see copyright notice in png.h
|
|
5 * Copyright (c) 1998-2002 Glenn Randers-Pehrson
|
|
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
8 */
|
|
9
|
|
10 /* Any machine specific code is near the front of this file, so if you
|
|
11 * are configuring libpng for a machine, you may want to read the section
|
|
12 * starting here down to where it starts to typedef png_color, png_text,
|
|
13 * and png_info.
|
|
14 */
|
|
15
|
|
16 #ifndef PNGCONF_H
|
|
17 #define PNGCONF_H
|
|
18
|
|
19 #define PNG_1_0_X
|
|
20
|
|
21 /* This is the size of the compression buffer, and thus the size of
|
|
22 * an IDAT chunk. Make this whatever size you feel is best for your
|
|
23 * machine. One of these will be allocated per png_struct. When this
|
|
24 * is full, it writes the data to the disk, and does some other
|
|
25 * calculations. Making this an extremely small size will slow
|
|
26 * the library down, but you may want to experiment to determine
|
|
27 * where it becomes significant, if you are concerned with memory
|
|
28 * usage. Note that zlib allocates at least 32Kb also. For readers,
|
|
29 * this describes the size of the buffer available to read the data in.
|
|
30 * Unless this gets smaller than the size of a row (compressed),
|
|
31 * it should not make much difference how big this is.
|
|
32 */
|
|
33
|
|
34 # define PNG_ZBUF_SIZE 8192
|
|
35
|
|
36 /* Enable if you want a write-only libpng */
|
|
37
|
|
38 # define PNG_READ_SUPPORTED
|
|
39
|
|
40 /* Enable if you want a read-only libpng */
|
|
41
|
|
42 # define PNG_WRITE_SUPPORTED
|
|
43
|
|
44 /* Enabled by default in 1.2.0. You can disable this if you don't need to
|
|
45 support PNGs that are embedded in MNG datastreams */
|
|
46 #undef PNG_MNG_FEATURES_SUPPORTED
|
|
47
|
|
48 # define PNG_FLOATING_POINT_SUPPORTED
|
|
49
|
|
50 /* If you are running on a machine where you cannot allocate more
|
|
51 * than 64K of memory at once, uncomment this. While libpng will not
|
|
52 * normally need that much memory in a chunk (unless you load up a very
|
|
53 * large file), zlib needs to know how big of a chunk it can use, and
|
|
54 * libpng thus makes sure to check any memory allocation to verify it
|
|
55 * will fit into memory.
|
|
56 */
|
|
57 #undef PNG_MAX_MALLOC_64K
|
|
58
|
|
59 /* Special munging to support doing things the 'cygwin' way:
|
|
60 * 'Normal' png-on-win32 defines/defaults:
|
|
61 * PNG_BUILD_DLL -- building dll
|
|
62 * PNG_USE_DLL -- building an application, linking to dll
|
|
63 * (no define) -- building static library, or building an
|
|
64 * application and linking to the static lib
|
|
65 * 'Cygwin' defines/defaults:
|
|
66 * PNG_BUILD_DLL -- (ignored) building the dll
|
|
67 * (no define) -- (ignored) building an application, linking to the dll
|
|
68 * PNG_STATIC -- (ignored) building the static lib, or building an
|
|
69 * application that links to the static lib.
|
|
70 * ALL_STATIC -- (ignored) building various static libs, or building an
|
|
71 * application that links to the static libs.
|
|
72 * Thus,
|
|
73 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
|
|
74 * this bit of #ifdefs will define the 'correct' config variables based on
|
|
75 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
|
|
76 * unnecessary.
|
|
77 *
|
|
78 * Also, the precedence order is:
|
|
79 * ALL_STATIC (since we can't #undef something outside our namespace)
|
|
80 * PNG_BUILD_DLL
|
|
81 * PNG_STATIC
|
|
82 * (nothing) == PNG_USE_DLL
|
|
83 *
|
|
84 * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
|
|
85 * of auto-import in binutils, we no longer need to worry about
|
|
86 * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
|
|
87 * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
|
|
88 * to __declspec() stuff. However, we DO need to worry about
|
|
89 * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
|
|
90 * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
|
|
91 */
|
|
92 #undef PNG_BUILD_DLL
|
|
93 #undef PNG_USE_DLL
|
|
94
|
|
95 /* This protects us against compilers that run on a windowing system
|
|
96 * and thus don't have or would rather us not use the stdio types:
|
|
97 * stdin, stdout, and stderr. The only one currently used is stderr
|
|
98 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
|
|
99 * prevent these from being compiled and used. #defining PNG_NO_STDIO
|
|
100 * will also prevent these, plus will prevent the entire set of stdio
|
|
101 * macros and functions (FILE *, printf, etc.) from being compiled and used,
|
|
102 * unless (PNG_DEBUG > 0) has been #defined.
|
|
103 *
|
|
104 * #define PNG_NO_CONSOLE_IO
|
|
105 * #define PNG_NO_STDIO
|
|
106 */
|
|
107
|
|
108 #if defined(_WIN32_WCE)
|
|
109 # include <windows.h>
|
|
110 /* Console I/O functions are not supported on WindowsCE */
|
|
111 # define PNG_NO_CONSOLE_IO
|
|
112 # ifdef PNG_DEBUG
|
|
113 # undef PNG_DEBUG
|
|
114 # endif
|
|
115 #endif
|
|
116
|
|
117 #ifdef PNG_BUILD_DLL
|
|
118 # ifndef PNG_CONSOLE_IO_SUPPORTED
|
|
119 # ifndef PNG_NO_CONSOLE_IO
|
|
120 # define PNG_NO_CONSOLE_IO
|
|
121 # endif
|
|
122 # endif
|
|
123 #endif
|
|
124
|
|
125 # ifdef PNG_NO_STDIO
|
|
126 # ifndef PNG_NO_CONSOLE_IO
|
|
127 # define PNG_NO_CONSOLE_IO
|
|
128 # endif
|
|
129 # ifdef PNG_DEBUG
|
|
130 # if (PNG_DEBUG > 0)
|
|
131 # include <stdio.h>
|
|
132 # endif
|
|
133 # endif
|
|
134 # else
|
|
135 # if !defined(_WIN32_WCE)
|
|
136 /* "stdio.h" functions are not supported on WindowsCE */
|
|
137 # include <stdio.h>
|
|
138 # endif
|
|
139 # endif
|
|
140
|
|
141 /* This macro protects us against machines that don't have function
|
|
142 * prototypes (ie K&R style headers). If your compiler does not handle
|
|
143 * function prototypes, define this macro and use the included ansi2knr.
|
|
144 * I've always been able to use _NO_PROTO as the indicator, but you may
|
|
145 * need to drag the empty declaration out in front of here, or change the
|
|
146 * ifdef to suit your own needs.
|
|
147 */
|
|
148 #ifndef PNGARG
|
|
149
|
|
150 #ifdef OF /* zlib prototype munger */
|
|
151 # define PNGARG(arglist) OF(arglist)
|
|
152 #else
|
|
153
|
|
154 #ifdef _NO_PROTO
|
|
155 # define PNGARG(arglist) ()
|
|
156 # ifndef PNG_TYPECAST_NULL
|
|
157 # define PNG_TYPECAST_NULL
|
|
158 # endif
|
|
159 #else
|
|
160 # define PNGARG(arglist) arglist
|
|
161 #endif /* _NO_PROTO */
|
|
162
|
|
163 #endif /* OF */
|
|
164
|
|
165 #endif /* PNGARG */
|
|
166
|
|
167 /* Try to determine if we are compiling on a Mac. Note that testing for
|
|
168 * just __MWERKS__ is not good enough, because the Codewarrior is now used
|
|
169 * on non-Mac platforms.
|
|
170 */
|
|
171 #ifndef MACOS
|
|
172 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
|
173 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
|
|
174 # define MACOS
|
|
175 # endif
|
|
176 #endif
|
|
177
|
|
178 /* enough people need this for various reasons to include it here */
|
|
179 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
|
|
180 # include <sys/types.h>
|
|
181 #endif
|
|
182
|
|
183 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
|
|
184 # define PNG_SETJMP_SUPPORTED
|
|
185 #endif
|
|
186
|
|
187 #ifdef PNG_SETJMP_SUPPORTED
|
|
188 /* This is an attempt to force a single setjmp behaviour on Linux. If
|
|
189 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
|
|
190 */
|
|
191
|
|
192 # ifdef __linux__
|
|
193 # ifdef _BSD_SOURCE
|
|
194 # define PNG_SAVE_BSD_SOURCE
|
|
195 # undef _BSD_SOURCE
|
|
196 # endif
|
|
197 # ifdef _SETJMP_H
|
|
198 __png.h__ already includes setjmp.h;
|
|
199 __dont__ include it again.;
|
|
200 # endif
|
|
201 # endif /* __linux__ */
|
|
202
|
|
203 /* include setjmp.h for error handling */
|
|
204 # include <setjmp.h>
|
|
205
|
|
206 # ifdef __linux__
|
|
207 # ifdef PNG_SAVE_BSD_SOURCE
|
|
208 # define _BSD_SOURCE
|
|
209 # undef PNG_SAVE_BSD_SOURCE
|
|
210 # endif
|
|
211 # endif /* __linux__ */
|
|
212 #endif /* PNG_SETJMP_SUPPORTED */
|
|
213
|
|
214 #ifdef BSD
|
|
215 # include <strings.h>
|
|
216 #else
|
|
217 # include <string.h>
|
|
218 #endif
|
|
219
|
|
220 /* Other defines for things like memory and the like can go here. */
|
|
221 #ifdef PNG_INTERNAL
|
|
222
|
|
223 #include <stdlib.h>
|
|
224
|
|
225 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
|
|
226 * aren't usually used outside the library (as far as I know), so it is
|
|
227 * debatable if they should be exported at all. In the future, when it is
|
|
228 * possible to have run-time registry of chunk-handling functions, some of
|
|
229 * these will be made available again.
|
|
230 #define PNG_EXTERN extern
|
|
231 */
|
|
232 #define PNG_EXTERN
|
|
233
|
|
234 /* Other defines specific to compilers can go here. Try to keep
|
|
235 * them inside an appropriate ifdef/endif pair for portability.
|
|
236 */
|
|
237
|
|
238 #if defined(PNG_FLOATING_POINT_SUPPORTED)
|
|
239 # if defined(MACOS)
|
|
240 /* We need to check that <math.h> hasn't already been included earlier
|
|
241 * as it seems it doesn't agree with <fp.h>, yet we should really use
|
|
242 * <fp.h> if possible.
|
|
243 */
|
|
244 # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
|
|
245 # include <fp.h>
|
|
246 # endif
|
|
247 # else
|
|
248 # include <math.h>
|
|
249 # endif
|
|
250 # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
|
|
251 /* Amiga SAS/C: We must include builtin FPU functions when compiling using
|
|
252 * MATH=68881
|
|
253 */
|
|
254 # include <m68881.h>
|
|
255 # endif
|
|
256 #endif
|
|
257
|
|
258 /* Codewarrior on NT has linking problems without this. */
|
|
259 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
|
|
260 # define PNG_ALWAYS_EXTERN
|
|
261 #endif
|
|
262
|
|
263 /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
|
|
264 * stdlib.h like it should (I think). Or perhaps this is a C++
|
|
265 * "feature"?
|
|
266 */
|
|
267 #ifdef __TURBOC__
|
|
268 # include <mem.h>
|
|
269 # include "alloc.h"
|
|
270 #endif
|
|
271
|
|
272 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
|
|
273 defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
|
|
274 # include <malloc.h>
|
|
275 #endif
|
|
276
|
|
277 /* This controls how fine the dithering gets. As this allocates
|
|
278 * a largish chunk of memory (32K), those who are not as concerned
|
|
279 * with dithering quality can decrease some or all of these.
|
|
280 */
|
|
281 #ifndef PNG_DITHER_RED_BITS
|
|
282 # define PNG_DITHER_RED_BITS 5
|
|
283 #endif
|
|
284 #ifndef PNG_DITHER_GREEN_BITS
|
|
285 # define PNG_DITHER_GREEN_BITS 5
|
|
286 #endif
|
|
287 #ifndef PNG_DITHER_BLUE_BITS
|
|
288 # define PNG_DITHER_BLUE_BITS 5
|
|
289 #endif
|
|
290
|
|
291 /* This controls how fine the gamma correction becomes when you
|
|
292 * are only interested in 8 bits anyway. Increasing this value
|
|
293 * results in more memory being used, and more pow() functions
|
|
294 * being called to fill in the gamma tables. Don't set this value
|
|
295 * less then 8, and even that may not work (I haven't tested it).
|
|
296 */
|
|
297
|
|
298 #ifndef PNG_MAX_GAMMA_8
|
|
299 # define PNG_MAX_GAMMA_8 11
|
|
300 #endif
|
|
301
|
|
302 /* This controls how much a difference in gamma we can tolerate before
|
|
303 * we actually start doing gamma conversion.
|
|
304 */
|
|
305 #ifndef PNG_GAMMA_THRESHOLD
|
|
306 # define PNG_GAMMA_THRESHOLD 0.05
|
|
307 #endif
|
|
308
|
|
309 #endif /* PNG_INTERNAL */
|
|
310
|
|
311 /* The following uses const char * instead of char * for error
|
|
312 * and warning message functions, so some compilers won't complain.
|
|
313 * If you do not want to use const, define PNG_NO_CONST here.
|
|
314 */
|
|
315
|
|
316 #ifndef PNG_NO_CONST
|
|
317 # define PNG_CONST const
|
|
318 #else
|
|
319 # define PNG_CONST
|
|
320 #endif
|
|
321
|
|
322 /* The following defines give you the ability to remove code from the
|
|
323 * library that you will not be using. I wish I could figure out how to
|
|
324 * automate this, but I can't do that without making it seriously hard
|
|
325 * on the users. So if you are not using an ability, change the #define
|
|
326 * to and #undef, and that part of the library will not be compiled. If
|
|
327 * your linker can't find a function, you may want to make sure the
|
|
328 * ability is defined here. Some of these depend upon some others being
|
|
329 * defined. I haven't figured out all the interactions here, so you may
|
|
330 * have to experiment awhile to get everything to compile. If you are
|
|
331 * creating or using a shared library, you probably shouldn't touch this,
|
|
332 * as it will affect the size of the structures, and this will cause bad
|
|
333 * things to happen if the library and/or application ever change.
|
|
334 */
|
|
335
|
|
336 /* Any features you will not be using can be undef'ed here */
|
|
337
|
|
338 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
|
|
339 * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
|
|
340 * on the compile line, then pick and choose which ones to define without
|
|
341 * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
|
|
342 * if you only want to have a png-compliant reader/writer but don't need
|
|
343 * any of the extra transformations. This saves about 80 kbytes in a
|
|
344 * typical installation of the library. (PNG_NO_* form added in version
|
|
345 * 1.0.1c, for consistency)
|
|
346 */
|
|
347
|
|
348 /* The size of the png_text structure changed in libpng-1.0.6 when
|
|
349 * iTXt is supported. It is turned off by default, to support old apps
|
|
350 * that malloc the png_text structure instead of calling png_set_text()
|
|
351 * and letting libpng malloc it. It will be turned on by default in
|
|
352 * libpng-1.3.0.
|
|
353 */
|
|
354
|
|
355 #ifndef PNG_iTXt_SUPPORTED
|
|
356 # if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
|
|
357 # define PNG_NO_READ_iTXt
|
|
358 # endif
|
|
359 # if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
|
|
360 # define PNG_NO_WRITE_iTXt
|
|
361 # endif
|
|
362 #endif
|
|
363
|
|
364 /* The following support, added after version 1.0.0, can be turned off here en
|
|
365 * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
|
|
366 * with old applications that require the length of png_struct and png_info
|
|
367 * to remain unchanged.
|
|
368 */
|
|
369
|
|
370 #ifdef PNG_LEGACY_SUPPORTED
|
|
371 # define PNG_NO_FREE_ME
|
|
372 # define PNG_NO_READ_UNKNOWN_CHUNKS
|
|
373 # define PNG_NO_WRITE_UNKNOWN_CHUNKS
|
|
374 # define PNG_NO_READ_USER_CHUNKS
|
|
375 # define PNG_NO_READ_iCCP
|
|
376 # define PNG_NO_WRITE_iCCP
|
|
377 # define PNG_NO_READ_iTXt
|
|
378 # define PNG_NO_WRITE_iTXt
|
|
379 # define PNG_NO_READ_sCAL
|
|
380 # define PNG_NO_WRITE_sCAL
|
|
381 # define PNG_NO_READ_sPLT
|
|
382 # define PNG_NO_WRITE_sPLT
|
|
383 # define PNG_NO_INFO_IMAGE
|
|
384 # define PNG_NO_READ_RGB_TO_GRAY
|
|
385 # define PNG_NO_READ_USER_TRANSFORM
|
|
386 # define PNG_NO_WRITE_USER_TRANSFORM
|
|
387 # define PNG_NO_USER_MEM
|
|
388 # define PNG_NO_READ_EMPTY_PLTE
|
|
389 # define PNG_NO_MNG_FEATURES
|
|
390 # define PNG_NO_FIXED_POINT_SUPPORTED
|
|
391 #endif
|
|
392
|
|
393 /* Ignore attempt to turn off both floating and fixed point support */
|
|
394 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
|
|
395 !defined(PNG_NO_FIXED_POINT_SUPPORTED)
|
|
396 # define PNG_FIXED_POINT_SUPPORTED
|
|
397 #endif
|
|
398
|
|
399 #ifndef PNG_NO_FREE_ME
|
|
400 # define PNG_FREE_ME_SUPPORTED
|
|
401 #endif
|
|
402
|
|
403 #if defined(PNG_READ_SUPPORTED)
|
|
404
|
|
405 #undef PNG_READ_TRANSFORMS_SUPPORTED
|
|
406
|
|
407 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
|
408 # ifndef PNG_NO_READ_EXPAND
|
|
409 # define PNG_READ_EXPAND_SUPPORTED
|
|
410 # endif
|
|
411 # ifndef PNG_NO_READ_SHIFT
|
|
412 # define PNG_READ_SHIFT_SUPPORTED
|
|
413 # endif
|
|
414 # ifndef PNG_NO_READ_PACK
|
|
415 # define PNG_READ_PACK_SUPPORTED
|
|
416 # endif
|
|
417 # ifndef PNG_NO_READ_BGR
|
|
418 # define PNG_READ_BGR_SUPPORTED
|
|
419 # endif
|
|
420 # ifndef PNG_NO_READ_SWAP
|
|
421 # define PNG_READ_SWAP_SUPPORTED
|
|
422 # endif
|
|
423 # ifndef PNG_NO_READ_PACKSWAP
|
|
424 # define PNG_READ_PACKSWAP_SUPPORTED
|
|
425 # endif
|
|
426 # ifndef PNG_NO_READ_INVERT
|
|
427 # define PNG_READ_INVERT_SUPPORTED
|
|
428 # endif
|
|
429 # ifndef PNG_NO_READ_DITHER
|
|
430 # define PNG_READ_DITHER_SUPPORTED
|
|
431 # endif
|
|
432 # ifndef PNG_NO_READ_BACKGROUND
|
|
433 # define PNG_READ_BACKGROUND_SUPPORTED
|
|
434 # endif
|
|
435 # ifndef PNG_NO_READ_16_TO_8
|
|
436 # define PNG_READ_16_TO_8_SUPPORTED
|
|
437 # endif
|
|
438 # ifndef PNG_NO_READ_FILLER
|
|
439 # define PNG_READ_FILLER_SUPPORTED
|
|
440 # endif
|
|
441 # ifndef PNG_NO_READ_GAMMA
|
|
442 # define PNG_READ_GAMMA_SUPPORTED
|
|
443 # endif
|
|
444 # ifndef PNG_NO_READ_GRAY_TO_RGB
|
|
445 # define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
|
446 # endif
|
|
447 # ifndef PNG_NO_READ_SWAP_ALPHA
|
|
448 # define PNG_READ_SWAP_ALPHA_SUPPORTED
|
|
449 # endif
|
|
450 # ifndef PNG_NO_READ_INVERT_ALPHA
|
|
451 # define PNG_READ_INVERT_ALPHA_SUPPORTED
|
|
452 # endif
|
|
453 # ifndef PNG_NO_READ_STRIP_ALPHA
|
|
454 # define PNG_READ_STRIP_ALPHA_SUPPORTED
|
|
455 # endif
|
|
456 # ifndef PNG_NO_READ_USER_TRANSFORM
|
|
457 # define PNG_READ_USER_TRANSFORM_SUPPORTED
|
|
458 # endif
|
|
459 # ifndef PNG_NO_READ_RGB_TO_GRAY
|
|
460 # define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
|
461 # endif
|
|
462 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
|
463
|
|
464 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
|
|
465 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
|
|
466 # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
|
|
467 #endif /* about interlacing capability! You'll */
|
|
468 /* still have interlacing unless you change the following line: */
|
|
469
|
|
470 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
|
|
471
|
|
472 #ifndef PNG_NO_READ_COMPOSITE_NODIV
|
|
473 # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
|
|
474 # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
|
|
475 # endif
|
|
476 #endif
|
|
477
|
|
478 /* Deprecated, will be removed from version 2.0.0.
|
|
479 Use PNG_MNG_FEATURES_SUPPORTED instead. */
|
|
480 #ifndef PNG_NO_READ_EMPTY_PLTE
|
|
481 # define PNG_READ_EMPTY_PLTE_SUPPORTED
|
|
482 #endif
|
|
483
|
|
484 #endif /* PNG_READ_SUPPORTED */
|
|
485
|
|
486 #if defined(PNG_WRITE_SUPPORTED)
|
|
487
|
|
488 #undef PNG_WRITE_TRANSFORMS_SUPPORTED
|
|
489
|
|
490 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
|
491 # ifndef PNG_NO_WRITE_SHIFT
|
|
492 # define PNG_WRITE_SHIFT_SUPPORTED
|
|
493 # endif
|
|
494 # ifndef PNG_NO_WRITE_PACK
|
|
495 # define PNG_WRITE_PACK_SUPPORTED
|
|
496 # endif
|
|
497 # ifndef PNG_NO_WRITE_BGR
|
|
498 # define PNG_WRITE_BGR_SUPPORTED
|
|
499 # endif
|
|
500 # ifndef PNG_NO_WRITE_SWAP
|
|
501 # define PNG_WRITE_SWAP_SUPPORTED
|
|
502 # endif
|
|
503 # ifndef PNG_NO_WRITE_PACKSWAP
|
|
504 # define PNG_WRITE_PACKSWAP_SUPPORTED
|
|
505 # endif
|
|
506 # ifndef PNG_NO_WRITE_INVERT
|
|
507 # define PNG_WRITE_INVERT_SUPPORTED
|
|
508 # endif
|
|
509 # ifndef PNG_NO_WRITE_FILLER
|
|
510 # define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
|
|
511 # endif
|
|
512 # ifndef PNG_NO_WRITE_SWAP_ALPHA
|
|
513 # define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
|
514 # endif
|
|
515 # ifndef PNG_NO_WRITE_INVERT_ALPHA
|
|
516 # define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
|
517 # endif
|
|
518 # ifndef PNG_NO_WRITE_USER_TRANSFORM
|
|
519 # define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
|
520 # endif
|
|
521 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
|
522
|
|
523 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
|
524 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
|
525 # ifndef PNG_NO_USER_TRANSFORM_PTR
|
|
526 # define PNG_USER_TRANSFORM_PTR_SUPPORTED
|
|
527 # endif
|
|
528 #endif
|
|
529
|
|
530 #undef PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
|
|
531 encoders, but can cause trouble
|
|
532 if left undefined */
|
|
533
|
|
534 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
|
|
535 defined(PNG_FLOATING_POINT_SUPPORTED)
|
|
536 # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
537 #endif
|
|
538
|
|
539 #ifndef PNG_1_0_X
|
|
540 #ifndef PNG_NO_ERROR_NUMBERS
|
|
541 #define PNG_ERROR_NUMBERS_SUPPORTED
|
|
542 #endif
|
|
543 #endif /* PNG_1_0_X */
|
|
544
|
|
545 #undef PNG_WRITE_FLUSH_SUPPORTED
|
|
546
|
|
547 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
|
|
548 #ifndef PNG_NO_WRITE_EMPTY_PLTE
|
|
549 # define PNG_WRITE_EMPTY_PLTE_SUPPORTED
|
|
550 #endif
|
|
551
|
|
552 #endif /* PNG_WRITE_SUPPORTED */
|
|
553
|
|
554 #ifndef PNG_NO_STDIO
|
|
555 # define PNG_TIME_RFC1123_SUPPORTED
|
|
556 #endif
|
|
557
|
|
558 /* This adds extra functions in pngget.c for accessing data from the
|
|
559 * info pointer (added in version 0.99)
|
|
560 * png_get_image_width()
|
|
561 * png_get_image_height()
|
|
562 * png_get_bit_depth()
|
|
563 * png_get_color_type()
|
|
564 * png_get_compression_type()
|
|
565 * png_get_filter_type()
|
|
566 * png_get_interlace_type()
|
|
567 * png_get_pixel_aspect_ratio()
|
|
568 * png_get_pixels_per_meter()
|
|
569 * png_get_x_offset_pixels()
|
|
570 * png_get_y_offset_pixels()
|
|
571 * png_get_x_offset_microns()
|
|
572 * png_get_y_offset_microns()
|
|
573 */
|
|
574 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
|
|
575 # define PNG_EASY_ACCESS_SUPPORTED
|
|
576 #endif
|
|
577
|
|
578 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
|
|
579 even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
|
|
580 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
|
|
581 # ifndef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
582 # define PNG_ASSEMBLER_CODE_SUPPORTED
|
|
583 # endif
|
|
584 # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
|
|
585 # define PNG_MMX_CODE_SUPPORTED
|
|
586 # endif
|
|
587 #endif
|
|
588
|
|
589 /* If you are sure that you don't need thread safety and you are compiling
|
|
590 with PNG_USE_PNGCCRD for an MMX application, you can define this for
|
|
591 faster execution. See pnggccrd.c.
|
|
592 #define PNG_THREAD_UNSAFE_OK
|
|
593 */
|
|
594
|
|
595 #undef PNG_USER_MEM_SUPPORTED
|
|
596
|
|
597 /* These are currently experimental features, define them if you want */
|
|
598
|
|
599 /* very little testing */
|
|
600 /*
|
|
601 #ifdef PNG_READ_SUPPORTED
|
|
602 # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
|
603 # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
|
604 # endif
|
|
605 #endif
|
|
606 */
|
|
607
|
|
608 /* This is only for PowerPC big-endian and 680x0 systems */
|
|
609 /* some testing */
|
|
610 /*
|
|
611 #ifdef PNG_READ_SUPPORTED
|
|
612 # ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
|
|
613 # define PNG_READ_BIG_ENDIAN_SUPPORTED
|
|
614 # endif
|
|
615 #endif
|
|
616 */
|
|
617
|
|
618 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
|
|
619 /*
|
|
620 #define PNG_NO_POINTER_INDEXING
|
|
621 */
|
|
622
|
|
623 /* These functions are turned off by default, as they will be phased out. */
|
|
624 /*
|
|
625 #define PNG_USELESS_TESTS_SUPPORTED
|
|
626 #define PNG_CORRECT_PALETTE_SUPPORTED
|
|
627 */
|
|
628
|
|
629 /* Any chunks you are not interested in, you can undef here. The
|
|
630 * ones that allocate memory may be expecially important (hIST,
|
|
631 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
|
|
632 * a bit smaller.
|
|
633 */
|
|
634
|
|
635 #undef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
|
636 #undef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
|
637
|
|
638 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
|
639
|
|
640 #ifdef PNG_NO_READ_TEXT
|
|
641 # define PNG_NO_READ_iTXt
|
|
642 # define PNG_NO_READ_tEXt
|
|
643 # define PNG_NO_READ_zTXt
|
|
644 #endif
|
|
645 #ifndef PNG_NO_READ_bKGD
|
|
646 # define PNG_READ_bKGD_SUPPORTED
|
|
647 # define PNG_bKGD_SUPPORTED
|
|
648 #endif
|
|
649 #ifndef PNG_NO_READ_cHRM
|
|
650 # define PNG_READ_cHRM_SUPPORTED
|
|
651 # define PNG_cHRM_SUPPORTED
|
|
652 #endif
|
|
653 #ifndef PNG_NO_READ_gAMA
|
|
654 # define PNG_READ_gAMA_SUPPORTED
|
|
655 # define PNG_gAMA_SUPPORTED
|
|
656 #endif
|
|
657 #ifndef PNG_NO_READ_hIST
|
|
658 # define PNG_READ_hIST_SUPPORTED
|
|
659 # define PNG_hIST_SUPPORTED
|
|
660 #endif
|
|
661 #ifndef PNG_NO_READ_iCCP
|
|
662 # define PNG_READ_iCCP_SUPPORTED
|
|
663 # define PNG_iCCP_SUPPORTED
|
|
664 #endif
|
|
665 #ifndef PNG_NO_READ_iTXt
|
|
666 # ifndef PNG_READ_iTXt_SUPPORTED
|
|
667 # define PNG_READ_iTXt_SUPPORTED
|
|
668 # endif
|
|
669 # ifndef PNG_iTXt_SUPPORTED
|
|
670 # define PNG_iTXt_SUPPORTED
|
|
671 # endif
|
|
672 #endif
|
|
673 #ifndef PNG_NO_READ_oFFs
|
|
674 # define PNG_READ_oFFs_SUPPORTED
|
|
675 # define PNG_oFFs_SUPPORTED
|
|
676 #endif
|
|
677 #ifndef PNG_NO_READ_pCAL
|
|
678 # define PNG_READ_pCAL_SUPPORTED
|
|
679 # define PNG_pCAL_SUPPORTED
|
|
680 #endif
|
|
681 #ifndef PNG_NO_READ_sCAL
|
|
682 # define PNG_READ_sCAL_SUPPORTED
|
|
683 # define PNG_sCAL_SUPPORTED
|
|
684 #endif
|
|
685 #ifndef PNG_NO_READ_pHYs
|
|
686 # define PNG_READ_pHYs_SUPPORTED
|
|
687 # define PNG_pHYs_SUPPORTED
|
|
688 #endif
|
|
689 #ifndef PNG_NO_READ_sBIT
|
|
690 # define PNG_READ_sBIT_SUPPORTED
|
|
691 # define PNG_sBIT_SUPPORTED
|
|
692 #endif
|
|
693 #ifndef PNG_NO_READ_sPLT
|
|
694 # define PNG_READ_sPLT_SUPPORTED
|
|
695 # define PNG_sPLT_SUPPORTED
|
|
696 #endif
|
|
697 #ifndef PNG_NO_READ_sRGB
|
|
698 # define PNG_READ_sRGB_SUPPORTED
|
|
699 # define PNG_sRGB_SUPPORTED
|
|
700 #endif
|
|
701 #ifndef PNG_NO_READ_tEXt
|
|
702 # define PNG_READ_tEXt_SUPPORTED
|
|
703 # define PNG_tEXt_SUPPORTED
|
|
704 #endif
|
|
705 #ifndef PNG_NO_READ_tIME
|
|
706 # define PNG_READ_tIME_SUPPORTED
|
|
707 # define PNG_tIME_SUPPORTED
|
|
708 #endif
|
|
709 #ifndef PNG_NO_READ_tRNS
|
|
710 # define PNG_READ_tRNS_SUPPORTED
|
|
711 # define PNG_tRNS_SUPPORTED
|
|
712 #endif
|
|
713 #ifndef PNG_NO_READ_zTXt
|
|
714 # define PNG_READ_zTXt_SUPPORTED
|
|
715 # define PNG_zTXt_SUPPORTED
|
|
716 #endif
|
|
717 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
|
|
718 # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
|
719 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
|
720 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
|
721 # endif
|
|
722 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
|
|
723 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
724 # endif
|
|
725 #endif
|
|
726 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
|
|
727 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
|
728 # define PNG_READ_USER_CHUNKS_SUPPORTED
|
|
729 # define PNG_USER_CHUNKS_SUPPORTED
|
|
730 # ifdef PNG_NO_READ_UNKNOWN_CHUNKS
|
|
731 # undef PNG_NO_READ_UNKNOWN_CHUNKS
|
|
732 # endif
|
|
733 # ifdef PNG_NO_HANDLE_AS_UNKNOWN
|
|
734 # undef PNG_NO_HANDLE_AS_UNKNOWN
|
|
735 # endif
|
|
736 #endif
|
|
737 #ifndef PNG_NO_READ_OPT_PLTE
|
|
738 # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
|
|
739 #endif /* optional PLTE chunk in RGB and RGBA images */
|
|
740 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
|
|
741 defined(PNG_READ_zTXt_SUPPORTED)
|
|
742 # define PNG_READ_TEXT_SUPPORTED
|
|
743 # define PNG_TEXT_SUPPORTED
|
|
744 #endif
|
|
745
|
|
746 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
|
|
747
|
|
748 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
|
749
|
|
750 #ifdef PNG_NO_WRITE_TEXT
|
|
751 # define PNG_NO_WRITE_iTXt
|
|
752 # define PNG_NO_WRITE_tEXt
|
|
753 # define PNG_NO_WRITE_zTXt
|
|
754 #endif
|
|
755 #ifndef PNG_NO_WRITE_bKGD
|
|
756 # define PNG_WRITE_bKGD_SUPPORTED
|
|
757 # ifndef PNG_bKGD_SUPPORTED
|
|
758 # define PNG_bKGD_SUPPORTED
|
|
759 # endif
|
|
760 #endif
|
|
761 #ifndef PNG_NO_WRITE_cHRM
|
|
762 # define PNG_WRITE_cHRM_SUPPORTED
|
|
763 # ifndef PNG_cHRM_SUPPORTED
|
|
764 # define PNG_cHRM_SUPPORTED
|
|
765 # endif
|
|
766 #endif
|
|
767 #ifndef PNG_NO_WRITE_gAMA
|
|
768 # define PNG_WRITE_gAMA_SUPPORTED
|
|
769 # ifndef PNG_gAMA_SUPPORTED
|
|
770 # define PNG_gAMA_SUPPORTED
|
|
771 # endif
|
|
772 #endif
|
|
773 #ifndef PNG_NO_WRITE_hIST
|
|
774 # define PNG_WRITE_hIST_SUPPORTED
|
|
775 # ifndef PNG_hIST_SUPPORTED
|
|
776 # define PNG_hIST_SUPPORTED
|
|
777 # endif
|
|
778 #endif
|
|
779 #ifndef PNG_NO_WRITE_iCCP
|
|
780 # define PNG_WRITE_iCCP_SUPPORTED
|
|
781 # ifndef PNG_iCCP_SUPPORTED
|
|
782 # define PNG_iCCP_SUPPORTED
|
|
783 # endif
|
|
784 #endif
|
|
785 #ifndef PNG_NO_WRITE_iTXt
|
|
786 # ifndef PNG_WRITE_iTXt_SUPPORTED
|
|
787 # define PNG_WRITE_iTXt_SUPPORTED
|
|
788 # endif
|
|
789 # ifndef PNG_iTXt_SUPPORTED
|
|
790 # define PNG_iTXt_SUPPORTED
|
|
791 # endif
|
|
792 #endif
|
|
793 #ifndef PNG_NO_WRITE_oFFs
|
|
794 # define PNG_WRITE_oFFs_SUPPORTED
|
|
795 # ifndef PNG_oFFs_SUPPORTED
|
|
796 # define PNG_oFFs_SUPPORTED
|
|
797 # endif
|
|
798 #endif
|
|
799 #ifndef PNG_NO_WRITE_pCAL
|
|
800 # define PNG_WRITE_pCAL_SUPPORTED
|
|
801 # ifndef PNG_pCAL_SUPPORTED
|
|
802 # define PNG_pCAL_SUPPORTED
|
|
803 # endif
|
|
804 #endif
|
|
805 #ifndef PNG_NO_WRITE_sCAL
|
|
806 # define PNG_WRITE_sCAL_SUPPORTED
|
|
807 # ifndef PNG_sCAL_SUPPORTED
|
|
808 # define PNG_sCAL_SUPPORTED
|
|
809 # endif
|
|
810 #endif
|
|
811 #ifndef PNG_NO_WRITE_pHYs
|
|
812 # define PNG_WRITE_pHYs_SUPPORTED
|
|
813 # ifndef PNG_pHYs_SUPPORTED
|
|
814 # define PNG_pHYs_SUPPORTED
|
|
815 # endif
|
|
816 #endif
|
|
817 #ifndef PNG_NO_WRITE_sBIT
|
|
818 # define PNG_WRITE_sBIT_SUPPORTED
|
|
819 # ifndef PNG_sBIT_SUPPORTED
|
|
820 # define PNG_sBIT_SUPPORTED
|
|
821 # endif
|
|
822 #endif
|
|
823 #ifndef PNG_NO_WRITE_sPLT
|
|
824 # define PNG_WRITE_sPLT_SUPPORTED
|
|
825 # ifndef PNG_sPLT_SUPPORTED
|
|
826 # define PNG_sPLT_SUPPORTED
|
|
827 # endif
|
|
828 #endif
|
|
829 #ifndef PNG_NO_WRITE_sRGB
|
|
830 # define PNG_WRITE_sRGB_SUPPORTED
|
|
831 # ifndef PNG_sRGB_SUPPORTED
|
|
832 # define PNG_sRGB_SUPPORTED
|
|
833 # endif
|
|
834 #endif
|
|
835 #ifndef PNG_NO_WRITE_tEXt
|
|
836 # define PNG_WRITE_tEXt_SUPPORTED
|
|
837 # ifndef PNG_tEXt_SUPPORTED
|
|
838 # define PNG_tEXt_SUPPORTED
|
|
839 # endif
|
|
840 #endif
|
|
841 #ifndef PNG_NO_WRITE_tIME
|
|
842 # define PNG_WRITE_tIME_SUPPORTED
|
|
843 # ifndef PNG_tIME_SUPPORTED
|
|
844 # define PNG_tIME_SUPPORTED
|
|
845 # endif
|
|
846 #endif
|
|
847 #ifndef PNG_NO_WRITE_tRNS
|
|
848 # define PNG_WRITE_tRNS_SUPPORTED
|
|
849 # ifndef PNG_tRNS_SUPPORTED
|
|
850 # define PNG_tRNS_SUPPORTED
|
|
851 # endif
|
|
852 #endif
|
|
853 #ifndef PNG_NO_WRITE_zTXt
|
|
854 # define PNG_WRITE_zTXt_SUPPORTED
|
|
855 # ifndef PNG_zTXt_SUPPORTED
|
|
856 # define PNG_zTXt_SUPPORTED
|
|
857 # endif
|
|
858 #endif
|
|
859 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
|
|
860 # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
|
861 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
|
862 # define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
|
863 # endif
|
|
864 # ifndef PNG_NO_HANDLE_AS_UNKNOWN
|
|
865 # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
866 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
867 # endif
|
|
868 # endif
|
|
869 #endif
|
|
870 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
|
|
871 defined(PNG_WRITE_zTXt_SUPPORTED)
|
|
872 # define PNG_WRITE_TEXT_SUPPORTED
|
|
873 # ifndef PNG_TEXT_SUPPORTED
|
|
874 # define PNG_TEXT_SUPPORTED
|
|
875 # endif
|
|
876 #endif
|
|
877
|
|
878 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
|
|
879
|
|
880 /* Turn this off to disable png_read_png() and
|
|
881 * png_write_png() and leave the row_pointers member
|
|
882 * out of the info structure.
|
|
883 */
|
|
884 #ifndef PNG_NO_INFO_IMAGE
|
|
885 # define PNG_INFO_IMAGE_SUPPORTED
|
|
886 #endif
|
|
887
|
|
888 /* need the time information for reading tIME chunks */
|
|
889 #if defined(PNG_tIME_SUPPORTED)
|
|
890 # if !defined(_WIN32_WCE)
|
|
891 /* "time.h" functions are not supported on WindowsCE */
|
|
892 # include <time.h>
|
|
893 # endif
|
|
894 #endif
|
|
895
|
|
896 /* Some typedefs to get us started. These should be safe on most of the
|
|
897 * common platforms. The typedefs should be at least as large as the
|
|
898 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
|
|
899 * don't have to be exactly that size. Some compilers dislike passing
|
|
900 * unsigned shorts as function parameters, so you may be better off using
|
|
901 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
|
|
902 * want to have unsigned int for png_uint_32 instead of unsigned long.
|
|
903 */
|
|
904
|
|
905 typedef unsigned long png_uint_32;
|
|
906 typedef long png_int_32;
|
|
907 typedef unsigned short png_uint_16;
|
|
908 typedef short png_int_16;
|
|
909 typedef unsigned char png_byte;
|
|
910
|
|
911 /* This is usually size_t. It is typedef'ed just in case you need it to
|
|
912 change (I'm not sure if you will or not, so I thought I'd be safe) */
|
|
913 typedef size_t png_size_t;
|
|
914
|
|
915 /* The following is needed for medium model support. It cannot be in the
|
|
916 * PNG_INTERNAL section. Needs modification for other compilers besides
|
|
917 * MSC. Model independent support declares all arrays and pointers to be
|
|
918 * large using the far keyword. The zlib version used must also support
|
|
919 * model independent data. As of version zlib 1.0.4, the necessary changes
|
|
920 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
|
|
921 * changes that are needed. (Tim Wegner)
|
|
922 */
|
|
923
|
|
924 /* Separate compiler dependencies (problem here is that zlib.h always
|
|
925 defines FAR. (SJT) */
|
|
926 #ifdef __BORLANDC__
|
|
927 # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
|
|
928 # define LDATA 1
|
|
929 # else
|
|
930 # define LDATA 0
|
|
931 # endif
|
|
932 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
|
|
933 # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
|
|
934 # define PNG_MAX_MALLOC_64K
|
|
935 # if (LDATA != 1)
|
|
936 # ifndef FAR
|
|
937 # define FAR __far
|
|
938 # endif
|
|
939 # define USE_FAR_KEYWORD
|
|
940 # endif /* LDATA != 1 */
|
|
941 /* Possibly useful for moving data out of default segment.
|
|
942 * Uncomment it if you want. Could also define FARDATA as
|
|
943 * const if your compiler supports it. (SJT)
|
|
944 # define FARDATA FAR
|
|
945 */
|
|
946 # endif /* __WIN32__, __FLAT__, __CYGWIN__ */
|
|
947 #endif /* __BORLANDC__ */
|
|
948
|
|
949
|
|
950 /* Suggest testing for specific compiler first before testing for
|
|
951 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
|
|
952 * making reliance oncertain keywords suspect. (SJT)
|
|
953 */
|
|
954
|
|
955 /* MSC Medium model */
|
|
956 #if defined(FAR)
|
|
957 # if defined(M_I86MM)
|
|
958 # define USE_FAR_KEYWORD
|
|
959 # define FARDATA FAR
|
|
960 # include <dos.h>
|
|
961 # endif
|
|
962 #endif
|
|
963
|
|
964 /* SJT: default case */
|
|
965 #ifndef FAR
|
|
966 # define FAR
|
|
967 #endif
|
|
968
|
|
969 /* At this point FAR is always defined */
|
|
970 #ifndef FARDATA
|
|
971 # define FARDATA
|
|
972 #endif
|
|
973
|
|
974 /* Typedef for floating-point numbers that are converted
|
|
975 to fixed-point with a multiple of 100,000, e.g., int_gamma */
|
|
976 typedef png_int_32 png_fixed_point;
|
|
977
|
|
978 /* Add typedefs for pointers */
|
|
979 typedef void FAR * png_voidp;
|
|
980 typedef png_byte FAR * png_bytep;
|
|
981 typedef png_uint_32 FAR * png_uint_32p;
|
|
982 typedef png_int_32 FAR * png_int_32p;
|
|
983 typedef png_uint_16 FAR * png_uint_16p;
|
|
984 typedef png_int_16 FAR * png_int_16p;
|
|
985 typedef PNG_CONST char FAR * png_const_charp;
|
|
986 typedef char FAR * png_charp;
|
|
987 typedef png_fixed_point FAR * png_fixed_point_p;
|
|
988
|
|
989 #ifndef PNG_NO_STDIO
|
|
990 #if defined(_WIN32_WCE)
|
|
991 typedef HANDLE png_FILE_p;
|
|
992 #else
|
|
993 typedef FILE * png_FILE_p;
|
|
994 #endif
|
|
995 #endif
|
|
996
|
|
997 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
998 typedef double FAR * png_doublep;
|
|
999 #endif
|
|
1000
|
|
1001 /* Pointers to pointers; i.e. arrays */
|
|
1002 typedef png_byte FAR * FAR * png_bytepp;
|
|
1003 typedef png_uint_32 FAR * FAR * png_uint_32pp;
|
|
1004 typedef png_int_32 FAR * FAR * png_int_32pp;
|
|
1005 typedef png_uint_16 FAR * FAR * png_uint_16pp;
|
|
1006 typedef png_int_16 FAR * FAR * png_int_16pp;
|
|
1007 typedef PNG_CONST char FAR * FAR * png_const_charpp;
|
|
1008 typedef char FAR * FAR * png_charpp;
|
|
1009 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
|
|
1010 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
1011 typedef double FAR * FAR * png_doublepp;
|
|
1012 #endif
|
|
1013
|
|
1014 /* Pointers to pointers to pointers; i.e., pointer to array */
|
|
1015 typedef char FAR * FAR * FAR * png_charppp;
|
|
1016
|
|
1017 /* libpng typedefs for types in zlib. If zlib changes
|
|
1018 * or another compression library is used, then change these.
|
|
1019 * Eliminates need to change all the source files.
|
|
1020 */
|
|
1021 typedef charf * png_zcharp;
|
|
1022 typedef charf * FAR * png_zcharpp;
|
|
1023 typedef z_stream FAR * png_zstreamp;
|
|
1024
|
|
1025 /*
|
|
1026 * Define PNG_BUILD_DLL if the module being built is a Windows
|
|
1027 * LIBPNG DLL.
|
|
1028 *
|
|
1029 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
|
|
1030 * It is equivalent to Microsoft predefined macro _DLL that is
|
|
1031 * automatically defined when you compile using the share
|
|
1032 * version of the CRT (C Run-Time library)
|
|
1033 *
|
|
1034 * The cygwin mods make this behavior a little different:
|
|
1035 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
|
|
1036 * Define PNG_STATIC if you are building a static library for use with cygwin,
|
|
1037 * -or- if you are building an application that you want to link to the
|
|
1038 * static library.
|
|
1039 * PNG_USE_DLL is defined by default (no user action needed) unless one of
|
|
1040 * the other flags is defined.
|
|
1041 */
|
|
1042
|
|
1043 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
|
|
1044 # define PNG_DLL
|
|
1045 #endif
|
|
1046 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
|
|
1047 * When building a static lib, default to no GLOBAL ARRAYS, but allow
|
|
1048 * command-line override
|
|
1049 */
|
|
1050 #if defined(__CYGWIN__)
|
|
1051 # if !defined(PNG_STATIC)
|
|
1052 # if defined(PNG_USE_GLOBAL_ARRAYS)
|
|
1053 # undef PNG_USE_GLOBAL_ARRAYS
|
|
1054 # endif
|
|
1055 # if !defined(PNG_USE_LOCAL_ARRAYS)
|
|
1056 # define PNG_USE_LOCAL_ARRAYS
|
|
1057 # endif
|
|
1058 # else
|
|
1059 # if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
|
|
1060 # if defined(PNG_USE_GLOBAL_ARRAYS)
|
|
1061 # undef PNG_USE_GLOBAL_ARRAYS
|
|
1062 # endif
|
|
1063 # endif
|
|
1064 # endif
|
|
1065 # if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
|
|
1066 # define PNG_USE_LOCAL_ARRAYS
|
|
1067 # endif
|
|
1068 #endif
|
|
1069
|
|
1070 /* Do not use global arrays (helps with building DLL's)
|
|
1071 * They are no longer used in libpng itself, since version 1.0.5c,
|
|
1072 * but might be required for some pre-1.0.5c applications.
|
|
1073 */
|
|
1074 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
|
|
1075 # if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
|
|
1076 # define PNG_USE_LOCAL_ARRAYS
|
|
1077 # else
|
|
1078 # define PNG_USE_GLOBAL_ARRAYS
|
|
1079 # endif
|
|
1080 #endif
|
|
1081
|
|
1082 #if defined(__CYGWIN__)
|
|
1083 # undef PNGAPI
|
|
1084 # define PNGAPI __cdecl
|
|
1085 # undef PNG_IMPEXP
|
|
1086 # define PNG_IMPEXP
|
|
1087 #endif
|
|
1088
|
|
1089 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
|
|
1090 * you may get warnings regarding the linkage of png_zalloc and png_zfree.
|
|
1091 * Don't ignore those warnings; you must also reset the default calling
|
|
1092 * convention in your compiler to match your PNGAPI, and you must build
|
|
1093 * zlib and your applications the same way you build libpng.
|
|
1094 */
|
|
1095
|
|
1096 #ifndef PNGAPI
|
|
1097
|
|
1098 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
|
|
1099 # ifndef PNG_NO_MODULEDEF
|
|
1100 # define PNG_NO_MODULEDEF
|
|
1101 # endif
|
|
1102 #endif
|
|
1103
|
|
1104 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
|
|
1105 # define PNG_IMPEXP
|
|
1106 #endif
|
|
1107
|
|
1108 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
|
|
1109 (( defined(_Windows) || defined(_WINDOWS) || \
|
|
1110 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
|
|
1111
|
|
1112 # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
|
|
1113 # define PNGAPI __cdecl
|
|
1114 # else
|
|
1115 # define PNGAPI _cdecl
|
|
1116 # endif
|
|
1117
|
|
1118 # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
|
|
1119 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
|
|
1120 # define PNG_IMPEXP
|
|
1121 # endif
|
|
1122
|
|
1123 # if !defined(PNG_IMPEXP)
|
|
1124
|
|
1125 # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
|
|
1126 # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
|
|
1127
|
|
1128 /* Borland/Microsoft */
|
|
1129 # if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
1130 # if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
|
|
1131 # define PNG_EXPORT PNG_EXPORT_TYPE1
|
|
1132 # else
|
|
1133 # define PNG_EXPORT PNG_EXPORT_TYPE2
|
|
1134 # if defined(PNG_BUILD_DLL)
|
|
1135 # define PNG_IMPEXP __export
|
|
1136 # else
|
|
1137 # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
|
|
1138 VC++ */
|
|
1139 # endif /* Exists in Borland C++ for
|
|
1140 C++ classes (== huge) */
|
|
1141 # endif
|
|
1142 # endif
|
|
1143
|
|
1144 # if !defined(PNG_IMPEXP)
|
|
1145 # if defined(PNG_BUILD_DLL)
|
|
1146 # define PNG_IMPEXP __declspec(dllexport)
|
|
1147 # else
|
|
1148 # define PNG_IMPEXP __declspec(dllimport)
|
|
1149 # endif
|
|
1150 # endif
|
|
1151 # endif /* PNG_IMPEXP */
|
|
1152 #else /* !(DLL || non-cygwin WINDOWS) */
|
|
1153 # if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
|
|
1154 # define PNGAPI _System
|
|
1155 # define PNG_IMPEXP
|
|
1156 # else
|
|
1157 # if 0 /* ... other platforms, with other meanings */
|
|
1158 # else
|
|
1159 # define PNGAPI
|
|
1160 # define PNG_IMPEXP
|
|
1161 # endif
|
|
1162 # endif
|
|
1163 #endif
|
|
1164 #endif
|
|
1165
|
|
1166 #ifndef PNGAPI
|
|
1167 # define PNGAPI
|
|
1168 #endif
|
|
1169 #ifndef PNG_IMPEXP
|
|
1170 # define PNG_IMPEXP
|
|
1171 #endif
|
|
1172
|
|
1173 #ifndef PNG_EXPORT
|
|
1174 # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
|
|
1175 #endif
|
|
1176
|
|
1177 #ifdef PNG_USE_GLOBAL_ARRAYS
|
|
1178 # ifndef PNG_EXPORT_VAR
|
|
1179 # define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
|
|
1180 # endif
|
|
1181 #endif
|
|
1182
|
|
1183 /* User may want to use these so they are not in PNG_INTERNAL. Any library
|
|
1184 * functions that are passed far data must be model independent.
|
|
1185 */
|
|
1186
|
|
1187 #ifndef PNG_ABORT
|
|
1188 # define PNG_ABORT() abort()
|
|
1189 #endif
|
|
1190
|
|
1191 #ifdef PNG_SETJMP_SUPPORTED
|
|
1192 # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
|
1193 #else
|
|
1194 # define png_jmpbuf(png_ptr) \
|
|
1195 (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
|
|
1196 #endif
|
|
1197
|
|
1198 #if defined(USE_FAR_KEYWORD) /* memory model independent fns */
|
|
1199 /* use this to make far-to-near assignments */
|
|
1200 # define CHECK 1
|
|
1201 # define NOCHECK 0
|
|
1202 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
|
|
1203 # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
|
|
1204 # define png_strcpy _fstrcpy
|
|
1205 # define png_strlen _fstrlen
|
|
1206 # define png_memcmp _fmemcmp /* SJT: added */
|
|
1207 # define png_memcpy _fmemcpy
|
|
1208 # define png_memset _fmemset
|
|
1209 #else /* use the usual functions */
|
|
1210 # define CVT_PTR(ptr) (ptr)
|
|
1211 # define CVT_PTR_NOCHECK(ptr) (ptr)
|
|
1212 # define png_strcpy strcpy
|
|
1213 # define png_strlen strlen
|
|
1214 # define png_memcmp memcmp /* SJT: added */
|
|
1215 # define png_memcpy memcpy
|
|
1216 # define png_memset memset
|
|
1217 #endif
|
|
1218 /* End of memory model independent support */
|
|
1219
|
|
1220 /* Just a little check that someone hasn't tried to define something
|
|
1221 * contradictory.
|
|
1222 */
|
|
1223 #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
|
|
1224 # undef PNG_ZBUF_SIZE
|
|
1225 # define PNG_ZBUF_SIZE 65536
|
|
1226 #endif
|
|
1227
|
|
1228 #ifdef PNG_READ_SUPPORTED
|
|
1229 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
|
|
1230 #if defined(PNG_INTERNAL)
|
|
1231
|
|
1232 /* These are the default thresholds before the MMX code kicks in; if either
|
|
1233 * rowbytes or bitdepth is below the threshold, plain C code is used. These
|
|
1234 * can be overridden at runtime via the png_set_mmx_thresholds() call in
|
|
1235 * libpng 1.2.0 and later. The values below were chosen by Intel.
|
|
1236 */
|
|
1237
|
|
1238 #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
|
|
1239 # define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
|
|
1240 #endif
|
|
1241 #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
|
|
1242 # define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
|
|
1243 #endif
|
|
1244
|
|
1245 /* Set this in the makefile for VC++ on Pentium, not here. */
|
|
1246 /* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
|
1247 * MMX will be detected at run time and used if present.
|
|
1248 */
|
|
1249 #ifdef PNG_USE_PNGVCRD
|
|
1250 # define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
1251 # define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
1252 # define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
1253 #endif
|
|
1254
|
|
1255 /* Set this in the makefile for gcc/as on Pentium, not here. */
|
|
1256 /* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
|
1257 * MMX will be detected at run time and used if present.
|
|
1258 */
|
|
1259 #ifdef PNG_USE_PNGGCCRD
|
|
1260 # define PNG_HAVE_ASSEMBLER_COMBINE_ROW
|
|
1261 # define PNG_HAVE_ASSEMBLER_READ_INTERLACE
|
|
1262 # define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
|
|
1263 #endif
|
|
1264 /* - see pnggccrd.c for info about what is currently enabled */
|
|
1265
|
|
1266 #endif /* PNG_INTERNAL */
|
|
1267 #endif /* PNG_READ_SUPPORTED */
|
|
1268
|
|
1269 #endif /* PNGCONF_H */
|
|
1270
|