pngconf.h 44 KB

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