pngconf.h 44 KB

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