pngconf.h 44 KB

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