00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef PNGCONF_H
00018 #define PNGCONF_H
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef PNG_ZBUF_SIZE
00034 #define PNG_ZBUF_SIZE 8192
00035 #endif
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
00046 #define PNG_MAX_MALLOC_64K
00047 #endif
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 # ifdef PNG_NO_STDIO
00063 # ifndef PNG_NO_CONSOLE_IO
00064 # define PNG_NO_CONSOLE_IO
00065 # endif
00066 # ifdef PNG_DEBUG
00067 # if (PNG_DEBUG > 0)
00068 # include <stdio.h>
00069 # endif
00070 # endif
00071 # else
00072 # include <stdio.h>
00073 # endif
00074
00075
00076
00077
00078
00079
00080
00081
00082 #ifndef PNGARG
00083
00084 #ifdef OF
00085 #define PNGARG(arglist) OF(arglist)
00086 #else
00087
00088 #ifdef _NO_PROTO
00089 #define PNGARG(arglist) ()
00090 #else
00091 #define PNGARG(arglist) arglist
00092 #endif
00093
00094 #endif
00095
00096 #endif
00097
00098
00099
00100
00101
00102 #ifndef MACOS
00103 #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
00104 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
00105 #define MACOS
00106 #endif
00107 #endif
00108
00109
00110 #if !defined(MACOS) && !defined(RISCOS)
00111 #include <sys/types.h>
00112 #endif
00113
00114
00115
00116
00117 #ifdef __linux__
00118 #ifdef _BSD_SOURCE
00119 #define _PNG_SAVE_BSD_SOURCE
00120 #undef _BSD_SOURCE
00121 #endif
00122 #ifdef _SETJMP_H
00123 __png.h__ already includes setjmp.h
00124 __dont__ include it again
00125 #endif
00126 #endif
00127
00128
00129 #include <setjmp.h>
00130
00131 #ifdef __linux__
00132 #ifdef _PNG_SAVE_BSD_SOURCE
00133 #define _BSD_SOURCE
00134 #undef _PNG_SAVE_BSD_SOURCE
00135 #endif
00136 #endif
00137
00138 #ifdef BSD
00139 #include <strings.h>
00140 #else
00141 #include <string.h>
00142 #endif
00143
00144
00145 #ifdef PNG_INTERNAL
00146 #include <stdlib.h>
00147
00148
00149
00150
00151
00152
00153
00154
00155 #define PNG_EXTERN
00156
00157
00158
00159
00160
00161 #if defined(MACOS)
00162
00163
00164
00165
00166 #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
00167 #include <fp.h>
00168 #endif
00169 #else
00170 #include <math.h>
00171 #endif
00172
00173
00174 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
00175 #define PNG_ALWAYS_EXTERN
00176 #endif
00177
00178
00179
00180
00181
00182 #ifdef __TURBOC__
00183 #include <mem.h>
00184 #include "alloc.h"
00185 #endif
00186
00187 #ifdef _MSC_VER
00188 #include <malloc.h>
00189 #endif
00190
00191
00192
00193
00194
00195 #ifndef PNG_DITHER_RED_BITS
00196 #define PNG_DITHER_RED_BITS 5
00197 #endif
00198 #ifndef PNG_DITHER_GREEN_BITS
00199 #define PNG_DITHER_GREEN_BITS 5
00200 #endif
00201 #ifndef PNG_DITHER_BLUE_BITS
00202 #define PNG_DITHER_BLUE_BITS 5
00203 #endif
00204
00205
00206
00207
00208
00209
00210
00211
00212 #ifndef PNG_MAX_GAMMA_8
00213 #define PNG_MAX_GAMMA_8 11
00214 #endif
00215
00216
00217
00218
00219 #ifndef PNG_GAMMA_THRESHOLD
00220 #define PNG_GAMMA_THRESHOLD 0.05
00221 #endif
00222
00223 #endif
00224
00225
00226
00227
00228
00229
00230 #ifndef PNG_NO_CONST
00231 # define PNG_CONST const
00232 #else
00233 # define PNG_CONST
00234 #endif
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
00264 !defined(PNG_NO_READ_TRANSFORMS)
00265 #define PNG_READ_TRANSFORMS_SUPPORTED
00266 #endif
00267 #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
00268 !defined(PNG_NO_WRITE_TRANSFORMS)
00269 #define PNG_WRITE_TRANSFORMS_SUPPORTED
00270 #endif
00271
00272 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
00273 #ifndef PNG_NO_READ_EXPAND
00274 #define PNG_READ_EXPAND_SUPPORTED
00275 #endif
00276 #ifndef PNG_NO_READ_SHIFT
00277 #define PNG_READ_SHIFT_SUPPORTED
00278 #endif
00279 #ifndef PNG_NO_READ_PACK
00280 #define PNG_READ_PACK_SUPPORTED
00281 #endif
00282 #ifndef PNG_NO_READ_BGR
00283 #define PNG_READ_BGR_SUPPORTED
00284 #endif
00285 #ifndef PNG_NO_READ_SWAP
00286 #define PNG_READ_SWAP_SUPPORTED
00287 #endif
00288 #ifndef PNG_NO_READ_PACKSWAP
00289 #define PNG_READ_PACKSWAP_SUPPORTED
00290 #endif
00291 #ifndef PNG_NO_READ_INVERT
00292 #define PNG_READ_INVERT_SUPPORTED
00293 #endif
00294 #ifndef PNG_NO_READ_DITHER
00295 #define PNG_READ_DITHER_SUPPORTED
00296 #endif
00297 #ifndef PNG_NO_READ_BACKGROUND
00298 #define PNG_READ_BACKGROUND_SUPPORTED
00299 #endif
00300 #ifndef PNG_NO_READ_16_TO_8
00301 #define PNG_READ_16_TO_8_SUPPORTED
00302 #endif
00303 #ifndef PNG_NO_READ_FILLER
00304 #define PNG_READ_FILLER_SUPPORTED
00305 #endif
00306 #ifndef PNG_NO_READ_GAMMA
00307 #define PNG_READ_GAMMA_SUPPORTED
00308 #endif
00309 #ifndef PNG_NO_READ_GRAY_TO_RGB
00310 #define PNG_READ_GRAY_TO_RGB_SUPPORTED
00311 #endif
00312 #ifndef PNG_NO_READ_SWAP_ALPHA
00313 #define PNG_READ_SWAP_ALPHA_SUPPORTED
00314 #endif
00315 #ifndef PNG_NO_READ_INVERT_ALPHA
00316 #define PNG_READ_INVERT_ALPHA_SUPPORTED
00317 #endif
00318 #ifndef PNG_NO_READ_STRIP_ALPHA
00319 #define PNG_READ_STRIP_ALPHA_SUPPORTED
00320 #endif
00321 #ifndef PNG_NO_READ_USER_TRANSFORM
00322 #define PNG_READ_USER_TRANSFORM_SUPPORTED
00323 #endif
00324 #ifndef PNG_NO_READ_RGB_TO_GRAY
00325 #define PNG_READ_RGB_TO_GRAY_SUPPORTED
00326 #endif
00327 #endif
00328
00329 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
00330 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)
00331 #define PNG_PROGRESSIVE_READ_SUPPORTED
00332 #endif
00333
00334 #define PNG_READ_INTERLACING_SUPPORTED
00335
00336 #ifndef PNG_NO_READ_COMPOSITED_NODIV
00337 #define PNG_READ_COMPOSITE_NODIV_SUPPORTED
00338 #endif
00339
00340 #ifndef PNG_NO_READ_EMPTY_PLTE
00341 #define PNG_READ_EMPTY_PLTE_SUPPORTED
00342 #endif
00343
00344 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
00345 #ifndef PNG_NO_WRITE_SHIFT
00346 #define PNG_WRITE_SHIFT_SUPPORTED
00347 #endif
00348 #ifndef PNG_NO_WRITE_PACK
00349 #define PNG_WRITE_PACK_SUPPORTED
00350 #endif
00351 #ifndef PNG_NO_WRITE_BGR
00352 #define PNG_WRITE_BGR_SUPPORTED
00353 #endif
00354 #ifndef PNG_NO_WRITE_SWAP
00355 #define PNG_WRITE_SWAP_SUPPORTED
00356 #endif
00357 #ifndef PNG_NO_WRITE_PACKSWAP
00358 #define PNG_WRITE_PACKSWAP_SUPPORTED
00359 #endif
00360 #ifndef PNG_NO_WRITE_INVERT
00361 #define PNG_WRITE_INVERT_SUPPORTED
00362 #endif
00363 #ifndef PNG_NO_WRITE_FILLER
00364 #define PNG_WRITE_FILLER_SUPPORTED
00365 #endif
00366 #ifndef PNG_NO_WRITE_SWAP_ALPHA
00367 #define PNG_WRITE_SWAP_ALPHA_SUPPORTED
00368 #endif
00369 #ifndef PNG_NO_WRITE_INVERT_ALPHA
00370 #define PNG_WRITE_INVERT_ALPHA_SUPPORTED
00371 #endif
00372 #ifndef PNG_NO_WRITE_USER_TRANSFORM
00373 #define PNG_WRITE_USER_TRANSFORM_SUPPORTED
00374 #endif
00375 #endif
00376
00377 #define PNG_WRITE_INTERLACING_SUPPORTED
00378
00379
00380
00381 #ifndef PNG_NO_WRITE_WEIGHTED_FILTER
00382 #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
00383 #endif
00384
00385 #ifndef PNG_NO_WRITE_FLUSH
00386 #define PNG_WRITE_FLUSH_SUPPORTED
00387 #endif
00388
00389 #ifndef PNG_NO_WRITE_EMPTY_PLTE
00390 #define PNG_WRITE_EMPTY_PLTE_SUPPORTED
00391 #endif
00392
00393 #ifndef PNG_NO_STDIO
00394 #define PNG_TIME_RFC1123_SUPPORTED
00395 #endif
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 #ifndef PNG_NO_EASY_ACCESS
00414 #define PNG_EASY_ACCESS_SUPPORTED
00415 #endif
00416
00417 #ifndef PNG_NO_ASSEMBLER_CODE
00418 #define PNG_ASSEMBLER_CODE_SUPPORTED
00419 #endif
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
00448 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
00449 #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
00450 #endif
00451 #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
00452 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
00453 #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
00454 #endif
00455
00456 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
00457 #ifndef PNG_NO_READ_bKGD
00458 #define PNG_READ_bKGD_SUPPORTED
00459 #endif
00460 #ifndef PNG_NO_READ_cHRM
00461 #define PNG_READ_cHRM_SUPPORTED
00462 #endif
00463 #ifndef PNG_NO_READ_gAMA
00464 #define PNG_READ_gAMA_SUPPORTED
00465 #endif
00466 #ifndef PNG_NO_READ_hIST
00467 #define PNG_READ_hIST_SUPPORTED
00468 #endif
00469 #ifndef PNG_NO_READ_oFFs
00470 #define PNG_READ_oFFs_SUPPORTED
00471 #endif
00472 #ifndef PNG_NO_READ_pCAL
00473 #define PNG_READ_pCAL_SUPPORTED
00474 #endif
00475 #ifndef PNG_NO_READ_pHYs
00476 #define PNG_READ_pHYs_SUPPORTED
00477 #endif
00478 #ifndef PNG_NO_READ_sBIT
00479 #define PNG_READ_sBIT_SUPPORTED
00480 #endif
00481 #ifndef PNG_NO_READ_sRGB
00482 #define PNG_READ_sRGB_SUPPORTED
00483 #endif
00484 #ifndef PNG_NO_READ_tEXt
00485 #define PNG_READ_tEXt_SUPPORTED
00486 #endif
00487 #ifndef PNG_NO_READ_tIME
00488 #define PNG_READ_tIME_SUPPORTED
00489 #endif
00490 #ifndef PNG_NO_READ_tRNS
00491 #define PNG_READ_tRNS_SUPPORTED
00492 #endif
00493 #ifndef PNG_NO_READ_zTXt
00494 #define PNG_READ_zTXt_SUPPORTED
00495 #endif
00496 #ifndef PNG_NO_READ_OPT_PLTE
00497 #define PNG_READ_OPT_PLTE_SUPPORTED
00498 #endif
00499 #endif
00500
00501 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
00502 #ifndef PNG_NO_WRITE_bKGD
00503 #define PNG_WRITE_bKGD_SUPPORTED
00504 #endif
00505 #ifndef PNG_NO_WRITE_cHRM
00506 #define PNG_WRITE_cHRM_SUPPORTED
00507 #endif
00508 #ifndef PNG_NO_WRITE_gAMA
00509 #define PNG_WRITE_gAMA_SUPPORTED
00510 #endif
00511 #ifndef PNG_NO_WRITE_hIST
00512 #define PNG_WRITE_hIST_SUPPORTED
00513 #endif
00514 #ifndef PNG_NO_WRITE_oFFs
00515 #define PNG_WRITE_oFFs_SUPPORTED
00516 #endif
00517 #ifndef PNG_NO_WRITE_pCAL
00518 #define PNG_WRITE_pCAL_SUPPORTED
00519 #endif
00520 #ifndef PNG_NO_WRITE_pHYs
00521 #define PNG_WRITE_pHYs_SUPPORTED
00522 #endif
00523 #ifndef PNG_NO_WRITE_sBIT
00524 #define PNG_WRITE_sBIT_SUPPORTED
00525 #endif
00526 #ifndef PNG_NO_WRITE_sRGB
00527 #define PNG_WRITE_sRGB_SUPPORTED
00528 #endif
00529 #ifndef PNG_NO_WRITE_tEXt
00530 #define PNG_WRITE_tEXt_SUPPORTED
00531 #endif
00532 #ifndef PNG_NO_WRITE_tIME
00533 #define PNG_WRITE_tIME_SUPPORTED
00534 #endif
00535 #ifndef PNG_NO_WRITE_tRNS
00536 #define PNG_WRITE_tRNS_SUPPORTED
00537 #endif
00538 #ifndef PNG_NO_WRITE_zTXt
00539 #define PNG_WRITE_zTXt_SUPPORTED
00540 #endif
00541 #endif
00542
00543
00544 #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
00545 #include <time.h>
00546 #endif
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 typedef unsigned long png_uint_32;
00558 typedef long png_int_32;
00559 typedef unsigned short png_uint_16;
00560 typedef short png_int_16;
00561 typedef unsigned char png_byte;
00562
00563
00564
00565 typedef size_t png_size_t;
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578 #ifdef __BORLANDC__
00579 #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
00580 #define LDATA 1
00581 #else
00582 #define LDATA 0
00583 #endif
00584
00585 #if !defined(__WIN32__) && !defined(__FLAT__)
00586 #define PNG_MAX_MALLOC_64K
00587 #if (LDATA != 1)
00588 #ifndef FAR
00589 #define FAR __far
00590 #endif
00591 #define USE_FAR_KEYWORD
00592 #endif
00593
00594
00595
00596
00597
00598
00599 #endif
00600
00601 #endif
00602
00603
00604
00605
00606
00607
00608
00609
00610 #if defined(FAR)
00611 # if defined(M_I86MM)
00612 # define USE_FAR_KEYWORD
00613 # define FARDATA FAR
00614 # include <dos.h>
00615 # endif
00616 #endif
00617
00618
00619 #ifndef FAR
00620 # define FAR
00621 #endif
00622
00623
00624 #ifndef FARDATA
00625 #define FARDATA
00626 #endif
00627
00628
00629 typedef void FAR * png_voidp;
00630 typedef png_byte FAR * png_bytep;
00631 typedef png_uint_32 FAR * png_uint_32p;
00632 typedef png_int_32 FAR * png_int_32p;
00633 typedef png_uint_16 FAR * png_uint_16p;
00634 typedef png_int_16 FAR * png_int_16p;
00635 typedef PNG_CONST char FAR * png_const_charp;
00636 typedef char FAR * png_charp;
00637 typedef double FAR * png_doublep;
00638
00639
00640 typedef png_byte FAR * FAR * png_bytepp;
00641 typedef png_uint_32 FAR * FAR * png_uint_32pp;
00642 typedef png_int_32 FAR * FAR * png_int_32pp;
00643 typedef png_uint_16 FAR * FAR * png_uint_16pp;
00644 typedef png_int_16 FAR * FAR * png_int_16pp;
00645 typedef PNG_CONST char FAR * FAR * png_const_charpp;
00646 typedef char FAR * FAR * png_charpp;
00647 typedef double FAR * FAR * png_doublepp;
00648
00649
00650 typedef char FAR * FAR * FAR * png_charppp;
00651
00652
00653
00654
00655
00656 typedef charf * png_zcharp;
00657 typedef charf * FAR * png_zcharpp;
00658 typedef z_stream FAR * png_zstreamp;
00659
00660
00661 #ifndef PNG_EXPORT
00662
00663 # ifdef __WIN32DLL__
00664 # define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
00665 # endif
00666
00667
00668 # ifdef ALT_WIN32_DLL
00669 # define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol
00670 # endif
00671
00672
00673 # if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
00674 # define PNG_EXPORT(type,symbol) type _export symbol
00675 # endif
00676
00677
00678 # ifdef __BEOSDLL__
00679 # define PNG_EXPORT(type,symbol) __declspec(export) type symbol
00680 # endif
00681
00682
00683 # ifdef __MACOSDLL__
00684 # define PNG_EXPORT(type,symbol) __declspec(export) type symbol
00685 # endif
00686 #endif
00687
00688 #ifndef PNG_EXPORT
00689 # define PNG_EXPORT(type,symbol) type symbol
00690 #endif
00691
00692
00693
00694
00695
00696
00697 #if defined(USE_FAR_KEYWORD)
00698
00699 # define CHECK 1
00700 # define NOCHECK 0
00701 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
00702 # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
00703 # define png_strcpy _fstrcpy
00704 # define png_strlen _fstrlen
00705 # define png_memcmp _fmemcmp
00706 # define png_memcpy _fmemcpy
00707 # define png_memset _fmemset
00708 #else
00709 # define CVT_PTR(ptr) (ptr)
00710 # define CVT_PTR_NOCHECK(ptr) (ptr)
00711 # define png_strcpy strcpy
00712 # define png_strlen strlen
00713 # define png_memcmp memcmp
00714 # define png_memcpy memcpy
00715 # define png_memset memset
00716 #endif
00717
00718
00719
00720
00721
00722 #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
00723 #undef PNG_ZBUF_SIZE
00724 #define PNG_ZBUF_SIZE 65536
00725 #endif
00726
00727 #endif
00728