0
|
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 |
|
|
158 |
#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
|
159 |
#pragma option -A /* force ANSI-C */
|
|
160 |
#endif
|
|
161 |
|
|
162 |
#ifndef _libmng_data_h_
|
|
163 |
#define _libmng_data_h_
|
|
164 |
|
|
165 |
/* ************************************************************************** */
|
|
166 |
|
|
167 |
#define MNG_MAGIC 0x52530a0aL
|
|
168 |
|
|
169 |
/* ************************************************************************** */
|
|
170 |
/* * * */
|
|
171 |
/* * Internal structures * */
|
|
172 |
/* * * */
|
|
173 |
/* ************************************************************************** */
|
|
174 |
|
|
175 |
typedef mng_palette8 mng_rgbpaltab;
|
|
176 |
|
|
177 |
/* ************************************************************************** */
|
|
178 |
/* * * */
|
|
179 |
/* * The saved_data structure * */
|
|
180 |
/* * * */
|
|
181 |
/* * This contains the saved data after a SAVE chunk has been processed. * */
|
|
182 |
/* * The data is saved from the main data structure during SAVE processing, * */
|
|
183 |
/* * and restored to the main data structure during SEEK processing. * */
|
|
184 |
/* * * */
|
|
185 |
/* ************************************************************************** */
|
|
186 |
|
|
187 |
typedef struct mng_savedata_struct {
|
|
188 |
|
|
189 |
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
|
190 |
mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
|
|
191 |
mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
|
|
192 |
mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
|
|
193 |
mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
|
|
194 |
mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
|
|
195 |
mng_bool bHasglobalICCP; /* global iCCP chunk processed */
|
|
196 |
mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
|
|
197 |
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
|
198 |
|
|
199 |
#ifdef MNG_SUPPORT_DISPLAY
|
|
200 |
mng_uint16 iBACKred; /* BACK fields */
|
|
201 |
mng_uint16 iBACKgreen;
|
|
202 |
mng_uint16 iBACKblue;
|
|
203 |
mng_uint8 iBACKmandatory;
|
|
204 |
mng_uint16 iBACKimageid;
|
|
205 |
mng_uint8 iBACKtile;
|
|
206 |
|
|
207 |
mng_uint8 iFRAMmode; /* FRAM fields (global) */
|
|
208 |
mng_uint32 iFRAMdelay;
|
|
209 |
mng_uint32 iFRAMtimeout;
|
|
210 |
mng_bool bFRAMclipping;
|
|
211 |
mng_int32 iFRAMclipl;
|
|
212 |
mng_int32 iFRAMclipr;
|
|
213 |
mng_int32 iFRAMclipt;
|
|
214 |
mng_int32 iFRAMclipb;
|
|
215 |
|
|
216 |
mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
|
|
217 |
mng_rgbpaltab aGlobalPLTEentries;
|
|
218 |
|
|
219 |
mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
|
|
220 |
mng_uint8arr aGlobalTRNSrawdata;
|
|
221 |
|
|
222 |
mng_uint32 iGlobalGamma; /* global gAMA fields */
|
|
223 |
|
|
224 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
225 |
mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
|
|
226 |
mng_uint32 iGlobalWhitepointy;
|
|
227 |
mng_uint32 iGlobalPrimaryredx;
|
|
228 |
mng_uint32 iGlobalPrimaryredy;
|
|
229 |
mng_uint32 iGlobalPrimarygreenx;
|
|
230 |
mng_uint32 iGlobalPrimarygreeny;
|
|
231 |
mng_uint32 iGlobalPrimarybluex;
|
|
232 |
mng_uint32 iGlobalPrimarybluey;
|
|
233 |
#endif
|
|
234 |
|
|
235 |
mng_uint8 iGlobalRendintent; /* global sRGB fields */
|
|
236 |
|
|
237 |
mng_uint32 iGlobalProfilesize; /* global iCCP fields */
|
|
238 |
mng_ptr pGlobalProfile;
|
|
239 |
|
|
240 |
mng_uint16 iGlobalBKGDred; /* global bKGD fields */
|
|
241 |
mng_uint16 iGlobalBKGDgreen;
|
|
242 |
mng_uint16 iGlobalBKGDblue;
|
|
243 |
#endif /* MNG_SUPPORT_DISPLAY */
|
|
244 |
|
|
245 |
} mng_savedata;
|
|
246 |
|
|
247 |
typedef mng_savedata * mng_savedatap;
|
|
248 |
|
|
249 |
/* ************************************************************************** */
|
|
250 |
/* * * */
|
|
251 |
/* * Internal buffer structure for data push mechanisms * */
|
|
252 |
/* * * */
|
|
253 |
/* ************************************************************************** */
|
|
254 |
|
|
255 |
typedef struct {
|
|
256 |
mng_ptr pNext; /* for linked list */
|
|
257 |
mng_ptr pData; /* used for chunks & data */
|
|
258 |
mng_uint32 iLength;
|
|
259 |
mng_bool bOwned;
|
|
260 |
mng_uint8p pDatanext; /* only used for data */
|
|
261 |
mng_uint32 iRemaining;
|
|
262 |
} mng_pushdata;
|
|
263 |
typedef mng_pushdata * mng_pushdatap;
|
|
264 |
|
|
265 |
/* ************************************************************************** */
|
|
266 |
/* * * */
|
|
267 |
/* * The main libmng data structure * */
|
|
268 |
/* * * */
|
|
269 |
/* * The handle used in all functions points to this structure which * */
|
|
270 |
/* * contains all volatile data necessary to process the network graphic. * */
|
|
271 |
/* * * */
|
|
272 |
/* ************************************************************************** */
|
|
273 |
|
|
274 |
typedef struct mng_data_struct {
|
|
275 |
|
|
276 |
mng_uint32 iMagic; /* magic number to validate
|
|
277 |
a given handle */
|
|
278 |
mng_ptr pUserdata; /* application workdata */
|
|
279 |
|
|
280 |
mng_imgtype eSigtype; /* image information */
|
|
281 |
mng_imgtype eImagetype; /* initially zeroed */
|
|
282 |
mng_uint32 iWidth; /* filled after header is processed */
|
|
283 |
mng_uint32 iHeight;
|
|
284 |
mng_uint32 iTicks; /* these only after MHDR */
|
|
285 |
mng_uint32 iLayercount;
|
|
286 |
mng_uint32 iFramecount;
|
|
287 |
mng_uint32 iPlaytime;
|
|
288 |
mng_uint32 iSimplicity;
|
|
289 |
mng_uint8 iAlphadepth; /* indicates expected alpha-depth */
|
|
290 |
|
|
291 |
mng_uint32 iImagelevel; /* level of image inside a stream */
|
|
292 |
|
|
293 |
mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */
|
|
294 |
mng_uint32 iBkgdstyle; /* layout of the background-canvas */
|
|
295 |
|
|
296 |
mng_int8 iMagnify; /* magnification factor (not used yet) */
|
|
297 |
mng_uint32 iOffsetx; /* x-offset for extremely large image */
|
|
298 |
mng_uint32 iOffsety; /* y-offset for extremely large image */
|
|
299 |
mng_uint32 iCanvaswidth; /* real canvas size */
|
|
300 |
mng_uint32 iCanvasheight; /* must be set by processheader callback */
|
|
301 |
|
|
302 |
mng_uint16 iBGred; /* default background color */
|
|
303 |
mng_uint16 iBGgreen; /* initially "black" */
|
|
304 |
mng_uint16 iBGblue;
|
|
305 |
mng_bool bUseBKGD; /* preferred use of bKGD for PNG */
|
|
306 |
|
|
307 |
mng_bool bIssRGB; /* indicates sRGB system */
|
|
308 |
|
|
309 |
#ifdef MNG_FULL_CMS /* little CMS variables */
|
|
310 |
mng_cmsprof hProf1; /* image input profile */
|
|
311 |
mng_cmsprof hProf2; /* default output profile */
|
|
312 |
mng_cmsprof hProf3; /* default sRGB profile */
|
|
313 |
mng_cmstrans hTrans; /* current transformation handle */
|
|
314 |
#endif
|
|
315 |
|
|
316 |
mng_float dViewgamma; /* gamma calculation variables */
|
|
317 |
mng_float dDisplaygamma; /* initially set for sRGB conditions */
|
|
318 |
mng_float dDfltimggamma;
|
|
319 |
|
|
320 |
mng_bool bStorechunks; /* switch for storing chunkdata */
|
|
321 |
mng_bool bSectionbreaks; /* indicate NEEDSECTIONWAIT breaks */
|
|
322 |
mng_bool bCacheplayback; /* switch to cache playback info */
|
|
323 |
mng_bool bDoProgressive; /* progressive refresh for large images */
|
|
324 |
mng_uint32 iCrcmode; /* CRC existence & checking flags */
|
|
325 |
|
|
326 |
mng_speedtype iSpeed; /* speed-modifier for animations */
|
|
327 |
|
|
328 |
mng_uint32 iMaxwidth; /* maximum canvas size */
|
|
329 |
mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */
|
|
330 |
|
|
331 |
mng_int32 iErrorcode; /* error reporting fields */
|
|
332 |
mng_int8 iSeverity;
|
|
333 |
mng_int32 iErrorx1;
|
|
334 |
mng_int32 iErrorx2;
|
|
335 |
mng_pchar zErrortext;
|
|
336 |
|
|
337 |
mng_memalloc fMemalloc; /* callback pointers */
|
|
338 |
mng_memfree fMemfree; /* initially nulled */
|
|
339 |
mng_releasedata fReleasedata;
|
|
340 |
#ifndef MNG_NO_OPEN_CLOSE_STREAM
|
|
341 |
mng_openstream fOpenstream;
|
|
342 |
mng_closestream fClosestream;
|
|
343 |
#endif
|
|
344 |
mng_readdata fReaddata;
|
|
345 |
mng_writedata fWritedata;
|
|
346 |
mng_errorproc fErrorproc;
|
|
347 |
mng_traceproc fTraceproc;
|
|
348 |
mng_processheader fProcessheader;
|
|
349 |
mng_processtext fProcesstext;
|
|
350 |
mng_processsave fProcesssave;
|
|
351 |
mng_processseek fProcessseek;
|
|
352 |
mng_processneed fProcessneed;
|
|
353 |
mng_processmend fProcessmend;
|
|
354 |
mng_processunknown fProcessunknown;
|
|
355 |
mng_processterm fProcessterm;
|
|
356 |
mng_getcanvasline fGetcanvasline;
|
|
357 |
mng_getbkgdline fGetbkgdline;
|
|
358 |
mng_getalphaline fGetalphaline;
|
|
359 |
mng_refresh fRefresh;
|
|
360 |
mng_gettickcount fGettickcount;
|
|
361 |
mng_settimer fSettimer;
|
|
362 |
mng_processgamma fProcessgamma;
|
|
363 |
mng_processchroma fProcesschroma;
|
|
364 |
mng_processsrgb fProcesssrgb;
|
|
365 |
mng_processiccp fProcessiccp;
|
|
366 |
mng_processarow fProcessarow;
|
|
367 |
|
|
368 |
#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
|
|
369 |
#ifndef MNG_NO_OLD_VERSIONS
|
|
370 |
mng_bool bPreDraft48; /* flags ancient style draft */
|
|
371 |
#endif
|
|
372 |
|
|
373 |
mng_chunkid iChunkname; /* read/write-state variables */
|
|
374 |
mng_uint32 iChunkseq;
|
|
375 |
mng_chunkp pFirstchunk; /* double-linked list of */
|
|
376 |
mng_chunkp pLastchunk; /* stored chunk-structures */
|
|
377 |
|
|
378 |
mng_bool bHasheader; /* first header chunk processed */
|
|
379 |
mng_bool bHasMHDR; /* inside a MHDR-MEND sequence */
|
|
380 |
mng_bool bHasIHDR; /* inside a IHDR-IEND sequence */
|
|
381 |
mng_bool bHasBASI; /* inside a BASI-IEND sequence */
|
|
382 |
mng_bool bHasDHDR; /* inside a DHDR-IEND sequence */
|
|
383 |
#ifdef MNG_INCLUDE_JNG
|
|
384 |
mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */
|
|
385 |
mng_bool bHasJSEP; /* passed the JSEP separator */
|
|
386 |
mng_bool bHasJDAA; /* at least 1 JDAA processed */
|
|
387 |
mng_bool bHasJDAT; /* at least 1 JDAT processed */
|
|
388 |
#endif
|
|
389 |
mng_bool bHasPLTE; /* PLTE chunk processed */
|
|
390 |
mng_bool bHasTRNS; /* tRNS chunk processed */
|
|
391 |
mng_bool bHasGAMA; /* gAMA chunk processed */
|
|
392 |
mng_bool bHasCHRM; /* cHRM chunk processed */
|
|
393 |
mng_bool bHasSRGB; /* sRGB chunk processed */
|
|
394 |
mng_bool bHasICCP; /* iCCP chunk processed */
|
|
395 |
mng_bool bHasBKGD; /* bKGD chunk processed */
|
|
396 |
mng_bool bHasIDAT; /* at least 1 IDAT processed */
|
|
397 |
|
|
398 |
mng_bool bHasSAVE; /* SAVE chunk processed */
|
|
399 |
mng_bool bHasBACK; /* BACK chunk processed */
|
|
400 |
mng_bool bHasFRAM; /* FRAM chunk processed */
|
|
401 |
mng_bool bHasTERM; /* TERM chunk processed */
|
|
402 |
mng_bool bHasLOOP; /* at least 1 LOOP open */
|
|
403 |
|
|
404 |
mng_bool bHasglobalPLTE; /* global PLTE chunk processed */
|
|
405 |
mng_bool bHasglobalTRNS; /* global tRNS chunk processed */
|
|
406 |
mng_bool bHasglobalGAMA; /* global gAMA chunk processed */
|
|
407 |
mng_bool bHasglobalCHRM; /* global cHRM chunk processed */
|
|
408 |
mng_bool bHasglobalSRGB; /* global sRGB chunk processed */
|
|
409 |
mng_bool bHasglobalICCP; /* global iCCP chunk processed */
|
|
410 |
mng_bool bHasglobalBKGD; /* global bKGD chunk processed */
|
|
411 |
|
|
412 |
mng_uint32 iDatawidth; /* IHDR/BASI/DHDR fields */
|
|
413 |
mng_uint32 iDataheight; /* valid if inside IHDR-IEND, */
|
|
414 |
mng_uint8 iBitdepth; /* BASI-IEND or DHDR-IEND */
|
|
415 |
mng_uint8 iColortype;
|
|
416 |
mng_uint8 iCompression;
|
|
417 |
mng_uint8 iFilter;
|
|
418 |
mng_uint8 iInterlace;
|
|
419 |
|
|
420 |
mng_uint32 iPLTEcount; /* PLTE fields */
|
|
421 |
|
|
422 |
#ifdef MNG_INCLUDE_JNG
|
|
423 |
mng_uint8 iJHDRcolortype; /* JHDR fields */
|
|
424 |
mng_uint8 iJHDRimgbitdepth; /* valid if inside JHDR-IEND */
|
|
425 |
mng_uint8 iJHDRimgcompression;
|
|
426 |
mng_uint8 iJHDRimginterlace;
|
|
427 |
mng_uint8 iJHDRalphabitdepth;
|
|
428 |
mng_uint8 iJHDRalphacompression;
|
|
429 |
mng_uint8 iJHDRalphafilter;
|
|
430 |
mng_uint8 iJHDRalphainterlace;
|
|
431 |
#endif
|
|
432 |
|
|
433 |
#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */
|
|
434 |
|
|
435 |
#ifdef MNG_SUPPORT_READ
|
|
436 |
mng_bool bReading; /* read processing variables */
|
|
437 |
mng_bool bHavesig;
|
|
438 |
mng_bool bEOF;
|
|
439 |
mng_uint32 iReadbufsize;
|
|
440 |
mng_uint8p pReadbuf;
|
|
441 |
|
|
442 |
mng_uint32 iLargebufsize; /* temp for very large chunks */
|
|
443 |
mng_uint8p pLargebuf;
|
|
444 |
|
|
445 |
mng_uint32 iSuspendtime; /* tickcount at last suspension */
|
|
446 |
mng_bool bSuspended; /* input-reading has been suspended;
|
|
447 |
we're expecting a call to
|
|
448 |
mng_read_resume! */
|
|
449 |
mng_uint8 iSuspendpoint; /* indicates at which point the flow
|
|
450 |
was broken to suspend input-reading */
|
|
451 |
|
|
452 |
mng_bool bSuspensionmode; /* I/O-suspension variables */
|
|
453 |
mng_uint32 iSuspendbufsize;
|
|
454 |
mng_uint8p pSuspendbuf;
|
|
455 |
mng_uint8p pSuspendbufnext;
|
|
456 |
mng_uint32 iSuspendbufleft;
|
|
457 |
mng_uint32 iChunklen; /* chunk length */
|
|
458 |
mng_uint8p pReadbufnext; /* 32K+ suspension-processing */
|
|
459 |
mng_uint8p pLargebufnext;
|
|
460 |
|
|
461 |
mng_pushdatap pFirstpushchunk; /* variables for push mechanisms */
|
|
462 |
mng_pushdatap pLastpushchunk;
|
|
463 |
mng_pushdatap pFirstpushdata;
|
|
464 |
mng_pushdatap pLastpushdata;
|
|
465 |
#endif /* MNG_SUPPORT_READ */
|
|
466 |
|
|
467 |
#ifdef MNG_SUPPORT_WRITE
|
|
468 |
mng_bool bCreating; /* create/write processing variables */
|
|
469 |
mng_bool bWriting;
|
|
470 |
mng_chunkid iFirstchunkadded;
|
|
471 |
mng_uint32 iWritebufsize;
|
|
472 |
mng_uint8p pWritebuf;
|
|
473 |
#endif
|
|
474 |
|
|
475 |
#ifdef MNG_SUPPORT_DISPLAY
|
|
476 |
mng_bool bDisplaying; /* display-state variables */
|
|
477 |
mng_bool bFramedone;
|
|
478 |
mng_uint32 iFrameseq;
|
|
479 |
mng_uint32 iLayerseq;
|
|
480 |
mng_uint32 iFrametime; /* millisecs */
|
|
481 |
|
|
482 |
mng_uint32 iTotalframes; /* end-totals after mng_read() */
|
|
483 |
mng_uint32 iTotallayers;
|
|
484 |
mng_uint32 iTotalplaytime; /* millisecs */
|
|
485 |
|
|
486 |
mng_bool bSkipping; /* LOOP iteration=0 */
|
|
487 |
|
|
488 |
#ifdef MNG_SUPPORT_DYNAMICMNG
|
|
489 |
mng_bool bDynamic; /* MNG is dynamic (eg. has events) */
|
|
490 |
mng_bool bRunningevent; /* currently processing an event */
|
|
491 |
mng_bool bStopafterseek; /* stop after next SEEK */
|
|
492 |
mng_int32 iEventx; /* X/Y of current event */
|
|
493 |
mng_int32 iEventy;
|
|
494 |
mng_objectp pLastmousemove; /* last event triggered */
|
|
495 |
#endif
|
|
496 |
|
|
497 |
mng_uint32 iRequestframe; /* go_xxxx variables */
|
|
498 |
mng_uint32 iRequestlayer;
|
|
499 |
mng_uint32 iRequesttime;
|
|
500 |
mng_bool bSearching;
|
|
501 |
|
|
502 |
mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */
|
|
503 |
|
|
504 |
mng_uint32 iRuntime; /* millisecs since start */
|
|
505 |
mng_uint32 iSynctime; /* tickcount at last framesync */
|
|
506 |
mng_uint32 iStarttime; /* tickcount at start */
|
|
507 |
mng_uint32 iEndtime; /* tickcount at end */
|
|
508 |
mng_bool bRunning; /* animation is active */
|
|
509 |
mng_bool bTimerset; /* the timer has been set;
|
|
510 |
we're expecting a call to
|
|
511 |
mng_display_resume! */
|
|
512 |
mng_uint8 iBreakpoint; /* indicates at which point the
|
|
513 |
flow was broken to run the timer */
|
|
514 |
mng_bool bSectionwait; /* indicates a section break */
|
|
515 |
mng_bool bFreezing; /* indicates app requested a freeze */
|
|
516 |
mng_bool bResetting; /* indicates app requested a reset */
|
|
517 |
mng_bool bNeedrefresh; /* indicates screen-refresh is needed */
|
|
518 |
mng_bool bMisplacedTERM; /* indicates TERM is out of place */
|
|
519 |
mng_bool bOnlyfirstframe; /* show first frame after TERM and stop */
|
|
520 |
mng_uint32 iFramesafterTERM; /* determines frame-count after TERM */
|
|
521 |
mng_objectp pCurrentobj; /* current "object" */
|
|
522 |
mng_objectp pCurraniobj; /* current animation object
|
|
523 |
"to be"/"being" processed */
|
|
524 |
mng_objectp pTermaniobj; /* TERM animation object */
|
|
525 |
mng_uint32 iIterations; /* TERM/MEND iteration count */
|
|
526 |
mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */
|
|
527 |
mng_objectp pLastclone; /* last clone */
|
|
528 |
mng_objectp pStoreobj; /* current store object for row routines */
|
|
529 |
mng_objectp pStorebuf; /* current store object-buffer for row routines */
|
|
530 |
mng_objectp pRetrieveobj; /* current retrieve object for row routines */
|
|
531 |
mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */
|
|
532 |
|
|
533 |
mng_uint32 iUpdateleft; /* update region for refresh */
|
|
534 |
mng_uint32 iUpdateright;
|
|
535 |
mng_uint32 iUpdatetop;
|
|
536 |
mng_uint32 iUpdatebottom;
|
|
537 |
|
|
538 |
mng_int8 iPass; /* current interlacing pass;
|
|
539 |
negative value means no interlace */
|
|
540 |
mng_int32 iRow; /* current row counter */
|
|
541 |
mng_int32 iRowinc; /* row increment for this pass */
|
|
542 |
mng_int32 iCol; /* current starting column */
|
|
543 |
mng_int32 iColinc; /* column increment for this pass */
|
|
544 |
mng_int32 iRowsamples; /* nr. of samples in current workrow */
|
|
545 |
mng_int32 iSamplemul; /* needed to calculate rowsize */
|
|
546 |
mng_int32 iSampleofs; /* from rowsamples */
|
|
547 |
mng_int32 iSamplediv;
|
|
548 |
mng_int32 iRowsize; /* size of actual data in work row */
|
|
549 |
mng_int32 iRowmax; /* maximum size of data in work row */
|
|
550 |
mng_int32 iFilterofs; /* offset to filter-byte in work row */
|
|
551 |
mng_int32 iPixelofs; /* offset to pixel-bytes in work row */
|
|
552 |
mng_uint32 iLevel0; /* leveling variables */
|
|
553 |
mng_uint32 iLevel1;
|
|
554 |
mng_uint32 iLevel2;
|
|
555 |
mng_uint32 iLevel3;
|
|
556 |
mng_uint8p pWorkrow; /* working row of pixel-data */
|
|
557 |
mng_uint8p pPrevrow; /* previous row of pixel-data */
|
|
558 |
mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */
|
|
559 |
mng_bool bIsRGBA16; /* indicates intermediate row is RGBA16 */
|
|
560 |
mng_bool bIsOpaque; /* indicates intermediate row is fully opaque */
|
|
561 |
mng_int32 iFilterbpp; /* bpp index for filtering routines */
|
|
562 |
|
|
563 |
mng_int32 iSourcel; /* variables for showing objects */
|
|
564 |
mng_int32 iSourcer;
|
|
565 |
mng_int32 iSourcet;
|
|
566 |
mng_int32 iSourceb;
|
|
567 |
mng_int32 iDestl;
|
|
568 |
mng_int32 iDestr;
|
|
569 |
mng_int32 iDestt;
|
|
570 |
mng_int32 iDestb;
|
|
571 |
|
|
572 |
mng_objectp pFirstimgobj; /* double-linked list of */
|
|
573 |
mng_objectp pLastimgobj; /* image-object structures */
|
|
574 |
mng_objectp pFirstaniobj; /* double-linked list of */
|
|
575 |
mng_objectp pLastaniobj; /* animation-object structures */
|
|
576 |
#ifdef MNG_SUPPORT_DYNAMICMNG
|
|
577 |
mng_objectp pFirstevent; /* double-linked list of */
|
|
578 |
mng_objectp pLastevent; /* event-object structures */
|
|
579 |
#endif
|
|
580 |
|
|
581 |
#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS)
|
|
582 |
mng_uint8 aGammatab[256]; /* precomputed gamma lookup table */
|
|
583 |
mng_float dLastgamma; /* last gamma used to compute table */
|
|
584 |
#endif
|
|
585 |
|
|
586 |
mng_fptr fDisplayrow; /* internal callback to display an
|
|
587 |
uncompressed/unfiltered/
|
|
588 |
color-corrected row */
|
|
589 |
mng_fptr fRestbkgdrow; /* internal callback for restore-
|
|
590 |
background processing of a row */
|
|
591 |
mng_fptr fCorrectrow; /* internal callback to color-correct an
|
|
592 |
uncompressed/unfiltered row */
|
|
593 |
mng_fptr fRetrieverow; /* internal callback to retrieve an
|
|
594 |
uncompressed/unfiltered row of data */
|
|
595 |
mng_fptr fStorerow; /* internal callback to store an
|
|
596 |
uncompressed/unfiltered row of data */
|
|
597 |
mng_fptr fProcessrow; /* internal callback to process an
|
|
598 |
uncompressed row of data */
|
|
599 |
mng_fptr fDifferrow; /* internal callback to perform
|
|
600 |
added filter leveling and
|
|
601 |
differing on an unfiltered row */
|
|
602 |
mng_fptr fScalerow; /* internal callback to scale a
|
|
603 |
delta-row to the bitdepth of its target */
|
|
604 |
mng_fptr fDeltarow; /* internal callback to execute a
|
|
605 |
delta-row onto a target */
|
|
606 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
607 |
mng_fptr fFliprow; /* internal callback to flip a row of pixels
|
|
608 |
left<->right for a PAST operation */
|
|
609 |
mng_fptr fTilerow; /* internal callback to tile a row of pixels
|
|
610 |
during a PAST operation */
|
|
611 |
#endif
|
|
612 |
mng_fptr fInitrowproc; /* internal callback to initialize
|
|
613 |
the row processing */
|
|
614 |
|
|
615 |
mng_uint16 iDEFIobjectid; /* DEFI fields */
|
|
616 |
mng_bool bDEFIhasdonotshow;
|
|
617 |
mng_uint8 iDEFIdonotshow;
|
|
618 |
mng_bool bDEFIhasconcrete;
|
|
619 |
mng_uint8 iDEFIconcrete;
|
|
620 |
mng_bool bDEFIhasloca;
|
|
621 |
mng_int32 iDEFIlocax;
|
|
622 |
mng_int32 iDEFIlocay;
|
|
623 |
mng_bool bDEFIhasclip;
|
|
624 |
mng_int32 iDEFIclipl;
|
|
625 |
mng_int32 iDEFIclipr;
|
|
626 |
mng_int32 iDEFIclipt;
|
|
627 |
mng_int32 iDEFIclipb;
|
|
628 |
|
|
629 |
mng_uint16 iBACKred; /* BACK fields */
|
|
630 |
mng_uint16 iBACKgreen;
|
|
631 |
mng_uint16 iBACKblue;
|
|
632 |
mng_uint8 iBACKmandatory;
|
|
633 |
mng_uint16 iBACKimageid;
|
|
634 |
mng_uint8 iBACKtile;
|
|
635 |
|
|
636 |
mng_int32 iBackimgoffsx; /* temp variables for restore_bkgd */
|
|
637 |
mng_int32 iBackimgoffsy;
|
|
638 |
mng_uint32 iBackimgwidth;
|
|
639 |
mng_uint32 iBackimgheight;
|
|
640 |
|
|
641 |
#ifndef MNG_SKIPCHUNK_FRAM
|
|
642 |
mng_uint8 iFRAMmode; /* FRAM fields (global) */
|
|
643 |
mng_uint32 iFRAMdelay;
|
|
644 |
mng_uint32 iFRAMtimeout;
|
|
645 |
mng_bool bFRAMclipping;
|
|
646 |
mng_int32 iFRAMclipl;
|
|
647 |
mng_int32 iFRAMclipr;
|
|
648 |
mng_int32 iFRAMclipt;
|
|
649 |
mng_int32 iFRAMclipb;
|
|
650 |
|
|
651 |
mng_uint8 iFramemode; /* current subframe variables */
|
|
652 |
mng_uint32 iFramedelay;
|
|
653 |
mng_uint32 iFrametimeout;
|
|
654 |
mng_bool bFrameclipping;
|
|
655 |
mng_int32 iFrameclipl;
|
|
656 |
mng_int32 iFrameclipr;
|
|
657 |
mng_int32 iFrameclipt;
|
|
658 |
mng_int32 iFrameclipb;
|
|
659 |
|
|
660 |
mng_uint32 iNextdelay; /* delay *after* next image */
|
|
661 |
|
|
662 |
mng_bool bForcedelay;
|
|
663 |
mng_uint32 iAccumdelay;
|
|
664 |
#endif
|
|
665 |
|
|
666 |
#ifndef MNG_SKIPCHUNK_SHOW
|
|
667 |
mng_uint8 iSHOWmode; /* SHOW fields */
|
|
668 |
mng_uint16 iSHOWfromid;
|
|
669 |
mng_uint16 iSHOWtoid;
|
|
670 |
mng_uint16 iSHOWnextid;
|
|
671 |
mng_int16 iSHOWskip;
|
|
672 |
#endif
|
|
673 |
|
|
674 |
mng_uint32 iGlobalPLTEcount; /* global PLTE fields */
|
|
675 |
mng_rgbpaltab aGlobalPLTEentries;
|
|
676 |
|
|
677 |
mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */
|
|
678 |
mng_uint8arr aGlobalTRNSrawdata;
|
|
679 |
|
|
680 |
mng_uint32 iGlobalGamma; /* global gAMA fields */
|
|
681 |
|
|
682 |
#ifndef MNG_SKIPCHUNK_cHRM
|
|
683 |
mng_uint32 iGlobalWhitepointx; /* global cHRM fields */
|
|
684 |
mng_uint32 iGlobalWhitepointy;
|
|
685 |
mng_uint32 iGlobalPrimaryredx;
|
|
686 |
mng_uint32 iGlobalPrimaryredy;
|
|
687 |
mng_uint32 iGlobalPrimarygreenx;
|
|
688 |
mng_uint32 iGlobalPrimarygreeny;
|
|
689 |
mng_uint32 iGlobalPrimarybluex;
|
|
690 |
mng_uint32 iGlobalPrimarybluey;
|
|
691 |
#endif
|
|
692 |
|
|
693 |
mng_uint8 iGlobalRendintent; /* global sRGB fields */
|
|
694 |
|
|
695 |
#ifndef MNG_SKIPCHUNK_iCCP
|
|
696 |
mng_uint32 iGlobalProfilesize; /* global iCCP fields */
|
|
697 |
mng_ptr pGlobalProfile;
|
|
698 |
#endif
|
|
699 |
|
|
700 |
mng_uint16 iGlobalBKGDred; /* global bKGD fields */
|
|
701 |
mng_uint16 iGlobalBKGDgreen;
|
|
702 |
mng_uint16 iGlobalBKGDblue;
|
|
703 |
|
|
704 |
mng_ptr pDeltaImage; /* delta-image fields */
|
|
705 |
mng_uint8 iDeltaImagetype;
|
|
706 |
#endif /* MNG_SUPPORT_DISPLAY */
|
|
707 |
mng_uint8 iDeltatype; /* need this one in read processing !! */
|
|
708 |
#ifdef MNG_SUPPORT_DISPLAY
|
|
709 |
mng_uint32 iDeltaBlockwidth;
|
|
710 |
mng_uint32 iDeltaBlockheight;
|
|
711 |
mng_uint32 iDeltaBlockx;
|
|
712 |
mng_uint32 iDeltaBlocky;
|
|
713 |
mng_bool bDeltaimmediate;
|
|
714 |
|
|
715 |
mng_fptr fDeltagetrow; /* internal delta-proc callbacks */
|
|
716 |
mng_fptr fDeltaaddrow;
|
|
717 |
mng_fptr fDeltareplacerow;
|
|
718 |
mng_fptr fDeltaputrow;
|
|
719 |
|
|
720 |
#ifndef MNG_SKIPCHUNK_PROM
|
|
721 |
mng_fptr fPromoterow; /* internal PROM fields */
|
|
722 |
mng_fptr fPromBitdepth;
|
|
723 |
mng_ptr pPromBuf;
|
|
724 |
mng_uint8 iPromColortype;
|
|
725 |
mng_uint8 iPromBitdepth;
|
|
726 |
mng_uint8 iPromFilltype;
|
|
727 |
mng_uint32 iPromWidth;
|
|
728 |
mng_ptr pPromSrc;
|
|
729 |
mng_ptr pPromDst;
|
|
730 |
#endif
|
|
731 |
|
|
732 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
733 |
mng_uint16 iMAGNfromid;
|
|
734 |
mng_uint16 iMAGNcurrentid;
|
|
735 |
mng_uint16 iMAGNtoid;
|
|
736 |
#endif
|
|
737 |
|
|
738 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
739 |
mng_uint16 iPASTid;
|
|
740 |
mng_int32 iPastx; /* target x/y of last PAST */
|
|
741 |
mng_int32 iPasty;
|
|
742 |
#endif
|
|
743 |
|
|
744 |
mng_objectp pLastseek; /* last processed ani_seek object */
|
|
745 |
|
|
746 |
#ifdef MNG_INCLUDE_MPNG_PROPOSAL
|
|
747 |
mng_objectp pMPNG; /* mpNG object if available */
|
|
748 |
#endif
|
|
749 |
#ifdef MNG_INCLUDE_ANG_PROPOSAL
|
|
750 |
mng_objectp pANG; /* ANG object if available */
|
|
751 |
#endif
|
|
752 |
|
|
753 |
#endif /* MNG_SUPPORT_DISPLAY */
|
|
754 |
|
|
755 |
#ifdef MNG_INCLUDE_ZLIB
|
|
756 |
z_stream sZlib; /* zlib (de)compression variables */
|
|
757 |
|
|
758 |
mng_int32 iZlevel; /* zlib compression parameters */
|
|
759 |
mng_int32 iZmethod;
|
|
760 |
mng_int32 iZwindowbits;
|
|
761 |
mng_int32 iZmemlevel;
|
|
762 |
mng_int32 iZstrategy;
|
|
763 |
|
|
764 |
mng_uint32 iMaxIDAT; /* maximum size of IDAT data */
|
|
765 |
|
|
766 |
mng_bool bInflating; /* indicates "inflate" in progress */
|
|
767 |
mng_bool bDeflating; /* indicates "deflate" in progress */
|
|
768 |
#endif /* MNG_INCLUDE_ZLIB */
|
|
769 |
|
|
770 |
#ifdef MNG_INCLUDE_JNG
|
|
771 |
mngjpeg_dctmethod eJPEGdctmethod; /* IJG compression variables */
|
|
772 |
mng_int32 iJPEGquality;
|
|
773 |
mng_int32 iJPEGsmoothing;
|
|
774 |
mng_bool bJPEGcompressprogr;
|
|
775 |
mng_bool bJPEGcompressopt;
|
|
776 |
|
|
777 |
mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */
|
|
778 |
|
|
779 |
mngjpeg_compp pJPEGcinfo; /* compression structure */
|
|
780 |
mngjpeg_errorp pJPEGcerr; /* error-manager compress */
|
|
781 |
|
|
782 |
mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */
|
|
783 |
mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */
|
|
784 |
mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */
|
|
785 |
|
|
786 |
mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */
|
|
787 |
mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */
|
|
788 |
mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */
|
|
789 |
|
|
790 |
mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */
|
|
791 |
mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */
|
|
792 |
mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */
|
|
793 |
mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */
|
|
794 |
mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */
|
|
795 |
|
|
796 |
mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */
|
|
797 |
mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */
|
|
798 |
mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */
|
|
799 |
mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */
|
|
800 |
mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */
|
|
801 |
|
|
802 |
mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */
|
|
803 |
mng_uint32 iJPEGrowlen;
|
|
804 |
|
|
805 |
mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */
|
|
806 |
mng_uint32 iJPEGrowlen2;
|
|
807 |
|
|
808 |
mng_bool bJPEGcompress; /* indicates "compress" initialized */
|
|
809 |
|
|
810 |
mng_bool bJPEGdecompress; /* indicates "decompress" initialized (JDAT) */
|
|
811 |
mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */
|
|
812 |
mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */
|
|
813 |
mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */
|
|
814 |
mng_bool bJPEGscanending; /* indicates "finish_output" suspended (JDAT) */
|
|
815 |
mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */
|
|
816 |
|
|
817 |
mng_bool bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */
|
|
818 |
mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */
|
|
819 |
mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */
|
|
820 |
mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */
|
|
821 |
mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */
|
|
822 |
|
|
823 |
mng_fptr fStorerow2; /* internal callback to store an
|
|
824 |
uncompressed/unfiltered row of JPEG-data (JDAT) */
|
|
825 |
|
|
826 |
mng_fptr fStorerow3; /* internal callback to store an
|
|
827 |
uncompressed/unfiltered row of JPEG-data (JDAA) */
|
|
828 |
|
|
829 |
mng_uint32 iJPEGrow; /* row-number for current JPEG row */
|
|
830 |
mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */
|
|
831 |
mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */
|
|
832 |
mng_uint32 iJPEGdisprow; /* nr. of rows already displayed "on-the-fly" */
|
|
833 |
|
|
834 |
#if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B)
|
|
835 |
jmp_buf sErrorbuf; /* setjmp/longjmp buffer (error-recovery) */
|
|
836 |
#endif
|
|
837 |
|
|
838 |
#endif /* MNG_INCLUDE_JNG */
|
|
839 |
|
|
840 |
#ifndef MNG_USE_ZLIB_CRC
|
|
841 |
mng_uint32 aCRCtable [256]; /* CRC prefab table */
|
|
842 |
mng_bool bCRCcomputed; /* "has been built" indicator */
|
|
843 |
#endif
|
|
844 |
|
|
845 |
#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
|
|
846 |
png_imgtype ePng_imgtype;
|
|
847 |
#endif
|
|
848 |
|
|
849 |
#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT)
|
|
850 |
mng_uint8 iPNGdepth; /* Real input depth */
|
|
851 |
mng_uint8 iPNGmult;
|
|
852 |
#endif
|
|
853 |
|
|
854 |
#ifdef MNG_OPTIMIZE_DISPLAYCALLS
|
|
855 |
mng_uint32 iRawlen; /* temp vars for display processing */
|
|
856 |
mng_uint8p pRawdata;
|
|
857 |
#ifndef MNG_SKIPCHUNK_BASI
|
|
858 |
mng_uint16 iBASIred;
|
|
859 |
mng_uint16 iBASIgreen;
|
|
860 |
mng_uint16 iBASIblue;
|
|
861 |
mng_bool bBASIhasalpha;
|
|
862 |
mng_uint16 iBASIalpha;
|
|
863 |
mng_uint8 iBASIviewable;
|
|
864 |
#endif
|
|
865 |
#ifndef MNG_SKIPCHUNK_CLON
|
|
866 |
mng_uint16 iCLONsourceid;
|
|
867 |
mng_uint16 iCLONcloneid;
|
|
868 |
mng_uint8 iCLONclonetype;
|
|
869 |
mng_bool bCLONhasdonotshow;
|
|
870 |
mng_uint8 iCLONdonotshow;
|
|
871 |
mng_uint8 iCLONconcrete;
|
|
872 |
mng_bool bCLONhasloca;
|
|
873 |
mng_uint8 iCLONlocationtype;
|
|
874 |
mng_int32 iCLONlocationx;
|
|
875 |
mng_int32 iCLONlocationy;
|
|
876 |
#endif
|
|
877 |
#ifndef MNG_SKIPCHUNK_DISC
|
|
878 |
mng_uint32 iDISCcount;
|
|
879 |
mng_uint16p pDISCids;
|
|
880 |
#endif
|
|
881 |
#ifndef MNG_SKIPCHUNK_FRAM
|
|
882 |
mng_uint8 iTempFramemode;
|
|
883 |
mng_uint8 iTempChangedelay;
|
|
884 |
mng_uint32 iTempDelay;
|
|
885 |
mng_uint8 iTempChangetimeout;
|
|
886 |
mng_uint32 iTempTimeout;
|
|
887 |
mng_uint8 iTempChangeclipping;
|
|
888 |
mng_uint8 iTempCliptype;
|
|
889 |
mng_int32 iTempClipl;
|
|
890 |
mng_int32 iTempClipr;
|
|
891 |
mng_int32 iTempClipt;
|
|
892 |
mng_int32 iTempClipb;
|
|
893 |
#endif
|
|
894 |
#ifndef MNG_SKIPCHUNK_MOVE
|
|
895 |
mng_uint16 iMOVEfromid;
|
|
896 |
mng_uint16 iMOVEtoid;
|
|
897 |
mng_uint8 iMOVEmovetype;
|
|
898 |
mng_int32 iMOVEmovex;
|
|
899 |
mng_int32 iMOVEmovey;
|
|
900 |
#endif
|
|
901 |
#ifndef MNG_SKIPCHUNK_CLIP
|
|
902 |
mng_uint16 iCLIPfromid;
|
|
903 |
mng_uint16 iCLIPtoid;
|
|
904 |
mng_uint8 iCLIPcliptype;
|
|
905 |
mng_int32 iCLIPclipl;
|
|
906 |
mng_int32 iCLIPclipr;
|
|
907 |
mng_int32 iCLIPclipt;
|
|
908 |
mng_int32 iCLIPclipb;
|
|
909 |
#endif
|
|
910 |
#ifndef MNG_NO_DELTA_PNG
|
|
911 |
mng_uint16 iDHDRobjectid;
|
|
912 |
mng_uint8 iDHDRimagetype;
|
|
913 |
mng_uint8 iDHDRdeltatype;
|
|
914 |
mng_uint32 iDHDRblockwidth;
|
|
915 |
mng_uint32 iDHDRblockheight;
|
|
916 |
mng_uint32 iDHDRblockx;
|
|
917 |
mng_uint32 iDHDRblocky;
|
|
918 |
mng_uint8 iPROMbitdepth;
|
|
919 |
mng_uint8 iPROMcolortype;
|
|
920 |
mng_uint8 iPROMfilltype;
|
|
921 |
mng_uint8 iPPLTtype;
|
|
922 |
mng_uint32 iPPLTcount;
|
|
923 |
mng_palette8ep paPPLTindexentries;
|
|
924 |
mng_uint8p paPPLTalphaentries;
|
|
925 |
mng_uint8p paPPLTusedentries;
|
|
926 |
#endif
|
|
927 |
#ifndef MNG_SKIPCHUNK_MAGN
|
|
928 |
mng_uint16 iMAGNfirstid;
|
|
929 |
mng_uint16 iMAGNlastid;
|
|
930 |
mng_uint8 iMAGNmethodX;
|
|
931 |
mng_uint16 iMAGNmX;
|
|
932 |
mng_uint16 iMAGNmY;
|
|
933 |
mng_uint16 iMAGNmL;
|
|
934 |
mng_uint16 iMAGNmR;
|
|
935 |
mng_uint16 iMAGNmT;
|
|
936 |
mng_uint16 iMAGNmB;
|
|
937 |
mng_uint8 iMAGNmethodY;
|
|
938 |
#endif
|
|
939 |
#ifndef MNG_SKIPCHUNK_PAST
|
|
940 |
mng_uint16 iPASTtargetid;
|
|
941 |
mng_uint8 iPASTtargettype;
|
|
942 |
mng_int32 iPASTtargetx;
|
|
943 |
mng_int32 iPASTtargety;
|
|
944 |
mng_uint32 iPASTcount;
|
|
945 |
mng_ptr pPASTsources;
|
|
946 |
#endif
|
|
947 |
#endif /* MNG_OPTIMIZE_DISPLAYCALLS */
|
|
948 |
|
|
949 |
} mng_data;
|
|
950 |
|
|
951 |
typedef mng_data * mng_datap;
|
|
952 |
|
|
953 |
/* ************************************************************************** */
|
|
954 |
/* * * */
|
|
955 |
/* * Internal Callback-Function prototypes * */
|
|
956 |
/* * * */
|
|
957 |
/* ************************************************************************** */
|
|
958 |
|
|
959 |
typedef mng_retcode(*mng_displayrow) (mng_datap pData);
|
|
960 |
typedef mng_retcode(*mng_restbkgdrow) (mng_datap pData);
|
|
961 |
typedef mng_retcode(*mng_correctrow) (mng_datap pData);
|
|
962 |
typedef mng_retcode(*mng_retrieverow) (mng_datap pData);
|
|
963 |
typedef mng_retcode(*mng_storerow) (mng_datap pData);
|
|
964 |
typedef mng_retcode(*mng_processrow) (mng_datap pData);
|
|
965 |
typedef mng_retcode(*mng_initrowproc) (mng_datap pData);
|
|
966 |
typedef mng_retcode(*mng_differrow) (mng_datap pData);
|
|
967 |
typedef mng_retcode(*mng_scalerow) (mng_datap pData);
|
|
968 |
typedef mng_retcode(*mng_deltarow) (mng_datap pData);
|
|
969 |
typedef mng_retcode(*mng_promoterow) (mng_datap pData);
|
|
970 |
typedef mng_retcode(*mng_fliprow) (mng_datap pData);
|
|
971 |
typedef mng_retcode(*mng_tilerow) (mng_datap pData);
|
|
972 |
|
|
973 |
typedef mng_uint8 (*mng_bitdepth_8) (mng_uint8 iB);
|
|
974 |
typedef mng_uint16 (*mng_bitdepth_16) (mng_uint8 iB);
|
|
975 |
|
|
976 |
typedef mng_retcode(*mng_magnify_x) (mng_datap pData,
|
|
977 |
mng_uint16 iMX,
|
|
978 |
mng_uint16 iML,
|
|
979 |
mng_uint16 iMR,
|
|
980 |
mng_uint32 iWidth,
|
|
981 |
mng_uint8p iSrcline,
|
|
982 |
mng_uint8p iDstline);
|
|
983 |
typedef mng_retcode(*mng_magnify_y) (mng_datap pData,
|
|
984 |
mng_int32 iM,
|
|
985 |
mng_int32 iS,
|
|
986 |
mng_uint32 iWidth,
|
|
987 |
mng_uint8p iSrcline1,
|
|
988 |
mng_uint8p iSrcline2,
|
|
989 |
mng_uint8p iDstline);
|
|
990 |
|
|
991 |
/* ************************************************************************** */
|
|
992 |
/* * * */
|
|
993 |
/* * Routines for swapping byte-order from and to graphic files * */
|
|
994 |
/* * (This code is adapted from the libpng package) * */
|
|
995 |
/* * * */
|
|
996 |
/* ************************************************************************** */
|
|
997 |
|
|
998 |
#ifndef MNG_BIGENDIAN_SUPPORTED
|
|
999 |
mng_uint32 mng_get_uint32 (mng_uint8p pBuf);
|
|
1000 |
mng_int32 mng_get_int32 (mng_uint8p pBuf);
|
|
1001 |
mng_uint16 mng_get_uint16 (mng_uint8p pBuf);
|
|
1002 |
void mng_put_uint32 (mng_uint8p pBuf,
|
|
1003 |
mng_uint32 i);
|
|
1004 |
void mng_put_int32 (mng_uint8p pBuf,
|
|
1005 |
mng_int32 i);
|
|
1006 |
void mng_put_uint16 (mng_uint8p pBuf,
|
|
1007 |
mng_uint16 i);
|
|
1008 |
#else /* MNG_BIGENDIAN_SUPPORTED */
|
|
1009 |
#define mng_get_uint32(P) *(mng_uint32p)(P)
|
|
1010 |
#define mng_get_int32(P) *(mng_int32p)(P)
|
|
1011 |
#define mng_get_uint16(P) *(mng_uint16p)(P)
|
|
1012 |
#define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I)
|
|
1013 |
#define mng_put_int32(P,I) *(mng_int32p)(P) = (I)
|
|
1014 |
#define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I)
|
|
1015 |
#endif /* MNG_BIGENDIAN_SUPPORTED */
|
|
1016 |
|
|
1017 |
/* ************************************************************************** */
|
|
1018 |
/* * * */
|
|
1019 |
/* * Some handy(?) macro definitions * */
|
|
1020 |
/* * * */
|
|
1021 |
/* ************************************************************************** */
|
|
1022 |
|
|
1023 |
#define MAX_COORD(a, b) (((a) > (b)) ? (a) : (b))
|
|
1024 |
#define MIN_COORD(a, b) (((a) < (b)) ? (a) : (b))
|
|
1025 |
|
|
1026 |
/* ************************************************************************** */
|
|
1027 |
|
|
1028 |
#endif /* _libmng_data_h_ */
|
|
1029 |
|
|
1030 |
/* ************************************************************************** */
|
|
1031 |
/* * end of file * */
|
|
1032 |
/* ************************************************************************** */
|