PageRenderTime 55ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FreeImage/Source/LibMNG/libmng_data.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 1029 lines | 674 code | 126 blank | 229 comment | 7 complexity | dd2a163a6bcfdd838994e454071e17d7 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause, CPL-1.0, Unlicense, GPL-2.0, GPL-3.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, BSD-2-Clause, LGPL-2.1
  1. /* ************************************************************************** */
  2. /* * For conditions of distribution and use, * */
  3. /* * see copyright notice in libmng.h * */
  4. /* ************************************************************************** */
  5. /* * * */
  6. /* * project : libmng * */
  7. /* * file : libmng_data.h copyright (c) 2000-2007 G.Juyn * */
  8. /* * version : 1.0.10 * */
  9. /* * * */
  10. /* * purpose : main data structure definition * */
  11. /* * * */
  12. /* * author : G.Juyn * */
  13. /* * * */
  14. /* * comment : Definition of the library main data structure * */
  15. /* * * */
  16. /* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */
  17. /* * - added CRC table to main structure (for thread-safety) * */
  18. /* * 0.5.1 - 05/06/2000 - G.Juyn * */
  19. /* * - added iPLTEentries for checking hIST-length * */
  20. /* * 0.5.1 - 05/08/2000 - G.Juyn * */
  21. /* * - changed palette definition to exported palette-type * */
  22. /* * - removed frozen indicator * */
  23. /* * - added create/write indicators * */
  24. /* * - changed strict-ANSI stuff * */
  25. /* * 0.5.1 - 05/13/2000 - G.Juyn * */
  26. /* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */
  27. /* * - added TERM animation object pointer (easier reference) * */
  28. /* * - added saved-data structure for SAVE/SEEK processing * */
  29. /* * * */
  30. /* * 0.5.2 - 05/18/2000 - G.Juyn * */
  31. /* * - added fields for JNG support (IJG-based) * */
  32. /* * 0.5.2 - 05/24/2000 - G.Juyn * */
  33. /* * - changed global tRNS definition * */
  34. /* * 0.5.2 - 05/30/2000 - G.Juyn * */
  35. /* * - added delta-image fields * */
  36. /* * 0.5.2 - 06/01/2000 - G.Juyn * */
  37. /* * - added internal delta-image processing callbacks * */
  38. /* * 0.5.2 - 06/02/2000 - G.Juyn * */
  39. /* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */
  40. /* * (contributed by Tim Rowley) * */
  41. /* * - added getalphaline callback for RGB8_A8 canvasstyle * */
  42. /* * 0.5.2 - 06/06/2000 - G.Juyn * */
  43. /* * - added parameter for delayed buffer-processing * */
  44. /* * * */
  45. /* * 0.5.3 - 06/16/2000 - G.Juyn * */
  46. /* * - added update-region parms for refresh calback * */
  47. /* * - added Needrefresh parameter * */
  48. /* * 0.5.3 - 06/17/2000 - G.Juyn * */
  49. /* * - added Deltaimmediate parm for faster delta-processing * */
  50. /* * 0.5.3 - 06/21/2000 - G.Juyn * */
  51. /* * - added Speed parameter to facilitate testing * */
  52. /* * - added Imagelevel parameter for processtext callback * */
  53. /* * 0.5.3 - 06/26/2000 - G.Juyn * */
  54. /* * - changed userdata variable to mng_ptr * */
  55. /* * * */
  56. /* * 0.9.1 - 07/07/2000 - G.Juyn * */
  57. /* * - added variables for go_xxxx processing * */
  58. /* * 0.9.1 - 07/08/2000 - G.Juyn * */
  59. /* * - added variables for improved timing support * */
  60. /* * 0.9.1 - 07/15/2000 - G.Juyn * */
  61. /* * - added callbacks for SAVE/SEEK processing * */
  62. /* * - added variable for NEEDSECTIONWAIT breaks * */
  63. /* * - added variable for freeze & reset processing * */
  64. /* * 0.9.1 - 07/17/2000 - G.Juyn * */
  65. /* * - fixed suspension-buffering for 32K+ chunks * */
  66. /* * * */
  67. /* * 0.9.2 - 07/29/2000 - G.Juyn * */
  68. /* * - removed Nextbackxxx fields (no longer used) * */
  69. /* * 0.9.2 - 07/31/2000 - G.Juyn * */
  70. /* * - fixed wrapping of suspension parameters * */
  71. /* * 0.9.2 - 08/04/2000 - G.Juyn * */
  72. /* * - B111096 - fixed large-buffer read-suspension * */
  73. /* * 0.9.2 - 08/05/2000 - G.Juyn * */
  74. /* * - changed file-prefixes * */
  75. /* * * */
  76. /* * 0.9.3 - 08/26/2000 - G.Juyn * */
  77. /* * - added MAGN chunk * */
  78. /* * 0.9.3 - 09/07/2000 - G.Juyn * */
  79. /* * - added support for new filter_types * */
  80. /* * 0.9.3 - 09/10/2000 - G.Juyn * */
  81. /* * - fixed DEFI behavior * */
  82. /* * 0.9.3 - 10/10/2000 - G.Juyn * */
  83. /* * - added support for alpha-depth prediction * */
  84. /* * 0.9.3 - 10/11/2000 - G.Juyn * */
  85. /* * - added support for nEED * */
  86. /* * 0.9.3 - 10/16/2000 - G.Juyn * */
  87. /* * - added optional support for bKGD for PNG images * */
  88. /* * - added support for JDAA * */
  89. /* * 0.9.3 - 10/17/2000 - G.Juyn * */
  90. /* * - added callback to process non-critical unknown chunks * */
  91. /* * - fixed support for bKGD * */
  92. /* * 0.9.3 - 10/19/2000 - G.Juyn * */
  93. /* * - implemented delayed delta-processing * */
  94. /* * 0.9.4 - 12/16/2000 - G.Juyn * */
  95. /* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
  96. /* * * */
  97. /* * 1.0.1 - 02/08/2001 - G.Juyn * */
  98. /* * - added MEND processing callback * */
  99. /* * 1.0.1 - 02/13/2001 - G.Juyn * */
  100. /* * - fixed first FRAM_MODE=4 timing problem * */
  101. /* * * */
  102. /* * 1.0.2 - 06/23/2001 - G.Juyn * */
  103. /* * - added optimization option for MNG-video playback * */
  104. /* * - added processterm callback * */
  105. /* * 1.0.2 - 06/25/2001 - G.Juyn * */
  106. /* * - added option to turn off progressive refresh * */
  107. /* * * */
  108. /* * 1.0.5 - 07/08/2002 - G.Juyn * */
  109. /* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */
  110. /* * 1.0.5 - 07/16/2002 - G.Juyn * */
  111. /* * - B581625 - large chunks fail with suspension reads * */
  112. /* * 1.0.5 - 08/15/2002 - G.Juyn * */
  113. /* * - completed PROM support * */
  114. /* * 1.0.5 - 09/15/2002 - G.Juyn * */
  115. /* * - fixed LOOP iteration=0 special case * */
  116. /* * 1.0.5 - 09/20/2002 - G.Juyn * */
  117. /* * - finished support for BACK image & tiling * */
  118. /* * 1.0.5 - 10/07/2002 - G.Juyn * */
  119. /* * - added another fix for misplaced TERM chunk * */
  120. /* * - completed support for condition=2 in TERM chunk * */
  121. /* * 1.0.5 - 10/20/2002 - G.Juyn * */
  122. /* * - fixed processing for multiple objects in MAGN * */
  123. /* * - fixed display of visible target of PAST operation * */
  124. /* * 1.0.5 - 11/07/2002 - G.Juyn * */
  125. /* * - added support to get totals after mng_read() * */
  126. /* * 1.0.5 - 24/02/2003 - G.Juyn * */
  127. /* * - B683152 - libjpeg suspension not always honored correctly* */
  128. /* * * */
  129. /* * 1.0.6 - 04/11/2003 - G.Juyn * */
  130. /* * - B719420 - fixed several MNG_APP_CMS problems * */
  131. /* * 1.0.6 - 07/05/2003 - G. R-P * */
  132. /* * - optionally use zlib's crc32() function * */
  133. /* * 1.0.6 - 07/29/2003 - G.R-P * */
  134. /* * - added SKIPCHUNK conditionals around PAST chunk support * */
  135. /* * 1.0.6 - 08/17/2003 - G.R-P * */
  136. /* * - added iPNGdepth member to pData structure * */
  137. /* * * */
  138. /* * 1.0.7 - 03/10/2004 - G.R-P * */
  139. /* * - added conditionals around openstream/closestream * */
  140. /* * 1.0.7 - 03/24/2004 - G.R-P * */
  141. /* * - added more SKIPCHUNK conditionals * */
  142. /* * * */
  143. /* * 1.0.8 - 04/02/2004 - G.Juyn * */
  144. /* * - added CRC existence & checking flags * */
  145. /* * 1.0.8 - 04/10/2004 - G.Juyn * */
  146. /* * - added data-push mechanisms for specialized decoders * */
  147. /* * * */
  148. /* * 1.0.9 - 12/11/2004 - G.Juyn * */
  149. /* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */
  150. /* * * */
  151. /* * 1.0.10 - 04/08/2007 - G.Juyn * */
  152. /* * - added support for mPNG proposal * */
  153. /* * 1.0.10 - 04/12/2007 - G.Juyn * */
  154. /* * - added support for ANG proposal * */
  155. /* * * */
  156. /* ************************************************************************** */
  157. #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
  158. #pragma option -A /* force ANSI-C */
  159. #endif
  160. #ifndef _libmng_data_h_
  161. #define _libmng_data_h_
  162. /* ************************************************************************** */
  163. #define MNG_MAGIC 0x52530a0aL
  164. /* ************************************************************************** */
  165. /* * * */
  166. /* * Internal structures * */
  167. /* * * */
  168. /* ************************************************************************** */
  169. typedef mng_palette8 mng_rgbpaltab;
  170. /* ************************************************************************** */
  171. /* * * */
  172. /* * The saved_data structure * */
  173. /* * * */
  174. /* * This contains the saved data after a SAVE chunk has been processed. * */
  175. /* * The data is saved from the main data structure during SAVE processing, * */
  176. /* * and restored to the main data structure during SEEK processing. * */
  177. /* * * */
  178. /* ************************************************************************** */
  179. typedef struct mng_savedata_struct {
  180. #if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
  181. mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
  182. mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
  183. mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
  184. mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
  185. mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
  186. mng_bool bHasglobalICCP; /* global iCCP chunk processed */
  187. mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
  188. #endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
  189. #ifdef MNG_SUPPORT_DISPLAY
  190. mng_uint16 iBACKred; /* BACK fields */
  191. mng_uint16 iBACKgreen;
  192. mng_uint16 iBACKblue;
  193. mng_uint8 iBACKmandatory;
  194. mng_uint16 iBACKimageid;
  195. mng_uint8 iBACKtile;
  196. mng_uint8 iFRAMmode; /* FRAM fields (global) */
  197. mng_uint32 iFRAMdelay;
  198. mng_uint32 iFRAMtimeout;
  199. mng_bool bFRAMclipping;
  200. mng_int32 iFRAMclipl;
  201. mng_int32 iFRAMclipr;
  202. mng_int32 iFRAMclipt;
  203. mng_int32 iFRAMclipb;
  204. mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
  205. mng_rgbpaltab aGlobalPLTEentries;
  206. mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
  207. mng_uint8arr aGlobalTRNSrawdata;
  208. mng_uint32 iGlobalGamma; /* global gAMA fields */
  209. #ifndef MNG_SKIPCHUNK_cHRM
  210. mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
  211. mng_uint32 iGlobalWhitepointy;
  212. mng_uint32 iGlobalPrimaryredx;
  213. mng_uint32 iGlobalPrimaryredy;
  214. mng_uint32 iGlobalPrimarygreenx;
  215. mng_uint32 iGlobalPrimarygreeny;
  216. mng_uint32 iGlobalPrimarybluex;
  217. mng_uint32 iGlobalPrimarybluey;
  218. #endif
  219. mng_uint8 iGlobalRendintent; /* global sRGB fields */
  220. mng_uint32 iGlobalProfilesize; /* global iCCP fields */
  221. mng_ptr pGlobalProfile;
  222. mng_uint16 iGlobalBKGDred; /* global bKGD fields */
  223. mng_uint16 iGlobalBKGDgreen;
  224. mng_uint16 iGlobalBKGDblue;
  225. #endif /* MNG_SUPPORT_DISPLAY */
  226. } mng_savedata;
  227. typedef mng_savedata * mng_savedatap;
  228. /* ************************************************************************** */
  229. /* * * */
  230. /* * Internal buffer structure for data push mechanisms * */
  231. /* * * */
  232. /* ************************************************************************** */
  233. typedef struct {
  234. mng_ptr pNext; /* for linked list */
  235. mng_ptr pData; /* used for chunks & data */
  236. mng_uint32 iLength;
  237. mng_bool bOwned;
  238. mng_uint8p pDatanext; /* only used for data */
  239. mng_uint32 iRemaining;
  240. } mng_pushdata;
  241. typedef mng_pushdata * mng_pushdatap;
  242. /* ************************************************************************** */
  243. /* * * */
  244. /* * The main libmng data structure * */
  245. /* * * */
  246. /* * The handle used in all functions points to this structure which * */
  247. /* * contains all volatile data necessary to process the network graphic. * */
  248. /* * * */
  249. /* ************************************************************************** */
  250. typedef struct mng_data_struct {
  251. mng_uint32 iMagic; /* magic number to validate
  252. a given handle */
  253. mng_ptr pUserdata; /* application workdata */
  254. mng_imgtype eSigtype; /* image information */
  255. mng_imgtype eImagetype; /* initially zeroed */
  256. mng_uint32 iWidth; /* filled after header is processed */
  257. mng_uint32 iHeight;
  258. mng_uint32 iTicks; /* these only after MHDR */
  259. mng_uint32 iLayercount;
  260. mng_uint32 iFramecount;
  261. mng_uint32 iPlaytime;
  262. mng_uint32 iSimplicity;
  263. mng_uint8 iAlphadepth; /* indicates expected alpha-depth */
  264. mng_uint32 iImagelevel; /* level of image inside a stream */
  265. mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */
  266. mng_uint32 iBkgdstyle; /* layout of the background-canvas */
  267. mng_int8 iMagnify; /* magnification factor (not used yet) */
  268. mng_uint32 iOffsetx; /* x-offset for extremely large image */
  269. mng_uint32 iOffsety; /* y-offset for extremely large image */
  270. mng_uint32 iCanvaswidth; /* real canvas size */
  271. mng_uint32 iCanvasheight; /* must be set by processheader callback */
  272. mng_uint16 iBGred; /* default background color */
  273. mng_uint16 iBGgreen; /* initially "black" */
  274. mng_uint16 iBGblue;
  275. mng_bool bUseBKGD; /* preferred use of bKGD for PNG */
  276. mng_bool bIssRGB; /* indicates sRGB system */
  277. #ifdef MNG_FULL_CMS /* little CMS variables */
  278. mng_cmsprof hProf1; /* image input profile */
  279. mng_cmsprof hProf2; /* default output profile */
  280. mng_cmsprof hProf3; /* default sRGB profile */
  281. mng_cmstrans hTrans; /* current transformation handle */
  282. #endif
  283. mng_float dViewgamma; /* gamma calculation variables */
  284. mng_float dDisplaygamma; /* initially set for sRGB conditions */
  285. mng_float dDfltimggamma;
  286. mng_bool bStorechunks; /* switch for storing chunkdata */
  287. mng_bool bSectionbreaks; /* indicate NEEDSECTIONWAIT breaks */
  288. mng_bool bCacheplayback; /* switch to cache playback info */
  289. mng_bool bDoProgressive; /* progressive refresh for large images */
  290. mng_uint32 iCrcmode; /* CRC existence & checking flags */
  291. mng_speedtype iSpeed; /* speed-modifier for animations */
  292. mng_uint32 iMaxwidth; /* maximum canvas size */
  293. mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */
  294. mng_int32 iErrorcode; /* error reporting fields */
  295. mng_int8 iSeverity;
  296. mng_int32 iErrorx1;
  297. mng_int32 iErrorx2;
  298. mng_pchar zErrortext;
  299. mng_memalloc fMemalloc; /* callback pointers */
  300. mng_memfree fMemfree; /* initially nulled */
  301. mng_releasedata fReleasedata;
  302. #ifndef MNG_NO_OPEN_CLOSE_STREAM
  303. mng_openstream fOpenstream;
  304. mng_closestream fClosestream;
  305. #endif
  306. mng_readdata fReaddata;
  307. mng_writedata fWritedata;
  308. mng_errorproc fErrorproc;
  309. mng_traceproc fTraceproc;
  310. mng_processheader fProcessheader;
  311. mng_processtext fProcesstext;
  312. mng_processsave fProcesssave;
  313. mng_processseek fProcessseek;
  314. mng_processneed fProcessneed;
  315. mng_processmend fProcessmend;
  316. mng_processunknown fProcessunknown;
  317. mng_processterm fProcessterm;
  318. mng_getcanvasline fGetcanvasline;
  319. mng_getbkgdline fGetbkgdline;
  320. mng_getalphaline fGetalphaline;
  321. mng_refresh fRefresh;
  322. mng_gettickcount fGettickcount;
  323. mng_settimer fSettimer;
  324. mng_processgamma fProcessgamma;
  325. mng_processchroma fProcesschroma;
  326. mng_processsrgb fProcesssrgb;
  327. mng_processiccp fProcessiccp;
  328. mng_processarow fProcessarow;
  329. #if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
  330. #ifndef MNG_NO_OLD_VERSIONS
  331. mng_bool bPreDraft48; /* flags ancient style draft */
  332. #endif
  333. mng_chunkid iChunkname; /* read/write-state variables */
  334. mng_uint32 iChunkseq;
  335. mng_chunkp pFirstchunk; /* double-linked list of */
  336. mng_chunkp pLastchunk; /* stored chunk-structures */
  337. mng_bool bHasheader; /* first header chunk processed */
  338. mng_bool bHasMHDR; /* inside a MHDR-MEND sequence */
  339. mng_bool bHasIHDR; /* inside a IHDR-IEND sequence */
  340. mng_bool bHasBASI; /* inside a BASI-IEND sequence */
  341. mng_bool bHasDHDR; /* inside a DHDR-IEND sequence */
  342. #ifdef MNG_INCLUDE_JNG
  343. mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */
  344. mng_bool bHasJSEP; /* passed the JSEP separator */
  345. mng_bool bHasJDAA; /* at least 1 JDAA processed */
  346. mng_bool bHasJDAT; /* at least 1 JDAT processed */
  347. #endif
  348. mng_bool bHasPLTE; /* PLTE chunk processed */
  349. mng_bool bHasTRNS; /* tRNS chunk processed */
  350. mng_bool bHasGAMA; /* gAMA chunk processed */
  351. mng_bool bHasCHRM; /* cHRM chunk processed */
  352. mng_bool bHasSRGB; /* sRGB chunk processed */
  353. mng_bool bHasICCP; /* iCCP chunk processed */
  354. mng_bool bHasBKGD; /* bKGD chunk processed */
  355. mng_bool bHasIDAT; /* at least 1 IDAT processed */
  356. mng_bool bHasSAVE; /* SAVE chunk processed */
  357. mng_bool bHasBACK; /* BACK chunk processed */
  358. mng_bool bHasFRAM; /* FRAM chunk processed */
  359. mng_bool bHasTERM; /* TERM chunk processed */
  360. mng_bool bHasLOOP; /* at least 1 LOOP open */
  361. mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
  362. mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
  363. mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
  364. mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
  365. mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
  366. mng_bool bHasglobalICCP; /* global iCCP chunk processed */
  367. mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
  368. mng_uint32 iDatawidth; /* IHDR/BASI/DHDR fields */
  369. mng_uint32 iDataheight; /* valid if inside IHDR-IEND, */
  370. mng_uint8 iBitdepth; /* BASI-IEND or DHDR-IEND */
  371. mng_uint8 iColortype;
  372. mng_uint8 iCompression;
  373. mng_uint8 iFilter;
  374. mng_uint8 iInterlace;
  375. mng_uint32 iPLTEcount; /* PLTE fields */
  376. #ifdef MNG_INCLUDE_JNG
  377. mng_uint8 iJHDRcolortype; /* JHDR fields */
  378. mng_uint8 iJHDRimgbitdepth; /* valid if inside JHDR-IEND */
  379. mng_uint8 iJHDRimgcompression;
  380. mng_uint8 iJHDRimginterlace;
  381. mng_uint8 iJHDRalphabitdepth;
  382. mng_uint8 iJHDRalphacompression;
  383. mng_uint8 iJHDRalphafilter;
  384. mng_uint8 iJHDRalphainterlace;
  385. #endif
  386. #endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
  387. #ifdef MNG_SUPPORT_READ
  388. mng_bool bReading; /* read processing variables */
  389. mng_bool bHavesig;
  390. mng_bool bEOF;
  391. mng_uint32 iReadbufsize;
  392. mng_uint8p pReadbuf;
  393. mng_uint32 iLargebufsize; /* temp for very large chunks */
  394. mng_uint8p pLargebuf;
  395. mng_uint32 iSuspendtime; /* tickcount at last suspension */
  396. mng_bool bSuspended; /* input-reading has been suspended;
  397. we're expecting a call to
  398. mng_read_resume! */
  399. mng_uint8 iSuspendpoint; /* indicates at which point the flow
  400. was broken to suspend input-reading */
  401. mng_bool bSuspensionmode; /* I/O-suspension variables */
  402. mng_uint32 iSuspendbufsize;
  403. mng_uint8p pSuspendbuf;
  404. mng_uint8p pSuspendbufnext;
  405. mng_uint32 iSuspendbufleft;
  406. mng_uint32 iChunklen; /* chunk length */
  407. mng_uint8p pReadbufnext; /* 32K+ suspension-processing */
  408. mng_uint8p pLargebufnext;
  409. mng_pushdatap pFirstpushchunk; /* variables for push mechanisms */
  410. mng_pushdatap pLastpushchunk;
  411. mng_pushdatap pFirstpushdata;
  412. mng_pushdatap pLastpushdata;
  413. #endif /* MNG_SUPPORT_READ */
  414. #ifdef MNG_SUPPORT_WRITE
  415. mng_bool bCreating; /* create/write processing variables */
  416. mng_bool bWriting;
  417. mng_chunkid iFirstchunkadded;
  418. mng_uint32 iWritebufsize;
  419. mng_uint8p pWritebuf;
  420. #endif
  421. #ifdef MNG_SUPPORT_DISPLAY
  422. mng_bool bDisplaying; /* display-state variables */
  423. mng_bool bFramedone;
  424. mng_uint32 iFrameseq;
  425. mng_uint32 iLayerseq;
  426. mng_uint32 iFrametime; /* millisecs */
  427. mng_uint32 iTotalframes; /* end-totals after mng_read() */
  428. mng_uint32 iTotallayers;
  429. mng_uint32 iTotalplaytime; /* millisecs */
  430. mng_bool bSkipping; /* LOOP iteration=0 */
  431. #ifdef MNG_SUPPORT_DYNAMICMNG
  432. mng_bool bDynamic; /* MNG is dynamic (eg. has events) */
  433. mng_bool bRunningevent; /* currently processing an event */
  434. mng_bool bStopafterseek; /* stop after next SEEK */
  435. mng_int32 iEventx; /* X/Y of current event */
  436. mng_int32 iEventy;
  437. mng_objectp pLastmousemove; /* last event triggered */
  438. #endif
  439. mng_uint32 iRequestframe; /* go_xxxx variables */
  440. mng_uint32 iRequestlayer;
  441. mng_uint32 iRequesttime;
  442. mng_bool bSearching;
  443. mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */
  444. mng_uint32 iRuntime; /* millisecs since start */
  445. mng_uint32 iSynctime; /* tickcount at last framesync */
  446. mng_uint32 iStarttime; /* tickcount at start */
  447. mng_uint32 iEndtime; /* tickcount at end */
  448. mng_bool bRunning; /* animation is active */
  449. mng_bool bTimerset; /* the timer has been set;
  450. we're expecting a call to
  451. mng_display_resume! */
  452. mng_uint8 iBreakpoint; /* indicates at which point the
  453. flow was broken to run the timer */
  454. mng_bool bSectionwait; /* indicates a section break */
  455. mng_bool bFreezing; /* indicates app requested a freeze */
  456. mng_bool bResetting; /* indicates app requested a reset */
  457. mng_bool bNeedrefresh; /* indicates screen-refresh is needed */
  458. mng_bool bMisplacedTERM; /* indicates TERM is out of place */
  459. mng_bool bOnlyfirstframe; /* show first frame after TERM and stop */
  460. mng_uint32 iFramesafterTERM; /* determines frame-count after TERM */
  461. mng_objectp pCurrentobj; /* current "object" */
  462. mng_objectp pCurraniobj; /* current animation object
  463. "to be"/"being" processed */
  464. mng_objectp pTermaniobj; /* TERM animation object */
  465. mng_uint32 iIterations; /* TERM/MEND iteration count */
  466. mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */
  467. mng_objectp pLastclone; /* last clone */
  468. mng_objectp pStoreobj; /* current store object for row routines */
  469. mng_objectp pStorebuf; /* current store object-buffer for row routines */
  470. mng_objectp pRetrieveobj; /* current retrieve object for row routines */
  471. mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */
  472. mng_uint32 iUpdateleft; /* update region for refresh */
  473. mng_uint32 iUpdateright;
  474. mng_uint32 iUpdatetop;
  475. mng_uint32 iUpdatebottom;
  476. mng_int8 iPass; /* current interlacing pass;
  477. negative value means no interlace */
  478. mng_int32 iRow; /* current row counter */
  479. mng_int32 iRowinc; /* row increment for this pass */
  480. mng_int32 iCol; /* current starting column */
  481. mng_int32 iColinc; /* column increment for this pass */
  482. mng_int32 iRowsamples; /* nr. of samples in current workrow */
  483. mng_int32 iSamplemul; /* needed to calculate rowsize */
  484. mng_int32 iSampleofs; /* from rowsamples */
  485. mng_int32 iSamplediv;
  486. mng_int32 iRowsize; /* size of actual data in work row */
  487. mng_int32 iRowmax; /* maximum size of data in work row */
  488. mng_int32 iFilterofs; /* offset to filter-byte in work row */
  489. mng_int32 iPixelofs; /* offset to pixel-bytes in work row */
  490. mng_uint32 iLevel0; /* leveling variables */
  491. mng_uint32 iLevel1;
  492. mng_uint32 iLevel2;
  493. mng_uint32 iLevel3;
  494. mng_uint8p pWorkrow; /* working row of pixel-data */
  495. mng_uint8p pPrevrow; /* previous row of pixel-data */
  496. mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */
  497. mng_bool bIsRGBA16; /* indicates intermediate row is RGBA16 */
  498. mng_bool bIsOpaque; /* indicates intermediate row is fully opaque */
  499. mng_int32 iFilterbpp; /* bpp index for filtering routines */
  500. mng_int32 iSourcel; /* variables for showing objects */
  501. mng_int32 iSourcer;
  502. mng_int32 iSourcet;
  503. mng_int32 iSourceb;
  504. mng_int32 iDestl;
  505. mng_int32 iDestr;
  506. mng_int32 iDestt;
  507. mng_int32 iDestb;
  508. mng_objectp pFirstimgobj; /* double-linked list of */
  509. mng_objectp pLastimgobj; /* image-object structures */
  510. mng_objectp pFirstaniobj; /* double-linked list of */
  511. mng_objectp pLastaniobj; /* animation-object structures */
  512. #ifdef MNG_SUPPORT_DYNAMICMNG
  513. mng_objectp pFirstevent; /* double-linked list of */
  514. mng_objectp pLastevent; /* event-object structures */
  515. #endif
  516. #if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS)
  517. mng_uint8 aGammatab[256]; /* precomputed gamma lookup table */
  518. mng_float dLastgamma; /* last gamma used to compute table */
  519. #endif
  520. mng_fptr fDisplayrow; /* internal callback to display an
  521. uncompressed/unfiltered/
  522. color-corrected row */
  523. mng_fptr fRestbkgdrow; /* internal callback for restore-
  524. background processing of a row */
  525. mng_fptr fCorrectrow; /* internal callback to color-correct an
  526. uncompressed/unfiltered row */
  527. mng_fptr fRetrieverow; /* internal callback to retrieve an
  528. uncompressed/unfiltered row of data */
  529. mng_fptr fStorerow; /* internal callback to store an
  530. uncompressed/unfiltered row of data */
  531. mng_fptr fProcessrow; /* internal callback to process an
  532. uncompressed row of data */
  533. mng_fptr fDifferrow; /* internal callback to perform
  534. added filter leveling and
  535. differing on an unfiltered row */
  536. mng_fptr fScalerow; /* internal callback to scale a
  537. delta-row to the bitdepth of its target */
  538. mng_fptr fDeltarow; /* internal callback to execute a
  539. delta-row onto a target */
  540. #ifndef MNG_SKIPCHUNK_PAST
  541. mng_fptr fFliprow; /* internal callback to flip a row of pixels
  542. left<->right for a PAST operation */
  543. mng_fptr fTilerow; /* internal callback to tile a row of pixels
  544. during a PAST operation */
  545. #endif
  546. mng_fptr fInitrowproc; /* internal callback to initialize
  547. the row processing */
  548. mng_uint16 iDEFIobjectid; /* DEFI fields */
  549. mng_bool bDEFIhasdonotshow;
  550. mng_uint8 iDEFIdonotshow;
  551. mng_bool bDEFIhasconcrete;
  552. mng_uint8 iDEFIconcrete;
  553. mng_bool bDEFIhasloca;
  554. mng_int32 iDEFIlocax;
  555. mng_int32 iDEFIlocay;
  556. mng_bool bDEFIhasclip;
  557. mng_int32 iDEFIclipl;
  558. mng_int32 iDEFIclipr;
  559. mng_int32 iDEFIclipt;
  560. mng_int32 iDEFIclipb;
  561. mng_uint16 iBACKred; /* BACK fields */
  562. mng_uint16 iBACKgreen;
  563. mng_uint16 iBACKblue;
  564. mng_uint8 iBACKmandatory;
  565. mng_uint16 iBACKimageid;
  566. mng_uint8 iBACKtile;
  567. mng_int32 iBackimgoffsx; /* temp variables for restore_bkgd */
  568. mng_int32 iBackimgoffsy;
  569. mng_uint32 iBackimgwidth;
  570. mng_uint32 iBackimgheight;
  571. #ifndef MNG_SKIPCHUNK_FRAM
  572. mng_uint8 iFRAMmode; /* FRAM fields (global) */
  573. mng_uint32 iFRAMdelay;
  574. mng_uint32 iFRAMtimeout;
  575. mng_bool bFRAMclipping;
  576. mng_int32 iFRAMclipl;
  577. mng_int32 iFRAMclipr;
  578. mng_int32 iFRAMclipt;
  579. mng_int32 iFRAMclipb;
  580. mng_uint8 iFramemode; /* current subframe variables */
  581. mng_uint32 iFramedelay;
  582. mng_uint32 iFrametimeout;
  583. mng_bool bFrameclipping;
  584. mng_int32 iFrameclipl;
  585. mng_int32 iFrameclipr;
  586. mng_int32 iFrameclipt;
  587. mng_int32 iFrameclipb;
  588. mng_uint32 iNextdelay; /* delay *after* next image */
  589. #endif
  590. #ifndef MNG_SKIPCHUNK_SHOW
  591. mng_uint8 iSHOWmode; /* SHOW fields */
  592. mng_uint16 iSHOWfromid;
  593. mng_uint16 iSHOWtoid;
  594. mng_uint16 iSHOWnextid;
  595. mng_int16 iSHOWskip;
  596. #endif
  597. mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
  598. mng_rgbpaltab aGlobalPLTEentries;
  599. mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
  600. mng_uint8arr aGlobalTRNSrawdata;
  601. mng_uint32 iGlobalGamma; /* global gAMA fields */
  602. #ifndef MNG_SKIPCHUNK_cHRM
  603. mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
  604. mng_uint32 iGlobalWhitepointy;
  605. mng_uint32 iGlobalPrimaryredx;
  606. mng_uint32 iGlobalPrimaryredy;
  607. mng_uint32 iGlobalPrimarygreenx;
  608. mng_uint32 iGlobalPrimarygreeny;
  609. mng_uint32 iGlobalPrimarybluex;
  610. mng_uint32 iGlobalPrimarybluey;
  611. #endif
  612. mng_uint8 iGlobalRendintent; /* global sRGB fields */
  613. #ifndef MNG_SKIPCHUNK_iCCP
  614. mng_uint32 iGlobalProfilesize; /* global iCCP fields */
  615. mng_ptr pGlobalProfile;
  616. #endif
  617. mng_uint16 iGlobalBKGDred; /* global bKGD fields */
  618. mng_uint16 iGlobalBKGDgreen;
  619. mng_uint16 iGlobalBKGDblue;
  620. mng_ptr pDeltaImage; /* delta-image fields */
  621. mng_uint8 iDeltaImagetype;
  622. #endif /* MNG_SUPPORT_DISPLAY */
  623. mng_uint8 iDeltatype; /* need this one in read processing !! */
  624. #ifdef MNG_SUPPORT_DISPLAY
  625. mng_uint32 iDeltaBlockwidth;
  626. mng_uint32 iDeltaBlockheight;
  627. mng_uint32 iDeltaBlockx;
  628. mng_uint32 iDeltaBlocky;
  629. mng_bool bDeltaimmediate;
  630. mng_fptr fDeltagetrow; /* internal delta-proc callbacks */
  631. mng_fptr fDeltaaddrow;
  632. mng_fptr fDeltareplacerow;
  633. mng_fptr fDeltaputrow;
  634. #ifndef MNG_SKIPCHUNK_PROM
  635. mng_fptr fPromoterow; /* internal PROM fields */
  636. mng_fptr fPromBitdepth;
  637. mng_ptr pPromBuf;
  638. mng_uint8 iPromColortype;
  639. mng_uint8 iPromBitdepth;
  640. mng_uint8 iPromFilltype;
  641. mng_uint32 iPromWidth;
  642. mng_ptr pPromSrc;
  643. mng_ptr pPromDst;
  644. #endif
  645. #ifndef MNG_SKIPCHUNK_MAGN
  646. mng_uint16 iMAGNfromid;
  647. mng_uint16 iMAGNcurrentid;
  648. mng_uint16 iMAGNtoid;
  649. #endif
  650. #ifndef MNG_SKIPCHUNK_PAST
  651. mng_uint16 iPASTid;
  652. mng_int32 iPastx; /* target x/y of last PAST */
  653. mng_int32 iPasty;
  654. #endif
  655. mng_objectp pLastseek; /* last processed ani_seek object */
  656. #ifdef MNG_INCLUDE_MPNG_PROPOSAL
  657. mng_objectp pMPNG; /* mpNG object if available */
  658. #endif
  659. #ifdef MNG_INCLUDE_ANG_PROPOSAL
  660. mng_objectp pANG; /* ANG object if available */
  661. #endif
  662. #endif /* MNG_SUPPORT_DISPLAY */
  663. #ifdef MNG_INCLUDE_ZLIB
  664. z_stream sZlib; /* zlib (de)compression variables */
  665. mng_int32 iZlevel; /* zlib compression parameters */
  666. mng_int32 iZmethod;
  667. mng_int32 iZwindowbits;
  668. mng_int32 iZmemlevel;
  669. mng_int32 iZstrategy;
  670. mng_uint32 iMaxIDAT; /* maximum size of IDAT data */
  671. mng_bool bInflating; /* indicates "inflate" in progress */
  672. mng_bool bDeflating; /* indicates "deflate" in progress */
  673. #endif /* MNG_INCLUDE_ZLIB */
  674. #ifdef MNG_INCLUDE_JNG
  675. mngjpeg_dctmethod eJPEGdctmethod; /* IJG compression variables */
  676. mng_int32 iJPEGquality;
  677. mng_int32 iJPEGsmoothing;
  678. mng_bool bJPEGcompressprogr;
  679. mng_bool bJPEGcompressopt;
  680. mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */
  681. mngjpeg_compp pJPEGcinfo; /* compression structure */
  682. mngjpeg_errorp pJPEGcerr; /* error-manager compress */
  683. mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */
  684. mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */
  685. mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */
  686. mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */
  687. mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */
  688. mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */
  689. mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */
  690. mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */
  691. mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */
  692. mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */
  693. mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */
  694. mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */
  695. mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */
  696. mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */
  697. mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */
  698. mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */
  699. mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */
  700. mng_uint32 iJPEGrowlen;
  701. mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */
  702. mng_uint32 iJPEGrowlen2;
  703. mng_bool bJPEGcompress; /* indicates "compress" initialized */
  704. mng_bool bJPEGdecompress; /* indicates "decompress" initialized (JDAT) */
  705. mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */
  706. mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */
  707. mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */
  708. mng_bool bJPEGscanending; /* indicates "finish_output" suspended (JDAT) */
  709. mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */
  710. mng_bool bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */
  711. mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */
  712. mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */
  713. mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */
  714. mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */
  715. mng_fptr fStorerow2; /* internal callback to store an
  716. uncompressed/unfiltered row of JPEG-data (JDAT) */
  717. mng_fptr fStorerow3; /* internal callback to store an
  718. uncompressed/unfiltered row of JPEG-data (JDAA) */
  719. mng_uint32 iJPEGrow; /* row-number for current JPEG row */
  720. mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */
  721. mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */
  722. mng_uint32 iJPEGdisprow; /* nr. of rows already displayed "on-the-fly" */
  723. #if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B)
  724. jmp_buf sErrorbuf; /* setjmp/longjmp buffer (error-recovery) */
  725. #endif
  726. #endif /* MNG_INCLUDE_JNG */
  727. #ifndef MNG_USE_ZLIB_CRC
  728. mng_uint32 aCRCtable [256]; /* CRC prefab table */
  729. mng_bool bCRCcomputed; /* "has been built" indicator */
  730. #endif
  731. #ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
  732. png_imgtype ePng_imgtype;
  733. #endif
  734. #if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT)
  735. mng_uint8 iPNGdepth; /* Real input depth */
  736. mng_uint8 iPNGmult;
  737. #endif
  738. #ifdef MNG_OPTIMIZE_DISPLAYCALLS
  739. mng_uint32 iRawlen; /* temp vars for display processing */
  740. mng_uint8p pRawdata;
  741. #ifndef MNG_SKIPCHUNK_BASI
  742. mng_uint16 iBASIred;
  743. mng_uint16 iBASIgreen;
  744. mng_uint16 iBASIblue;
  745. mng_bool bBASIhasalpha;
  746. mng_uint16 iBASIalpha;
  747. mng_uint8 iBASIviewable;
  748. #endif
  749. #ifndef MNG_SKIPCHUNK_CLON
  750. mng_uint16 iCLONsourceid;
  751. mng_uint16 iCLONcloneid;
  752. mng_uint8 iCLONclonetype;
  753. mng_bool bCLONhasdonotshow;
  754. mng_uint8 iCLONdonotshow;
  755. mng_uint8 iCLONconcrete;
  756. mng_bool bCLONhasloca;
  757. mng_uint8 iCLONlocationtype;
  758. mng_int32 iCLONlocationx;
  759. mng_int32 iCLONlocationy;
  760. #endif
  761. #ifndef MNG_SKIPCHUNK_DISC
  762. mng_uint32 iDISCcount;
  763. mng_uint16p pDISCids;
  764. #endif
  765. #ifndef MNG_SKIPCHUNK_FRAM
  766. mng_uint8 iTempFramemode;
  767. mng_uint8 iTempChangedelay;
  768. mng_uint32 iTempDelay;
  769. mng_uint8 iTempChangetimeout;
  770. mng_uint32 iTempTimeout;
  771. mng_uint8 iTempChangeclipping;
  772. mng_uint8 iTempCliptype;
  773. mng_int32 iTempClipl;
  774. mng_int32 iTempClipr;
  775. mng_int32 iTempClipt;
  776. mng_int32 iTempClipb;
  777. #endif
  778. #ifndef MNG_SKIPCHUNK_MOVE
  779. mng_uint16 iMOVEfromid;
  780. mng_uint16 iMOVEtoid;
  781. mng_uint8 iMOVEmovetype;
  782. mng_int32 iMOVEmovex;
  783. mng_int32 iMOVEmovey;
  784. #endif
  785. #ifndef MNG_SKIPCHUNK_CLIP
  786. mng_uint16 iCLIPfromid;
  787. mng_uint16 iCLIPtoid;
  788. mng_uint8 iCLIPcliptype;
  789. mng_int32 iCLIPclipl;
  790. mng_int32 iCLIPclipr;
  791. mng_int32 iCLIPclipt;
  792. mng_int32 iCLIPclipb;
  793. #endif
  794. #ifndef MNG_NO_DELTA_PNG
  795. mng_uint16 iDHDRobjectid;
  796. mng_uint8 iDHDRimagetype;
  797. mng_uint8 iDHDRdeltatype;
  798. mng_uint32 iDHDRblockwidth;
  799. mng_uint32 iDHDRblockheight;
  800. mng_uint32 iDHDRblockx;
  801. mng_uint32 iDHDRblocky;
  802. mng_uint8 iPROMbitdepth;
  803. mng_uint8 iPROMcolortype;
  804. mng_uint8 iPROMfilltype;
  805. mng_uint8 iPPLTtype;
  806. mng_uint32 iPPLTcount;
  807. mng_palette8ep paPPLTindexentries;
  808. mng_uint8p paPPLTalphaentries;
  809. mng_uint8p paPPLTusedentries;
  810. #endif
  811. #ifndef MNG_SKIPCHUNK_MAGN
  812. mng_uint16 iMAGNfirstid;
  813. mng_uint16 iMAGNlastid;
  814. mng_uint8 iMAGNmethodX;
  815. mng_uint16 iMAGNmX;
  816. mng_uint16 iMAGNmY;
  817. mng_uint16 iMAGNmL;
  818. mng_uint16 iMAGNmR;
  819. mng_uint16 iMAGNmT;
  820. mng_uint16 iMAGNmB;
  821. mng_uint8 iMAGNmethodY;
  822. #endif
  823. #ifndef MNG_SKIPCHUNK_PAST
  824. mng_uint16 iPASTtargetid;
  825. mng_uint8 iPASTtargettype;
  826. mng_int32 iPASTtargetx;
  827. mng_int32 iPASTtargety;
  828. mng_uint32 iPASTcount;
  829. mng_ptr pPASTsources;
  830. #endif
  831. #endif /* MNG_OPTIMIZE_DISPLAYCALLS */
  832. } mng_data;
  833. typedef mng_data * mng_datap;
  834. /* ************************************************************************** */
  835. /* * * */
  836. /* * Internal Callback-Function prototypes * */
  837. /* * * */
  838. /* ************************************************************************** */
  839. typedef mng_retcode(*mng_displayrow) (mng_datap pData);
  840. typedef mng_retcode(*mng_restbkgdrow) (mng_datap pData);
  841. typedef mng_retcode(*mng_correctrow) (mng_datap pData);
  842. typedef mng_retcode(*mng_retrieverow) (mng_datap pData);
  843. typedef mng_retcode(*mng_storerow) (mng_datap pData);
  844. typedef mng_retcode(*mng_processrow) (mng_datap pData);
  845. typedef mng_retcode(*mng_initrowproc) (mng_datap pData);
  846. typedef mng_retcode(*mng_differrow) (mng_datap pData);
  847. typedef mng_retcode(*mng_scalerow) (mng_datap pData);
  848. typedef mng_retcode(*mng_deltarow) (mng_datap pData);
  849. typedef mng_retcode(*mng_promoterow) (mng_datap pData);
  850. typedef mng_retcode(*mng_fliprow) (mng_datap pData);
  851. typedef mng_retcode(*mng_tilerow) (mng_datap pData);
  852. typedef mng_uint8 (*mng_bitdepth_8) (mng_uint8 iB);
  853. typedef mng_uint16 (*mng_bitdepth_16) (mng_uint8 iB);
  854. typedef mng_retcode(*mng_magnify_x) (mng_datap pData,
  855. mng_uint16 iMX,
  856. mng_uint16 iML,
  857. mng_uint16 iMR,
  858. mng_uint32 iWidth,
  859. mng_uint8p iSrcline,
  860. mng_uint8p iDstline);
  861. typedef mng_retcode(*mng_magnify_y) (mng_datap pData,
  862. mng_int32 iM,
  863. mng_int32 iS,
  864. mng_uint32 iWidth,
  865. mng_uint8p iSrcline1,
  866. mng_uint8p iSrcline2,
  867. mng_uint8p iDstline);
  868. /* ************************************************************************** */
  869. /* * * */
  870. /* * Routines for swapping byte-order from and to graphic files * */
  871. /* * (This code is adapted from the libpng package) * */
  872. /* * * */
  873. /* ************************************************************************** */
  874. #ifndef MNG_BIGENDIAN_SUPPORTED
  875. mng_uint32 mng_get_uint32 (mng_uint8p pBuf);
  876. mng_int32 mng_get_int32 (mng_uint8p pBuf);
  877. mng_uint16 mng_get_uint16 (mng_uint8p pBuf);
  878. void mng_put_uint32 (mng_uint8p pBuf,
  879. mng_uint32 i);
  880. void mng_put_int32 (mng_uint8p pBuf,
  881. mng_int32 i);
  882. void mng_put_uint16 (mng_uint8p pBuf,
  883. mng_uint16 i);
  884. #else /* MNG_BIGENDIAN_SUPPORTED */
  885. #define mng_get_uint32(P) *(mng_uint32p)(P)
  886. #define mng_get_int32(P) *(mng_int32p)(P)
  887. #define mng_get_uint16(P) *(mng_uint16p)(P)
  888. #define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I)
  889. #define mng_put_int32(P,I) *(mng_int32p)(P) = (I)
  890. #define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I)
  891. #endif /* MNG_BIGENDIAN_SUPPORTED */
  892. /* ************************************************************************** */
  893. /* * * */
  894. /* * Some handy(?) macro definitions * */
  895. /* * * */
  896. /* ************************************************************************** */
  897. #define MAX_COORD(a, b) (((a) > (b)) ? (a) : (b))
  898. #define MIN_COORD(a, b) (((a) < (b)) ? (a) : (b))
  899. /* ************************************************************************** */
  900. #endif /* _libmng_data_h_ */
  901. /* ************************************************************************** */
  902. /* * end of file * */
  903. /* ************************************************************************** */