1 /* ************************************************************************** */
2 /* *                                                                        * */
3 /* * COPYRIGHT NOTICE:                                                      * */
4 /* *                                                                        * */
5 /* * Copyright (c) 2000-2002 Gerard Juyn (gerard@libmng.com)                * */
6 /* * [You may insert additional notices after this sentence if you modify   * */
7 /* *  this source]                                                          * */
8 /* *                                                                        * */
9 /* * For the purposes of this copyright and license, "Contributing Authors" * */
10 /* * is defined as the following set of individuals:                        * */
11 /* *                                                                        * */
12 /* *    Gerard Juyn (gerard@libmng.com)                                     * */
13 /* *                                                                        * */
14 /* * The MNG Library is supplied "AS IS".  The Contributing Authors         * */
15 /* * disclaim all warranties, expressed or implied, including, without      * */
16 /* * limitation, the warranties of merchantability and of fitness for any   * */
17 /* * purpose.  The Contributing Authors assume no liability for direct,     * */
18 /* * indirect, incidental, special, exemplary, or consequential damages,    * */
19 /* * which may result from the use of the MNG Library, even if advised of   * */
20 /* * the possibility of such damage.                                        * */
21 /* *                                                                        * */
22 /* * Permission is hereby granted to use, copy, modify, and distribute this * */
23 /* * source code, or portions hereof, for any purpose, without fee, subject * */
24 /* * to the following restrictions:                                         * */
25 /* *                                                                        * */
26 /* * 1. The origin of this source code must not be misrepresented;          * */
27 /* *    you must not claim that you wrote the original software.            * */
28 /* *                                                                        * */
29 /* * 2. Altered versions must be plainly marked as such and must not be     * */
30 /* *    misrepresented as being the original source.                        * */
31 /* *                                                                        * */
32 /* * 3. This Copyright notice may not be removed or altered from any source * */
33 /* *    or altered source distribution.                                     * */
34 /* *                                                                        * */
35 /* * The Contributing Authors specifically permit, without fee, and         * */
36 /* * encourage the use of this source code as a component to supporting     * */
37 /* * the MNG and JNG file format in commercial products.  If you use this   * */
38 /* * source code in a product, acknowledgment would be highly appreciated.  * */
39 /* *                                                                        * */
40 /* ************************************************************************** */
41 /* *                                                                        * */
42 /* * Parts of this software have been adapted from the libpng package.      * */
43 /* * Although this library supports all features from the PNG specification * */
44 /* * (as MNG descends from it) it does not require the libpng package.      * */
45 /* * It does require the zlib library and optionally the IJG jpeg library,  * */
46 /* * and/or the "little-cms" library by Marti Maria (depending on the       * */
47 /* * inclusion of support for JNG and Full-Color-Management respectively.   * */
48 /* *                                                                        * */
49 /* * This library's function is primarily to read and display MNG           * */
50 /* * animations. It is not meant as a full-featured image-editing           * */
51 /* * component! It does however offer creation and editing functionality    * */
52 /* * at the chunk level.                                                    * */
53 /* * (future modifications may include some more support for creation       * */
54 /* *  and or editing)                                                       * */
55 /* *                                                                        * */
56 /* ************************************************************************** */
57 
58 /* ************************************************************************** */
59 /* *                                                                        * */
60 /* * Version numbering                                                      * */
61 /* *                                                                        * */
62 /* * X.Y.Z : X = release (0 = initial build)                                * */
63 /* *         Y = major version (uneven = test; even = production)           * */
64 /* *         Z = minor version (bugfixes; 2 is older than 10)               * */
65 /* *                                                                        * */
66 /* * production versions only appear when a test-version is extensively     * */
67 /* * tested and found stable or for intermediate bug-fixes (recognized by   * */
68 /* * a change in the Z number)                                              * */
69 /* *                                                                        * */
70 /* * x.1.x      = test version                                              * */
71 /* * x.2.x      = production version                                        * */
72 /* * x.3.x      = test version                                              * */
73 /* * x.4.x      = production version                                        * */
74 /* *  etc.                                                                  * */
75 /* *                                                                        * */
76 /* ************************************************************************** */
77 /* *                                                                        * */
78 /* * Identifier naming conventions throughout this library                  * */
79 /* *                                                                        * */
80 /* * iXxxx      = an integer                                                * */
81 /* * dXxxx      = a float                                                   * */
82 /* * pXxxx      = a pointer                                                 * */
83 /* * bXxxx      = a boolean                                                 * */
84 /* * eXxxx      = an enumeration                                            * */
85 /* * hXxxx      = a handle                                                  * */
86 /* * zXxxx      = a zero-terminated string (pchar)                          * */
87 /* * fXxxx      = a pointer to a function (callback)                        * */
88 /* * aXxxx      = an array                                                  * */
89 /* * sXxxx      = a structure                                               * */
90 /* *                                                                        * */
91 /* * Macros & defines are in all uppercase.                                 * */
92 /* * Functions & typedefs in all lowercase.                                 * */
93 /* * Exported stuff is prefixed with MNG_ or mng_ respectively.             * */
94 /* *                                                                        * */
95 /* * (I may have missed a couple; don't hesitate to let me know!)           * */
96 /* *                                                                        * */
97 /* ************************************************************************** */
98 
99 /* ************************************************************************** */
100 /* *                                                                        * */
101 /* * project   : libmng                                                     * */
102 /* * file      : libmng.h                  copyright (c) 2000-2002 G.Juyn   * */
103 /* * version   : 1.0.4                                                      * */
104 /* *                                                                        * */
105 /* * purpose   : main application interface                                 * */
106 /* *                                                                        * */
107 /* * author    : G.Juyn                                                     * */
108 /* * web       : http://www.3-t.com                                         * */
109 /* * email     : mailto:info@3-t.com                                        * */
110 /* *                                                                        * */
111 /* * comment   : The main application interface. An application should not  * */
112 /* *             need access to any of the other modules!                   * */
113 /* *                                                                        * */
114 /* * changes   : 0.5.1 - 05/06/2000 - G.Juyn                                * */
115 /* *             - changed chunk iteration function                         * */
116 /* *             0.5.1 - 05/08/2000 - G.Juyn                                * */
117 /* *             - added chunk access functions                             * */
118 /* *             - added version control constants & functions              * */
119 /* *             - changed strict-ANSI stuff                                * */
120 /* *             0.5.1 - 05/11/2000 - G.Juyn                                * */
121 /* *             - added set_outputprofile2 & set_srgbprofile2              * */
122 /* *             - added empty-chunk put-routines                           * */
123 /* *             0.5.1 - 05/12/2000 - G.Juyn                                * */
124 /* *             - added version_dll & VERSION_DLL (for consistency)        * */
125 /* *             - added version control explanatory text & samples         * */
126 /* *             0.5.1 - 05/15/2000 - G.Juyn                                * */
127 /* *             - added getimgdata & putimgdata functions                  * */
128 /* *                                                                        * */
129 /* *             0.5.2 - 05/16/2000 - G.Juyn                                * */
130 /* *             - changed the version parameters (obviously)               * */
131 /* *             0.5.2 - 05/18/2000 - G.Juyn                                * */
132 /* *             - complimented constants for chunk-property values         * */
133 /* *             0.5.2 - 05/23/2000 - G.Juyn                                * */
134 /* *             - fixed MNG_UINT_pHYg value                                * */
135 /* *             0.5.2 - 05/24/2000 - G.Juyn                                * */
136 /* *             - added support for get/set default zlib/IJG parms         * */
137 /* *             0.5.2 - 06/02/2000 - G.Juyn                                * */
138 /* *             - added MNG_BIGENDIAN_SUPPORT (contributed by Tim Rowley)  * */
139 /* *             - separated configuration-options into "mng_conf.h"        * */
140 /* *             - added RGB8_A8 canvasstyle                                * */
141 /* *             - added getalphaline callback for RGB8_A8 canvasstyle      * */
142 /* *             0.5.2 - 06/06/2000 - G.Juyn                                * */
143 /* *             - moved errorcodes from "mng_error.h"                      * */
144 /* *             - added mng_read_resume function to support                * */
145 /* *               read-suspension                                          * */
146 /* *                                                                        * */
147 /* *             0.5.3 - 06/16/2000 - G.Juyn                                * */
148 /* *             - changed the version parameters (obviously)               * */
149 /* *             0.5.3 - 06/21/2000 - G.Juyn                                * */
150 /* *             - added get/set for speedtype to facilitate testing        * */
151 /* *             - added get for imagelevel during processtext callback     * */
152 /* *             0.5.3 - 06/24/2000 - G.Juyn                                * */
153 /* *             - fixed inclusion of IJG read/write code                   * */
154 /* *             0.5.3 - 06/26/2000 - G.Juyn                                * */
155 /* *             - changed userdata variable to mng_ptr                     * */
156 /* *                                                                        * */
157 /* *             0.9.0 - 06/30/2000 - G.Juyn                                * */
158 /* *             - changed refresh parameters to 'x,y,width,height'         * */
159 /* *                                                                        * */
160 /* *             0.9.1 - 07/06/2000 - G.Juyn                                * */
161 /* *             - added MNG_NEEDTIMERWAIT errorcode                        * */
162 /* *             - changed comments to indicate modified behavior for       * */
163 /* *               timer & suspension breaks                                * */
164 /* *             0.9.1 - 07/08/2000 - G.Juyn                                * */
165 /* *             - added get routines for internal display variables        * */
166 /* *             - added get/set routines for suspensionmode variable       * */
167 /* *             0.9.1 - 07/15/2000 - G.Juyn                                * */
168 /* *             - added callbacks for SAVE/SEEK processing                 * */
169 /* *             - added get/set routines for sectionbreak variable         * */
170 /* *             - added NEEDSECTIONWAIT errorcode                          * */
171 /* *             0.9.1 - 07/19/2000 - G.Juyn                                * */
172 /* *             - added function to set frame-/layer-count & playtime      * */
173 /* *             - added errorcode for updatemngheader if not a MNG         * */
174 /* *                                                                        * */
175 /* *             0.9.2 - 07/31/2000 - G.Juyn                                * */
176 /* *             - fixed problem with trace-functions improperly wrapped    * */
177 /* *             - added status_xxxx functions                              * */
178 /* *             0.9.2 - 08/05/2000 - G.Juyn                                * */
179 /* *             - changed file-prefixes                                    * */
180 /* *             - added function to set simplicity field                   * */
181 /* *                                                                        * */
182 /* *             0.9.3 - 08/09/2000 - G.Juyn                                * */
183 /* *             - added check for simplicity-bits in MHDR                  * */
184 /* *             0.9.3 - 08/12/2000 - G.Juyn                                * */
185 /* *             - added workaround for faulty PhotoShop iCCP chunk         * */
186 /* *             0.9.3 - 08/26/2000 - G.Juyn                                * */
187 /* *             - added MAGN chunk                                         * */
188 /* *             0.9.3 - 09/07/2000 - G.Juyn                                * */
189 /* *             - added support for new filter_types                       * */
190 /* *             0.9.3 - 10/10/2000 - G.Juyn                                * */
191 /* *             - added support for alpha-depth prediction                 * */
192 /* *             0.9.3 - 10/11/2000 - G.Juyn                                * */
193 /* *             - fixed processing of unknown critical chunks              * */
194 /* *             - removed test-MaGN                                        * */
195 /* *             - added PNG/MNG spec version indicators                    * */
196 /* *             - added support for nEED                                   * */
197 /* *             0.9.3 - 10/16/2000 - G.Juyn                                * */
198 /* *             - added functions to retrieve PNG/JNG specific header-info * */
199 /* *             - added JDAA chunk                                         * */
200 /* *             0.9.3 - 10/17/2000 - G.Juyn                                * */
201 /* *             - added callback to process non-critical unknown chunks    * */
202 /* *             0.9.3 - 10/20/2000 - G.Juyn                                * */
203 /* *             - added errocode for delayed delta-processing              * */
204 /* *             - added get/set for bKGD preference setting                * */
205 /* *             0.9.3 - 10/21/2000 - G.Juyn                                * */
206 /* *             - added get function for interlace/progressive display     * */
207 /* *                                                                        * */
208 /* *             0.9.4 - 01/18/2001 - G.Juyn                                * */
209 /* *             - added errorcode for MAGN methods                         * */
210 /* *             - removed test filter-methods 1 & 65                       * */
211 /* *                                                                        * */
212 /* *             1.0.0 - 02/05/2001 - G.Juyn                                * */
213 /* *             - version numbers (obviously)                              * */
214 /* *                                                                        * */
215 /* *             1.0.1 - 02/08/2001 - G.Juyn                                * */
216 /* *             - added MEND processing callback                           * */
217 /* *             1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly)              * */
218 /* *             - added BGRA8 canvas with premultiplied alpha              * */
219 /* *             1.0.1 - 05/02/2001 - G.Juyn                                * */
220 /* *             - added "default" sRGB generation (Thanks Marti!)          * */
221 /* *                                                                        * */
222 /* *             1.0.2 - 06/23/2001 - G.Juyn                                * */
223 /* *             - added optimization option for MNG-video playback         * */
224 /* *             - added processterm callback                               * */
225 /* *             1.0.2 - 06/25/2001 - G.Juyn                                * */
226 /* *             - added late binding errorcode (not used internally)       * */
227 /* *             - added option to turn off progressive refresh             * */
228 /* *                                                                        * */
229 /* *             1.0.3 - 08/06/2001 - G.Juyn                                * */
230 /* *             - added get function for last processed BACK chunk         * */
231 /* *                                                                        * */
232 /* ************************************************************************** */
233 
234 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
235 #pragma option -A                      /* force ANSI-C */
236 #endif
237 
238 #ifndef _libmng_h_
239 #define _libmng_h_
240 
241 /* ************************************************************************** */
242 
243 #include "libmng_conf.h"               /* user-specific configuration options */
244 
245 /* ************************************************************************** */
246 
247 #define MNG_CHECK_BAD_ICCP             /* let's catch that sucker !!! */
248 
249 #ifdef MNG_SUPPORT_READ                /* dependencies based on user-configuration */
250 #define MNG_INCLUDE_READ_PROCS
251 #endif
252 
253 #ifdef MNG_SUPPORT_WRITE
254 #define MNG_INCLUDE_WRITE_PROCS
255 #endif
256 
257 #ifdef MNG_SUPPORT_DISPLAY
258 #define MNG_INCLUDE_FILTERS
259 #define MNG_INCLUDE_INTERLACE
260 #define MNG_INCLUDE_OBJECTS
261 #define MNG_INCLUDE_DISPLAY_PROCS
262 #define MNG_INCLUDE_TIMING_PROCS
263 #define MNG_INCLUDE_ZLIB
264 #endif
265 
266 #ifdef MNG_STORE_CHUNKS
267 #define MNG_INCLUDE_ZLIB
268 #endif
269 
270 #ifdef MNG_SUPPORT_IJG6B
271 #define MNG_INCLUDE_JNG
272 #define MNG_INCLUDE_IJG6B
273 #define MNG_USE_SETJMP
274 #endif
275 
276 #ifdef MNG_INCLUDE_JNG
277 #if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS)
278 #define MNG_INCLUDE_JNG_READ
279 #endif
280 #if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS)
281 #define MNG_INCLUDE_JNG_WRITE
282 #endif
283 #endif
284 
285 #ifdef MNG_FULL_CMS
286 #define MNG_INCLUDE_LCMS
287 #endif
288 
289 #ifdef MNG_AUTO_DITHER
290 #define MNG_INCLUDE_DITHERING
291 #endif
292 
293 #ifdef MNG_SUPPORT_TRACE
294 #define MNG_INCLUDE_TRACE_PROCS
295 #ifdef MNG_TRACE_TELLTALE
296 #define MNG_INCLUDE_TRACE_STRINGS
297 #endif
298 #endif
299 
300 #ifdef MNG_ERROR_TELLTALE
301 #define MNG_INCLUDE_ERROR_STRINGS
302 #endif
303 
304 /* ************************************************************************** */
305 
306 #include "libmng_types.h"              /* platform-specific definitions
307                                           and other assorted stuff */
308 
309 /* ************************************************************************** */
310 
311 #ifdef __cplusplus
312 extern "C" {
313 #endif
314 
315 /* ************************************************************************** */
316 /* *                                                                        * */
317 /* *  Versioning control                                                    * */
318 /* *                                                                        * */
319 /* *  version_so and version_dll will NOT reflect version_major;            * */
320 /* *  these will only change for binary incompatible changes (which will    * */
321 /* *  hopefully never occur)                                                * */
322 /* *  note: they will be set to 1 on the first public release !!!           * */
323 /* *                                                                        * */
324 /* *  first public release:                                                 * */
325 /* *  #define MNG_VERSION_TEXT    "1.0.0"                                   * */
326 /* *  #define MNG_VERSION_SO      1       eg. libmng.so.1                   * */
327 /* *  #define MNG_VERSION_DLL     1       eg. libmng.dll                    * */
328 /* *  #define MNG_VERSION_MAJOR   1                                         * */
329 /* *  #define MNG_VERSION_MINOR   0                                         * */
330 /* *  #define MNG_VERSION_RELEASE 0                                         * */
331 /* *                                                                        * */
332 /* *  bug fix & cosmetics :                                                 * */
333 /* *  #define MNG_VERSION_TEXT    "1.0.1"                                   * */
334 /* *  #define MNG_VERSION_SO      1       eg. libmng.so.1                   * */
335 /* *  #define MNG_VERSION_DLL     1       eg. libmng.dll                    * */
336 /* *  #define MNG_VERSION_MAJOR   1                                         * */
337 /* *  #define MNG_VERSION_MINOR   0                                         * */
338 /* *  #define MNG_VERSION_RELEASE 1                                         * */
339 /* *                                                                        * */
340 /* *  feature change :                                                      * */
341 /* *  #define MNG_VERSION_TEXT    "1.2.0"                                   * */
342 /* *  #define MNG_VERSION_SO      1       eg. libmng.so.1                   * */
343 /* *  #define MNG_VERSION_DLL     1       eg. libmng.dll                    * */
344 /* *  #define MNG_VERSION_MAJOR   1                                         * */
345 /* *  #define MNG_VERSION_MINOR   2                                         * */
346 /* *  #define MNG_VERSION_RELEASE 0                                         * */
347 /* *                                                                        * */
348 /* *  major rewrite (still binary compatible) :                             * */
349 /* *  #define MNG_VERSION_TEXT    "2.0.0"                                   * */
350 /* *  #define MNG_VERSION_SO      1       eg. libmng.so.1                   * */
351 /* *  #define MNG_VERSION_DLL     1       eg. libmng.dll                    * */
352 /* *  #define MNG_VERSION_MAJOR   2                                         * */
353 /* *  #define MNG_VERSION_MINOR   0                                         * */
354 /* *  #define MNG_VERSION_RELEASE 0                                         * */
355 /* *                                                                        * */
356 /* *  binary incompatible change:                                           * */
357 /* *  #define MNG_VERSION_TEXT    "13.0.0"                                  * */
358 /* *  #define MNG_VERSION_SO      2       eg. libmng.so.2                   * */
359 /* *  #define MNG_VERSION_DLL     2       eg. libmng2.dll                   * */
360 /* *  #define MNG_VERSION_MAJOR   13                                        * */
361 /* *  #define MNG_VERSION_MINOR   0                                         * */
362 /* *  #define MNG_VERSION_RELEASE 0                                         * */
363 /* *                                                                        * */
364 /* *  note that version_so & version_dll will always remain equal so it     * */
365 /* *  doesn't matter which one is called to do version-checking; they are   * */
366 /* *  just provided for their target platform                               * */
367 /* *                                                                        * */
368 /* ************************************************************************** */
369 
370 #define MNG_VERSION_TEXT    "1.0.4"
371 #define MNG_VERSION_SO      1          /* eg. libmng.so.1  */
372 #define MNG_VERSION_DLL     1          /* but: libmng.dll (!) */
373 #define MNG_VERSION_MAJOR   1
374 #define MNG_VERSION_MINOR   0
375 #define MNG_VERSION_RELEASE 4
376 
377 MNG_EXT mng_pchar MNG_DECL mng_version_text    (void);
378 MNG_EXT mng_uint8 MNG_DECL mng_version_so      (void);
379 MNG_EXT mng_uint8 MNG_DECL mng_version_dll     (void);
380 MNG_EXT mng_uint8 MNG_DECL mng_version_major   (void);
381 MNG_EXT mng_uint8 MNG_DECL mng_version_minor   (void);
382 MNG_EXT mng_uint8 MNG_DECL mng_version_release (void);
383 
384 /* ************************************************************************** */
385 /* *                                                                        * */
386 /* *  MNG/PNG specification level conformance                               * */
387 /* *                                                                        * */
388 /* ************************************************************************** */
389 
390 #define MNG_PNG_VERSION     "1.2"
391 #define MNG_PNG_VERSION_MAJ 1
392 #define MNG_PNG_VERSION_MIN 2
393 
394 #define MNG_MNG_VERSION     "1.0"
395 #define MNG_MNG_VERSION_MAJ 1
396 #define MNG_MNG_VERSION_MIN 0
397 #define MNG_MNG_DRAFT       99         /* deprecated;
398                                           only used for nEED "MNG DRAFT nn" */
399 
400 /* ************************************************************************** */
401 /* *                                                                        * */
402 /* *  High-level application functions                                      * */
403 /* *                                                                        * */
404 /* ************************************************************************** */
405 
406 /* library initialization function */
407 /* must be the first called before anything can be done at all */
408 /* initializes internal datastructure(s) */
409 MNG_EXT mng_handle  MNG_DECL mng_initialize      (mng_ptr       pUserdata,
410                                                   mng_memalloc  fMemalloc,
411                                                   mng_memfree   fMemfree,
412                                                   mng_traceproc fTraceproc);
413 
414 /* library reset function */
415 /* can be used to re-initialize the library, so another image can be
416    processed. there's absolutely no harm in calling it, even when it's not
417    really necessary */
418 MNG_EXT mng_retcode MNG_DECL mng_reset           (mng_handle    hHandle);
419 
420 /* library cleanup function */
421 /* must be the last called to clean up internal datastructure(s) */
422 MNG_EXT mng_retcode MNG_DECL mng_cleanup         (mng_handle*   hHandle);
423 
424 /* high-level read functions */
425 /* use mng_read if you simply want to read a Network Graphic */
426 /* mng_read_resume is used in I/O-read-suspension scenarios, where the
427    "readdata" callback may return FALSE & length=0 indicating it's buffer is
428    depleted or too short to supply the required bytes, and the buffer needs
429    to be refilled; libmng will return the errorcode MNG_NEEDMOREDATA telling
430    the app to refill it's read-buffer after which it must call mng_read_resume
431    (or mng_display_resume if it also displaying the image simultaneously) */
432 #ifdef MNG_SUPPORT_READ
433 MNG_EXT mng_retcode MNG_DECL mng_read            (mng_handle    hHandle);
434 MNG_EXT mng_retcode MNG_DECL mng_read_resume     (mng_handle    hHandle);
435 #endif
436 
437 /* high-level write & create functions */
438 /* use this if you want to write a previously read Network Graphic or
439    if you want to create a new graphic and write it */
440 /* to write a previously read graphic you must have defined MNG_STORE_CHUNKS */
441 /* to create a new graphic you'll also need access to the chunks
442    (eg. #define MNG_ACCESS_CHUNKS !) */
443 #ifdef MNG_SUPPORT_WRITE
444 MNG_EXT mng_retcode MNG_DECL mng_write           (mng_handle    hHandle);
445 MNG_EXT mng_retcode MNG_DECL mng_create          (mng_handle    hHandle);
446 #endif
447 
448 /* high-level display functions */
449 /* use these to display a previously read or created graphic or
450    to read & display a graphic simultaneously */
451 /* mng_display_resume should be called after a timer-interval
452    expires that was set through the settimer-callback, after a
453    read suspension-break, or, to resume an animation after a call
454    to mng_display_freeze/mng_display_reset */
455 /* mng_display_freeze thru mng_display_gotime can be used to influence
456    the display of an image, BUT ONLY if it has been completely read! */
457 #ifdef MNG_SUPPORT_DISPLAY
458 #ifdef MNG_SUPPORT_READ
459 MNG_EXT mng_retcode MNG_DECL mng_readdisplay     (mng_handle    hHandle);
460 #endif
461 MNG_EXT mng_retcode MNG_DECL mng_display         (mng_handle    hHandle);
462 MNG_EXT mng_retcode MNG_DECL mng_display_resume  (mng_handle    hHandle);
463 MNG_EXT mng_retcode MNG_DECL mng_display_freeze  (mng_handle    hHandle);
464 MNG_EXT mng_retcode MNG_DECL mng_display_reset   (mng_handle    hHandle);
465 MNG_EXT mng_retcode MNG_DECL mng_display_goframe (mng_handle    hHandle,
466                                                   mng_uint32    iFramenr);
467 MNG_EXT mng_retcode MNG_DECL mng_display_golayer (mng_handle    hHandle,
468                                                   mng_uint32    iLayernr);
469 MNG_EXT mng_retcode MNG_DECL mng_display_gotime  (mng_handle    hHandle,
470                                                   mng_uint32    iPlaytime);
471 #endif /* MNG_SUPPORT_DISPLAY */
472 
473 /* error reporting function */
474 /* use this if you need more detailed info on the last error */
475 /* iExtra1 & iExtra2 may contain errorcodes from zlib, jpeg, etc... */
476 /* zErrortext will only be filled if you #define MNG_ERROR_TELLTALE */
477 MNG_EXT mng_retcode MNG_DECL mng_getlasterror    (mng_handle    hHandle,
478                                                   mng_int8*     iSeverity,
479                                                   mng_chunkid*  iChunkname,
480                                                   mng_uint32*   iChunkseq,
481                                                   mng_int32*    iExtra1,
482                                                   mng_int32*    iExtra2,
483                                                   mng_pchar*    zErrortext);
484 
485 /* ************************************************************************** */
486 /* *                                                                        * */
487 /* *  Callback set functions                                                * */
488 /* *                                                                        * */
489 /* ************************************************************************** */
490 
491 /* memory callbacks */
492 /* called to allocate and release internal datastructures */
493 #ifndef MNG_INTERNAL_MEMMNGMT
494 MNG_EXT mng_retcode MNG_DECL mng_setcb_memalloc      (mng_handle        hHandle,
495                                                       mng_memalloc      fProc);
496 MNG_EXT mng_retcode MNG_DECL mng_setcb_memfree       (mng_handle        hHandle,
497                                                       mng_memfree       fProc);
498 #endif /* MNG_INTERNAL_MEMMNGMT */
499 
500 /* open- & close-stream callbacks */
501 /* called to open & close streams for input or output */
502 #if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)
503 MNG_EXT mng_retcode MNG_DECL mng_setcb_openstream    (mng_handle        hHandle,
504                                                       mng_openstream    fProc);
505 MNG_EXT mng_retcode MNG_DECL mng_setcb_closestream   (mng_handle        hHandle,
506                                                       mng_closestream   fProc);
507 #endif
508 
509 /* read callback */
510 /* called to get data from the inputstream */
511 #ifdef MNG_SUPPORT_READ
512 MNG_EXT mng_retcode MNG_DECL mng_setcb_readdata      (mng_handle        hHandle,
513                                                       mng_readdata      fProc);
514 #endif
515 
516 /* write callback */
517 /* called to put data into the outputstream */
518 #ifdef MNG_SUPPORT_WRITE
519 MNG_EXT mng_retcode MNG_DECL mng_setcb_writedata     (mng_handle        hHandle,
520                                                       mng_writedata     fProc);
521 #endif
522 
523 /* error callback */
524 /* called when an error occurs */
525 /* the application can determine if the error is recoverable,
526    and may inform the library by setting specific returncodes */
527 MNG_EXT mng_retcode MNG_DECL mng_setcb_errorproc     (mng_handle        hHandle,
528                                                       mng_errorproc     fProc);
529 
530 /* trace callback */
531 /* called to show the currently executing function */
532 #ifdef MNG_SUPPORT_TRACE
533 MNG_EXT mng_retcode MNG_DECL mng_setcb_traceproc     (mng_handle        hHandle,
534                                                       mng_traceproc     fProc);
535 #endif
536 
537 /* callbacks for read processing */
538 /* processheader is called when all header information has been gathered
539    from the inputstream */
540 /* processtext is called for every tEXt, zTXt and iTXt chunk in the
541    inputstream (iType=0 for tEXt, 1 for zTXt and 2 for iTXt);
542    you can call get_imagelevel to check at what nesting-level the chunk is
543    encountered (eg. tEXt inside an embedded image inside a MNG -> level == 2;
544                 in most other case -> level == 1) */
545 /* processsave & processseek are called for SAVE/SEEK chunks */
546 /* processneed is called for the nEED chunk; you should specify a callback
547    for this as the default behavior will be to abort processing */
548 /* processunknown is called after reading each non-critical unknown chunk */
549 #ifdef MNG_SUPPORT_READ
550 MNG_EXT mng_retcode MNG_DECL mng_setcb_processheader (mng_handle        hHandle,
551                                                       mng_processheader fProc);
552 MNG_EXT mng_retcode MNG_DECL mng_setcb_processtext   (mng_handle        hHandle,
553                                                       mng_processtext   fProc);
554 MNG_EXT mng_retcode MNG_DECL mng_setcb_processsave   (mng_handle        hHandle,
555                                                       mng_processsave   fProc);
556 MNG_EXT mng_retcode MNG_DECL mng_setcb_processseek   (mng_handle        hHandle,
557                                                       mng_processseek   fProc);
558 MNG_EXT mng_retcode MNG_DECL mng_setcb_processneed   (mng_handle        hHandle,
559                                                       mng_processneed   fProc);
560 MNG_EXT mng_retcode MNG_DECL mng_setcb_processmend   (mng_handle        hHandle,
561                                                       mng_processmend   fProc);
562 MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle        hHandle,
563                                                       mng_processunknown fProc);
564 MNG_EXT mng_retcode MNG_DECL mng_setcb_processterm   (mng_handle        hHandle,
565                                                       mng_processterm   fProc);
566 #endif
567 
568 /* callbacks for display processing */
569 /* getcanvasline is called to get an access-pointer to a line on the
570    drawing-canvas */
571 /* getbkgdline is called to get an access-pointer to a line from the
572    background-canvas */
573 /* refresh is called to inform the GUI to redraw the current canvas onto
574    it's output device (eg. in Win32 this would mean sending an
575    invalidate message for the specified region */
576 /* NOTE that the update-region is specified as x,y,width,height; eg. the
577    invalidate message for Windows requires left,top,right,bottom parameters
578    where the bottom-right is exclusive of the region!!
579    to get these correctly is as simple as:
580    left   = x;
581    top    = y;
582    right  = x + width;
583    bottom = y + height;
584    if your implementation requires inclusive points, simply subtract 1 from
585    both the right & bottom values calculated above.
586    */
587 #ifdef MNG_SUPPORT_DISPLAY
588 MNG_EXT mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle        hHandle,
589                                                       mng_getcanvasline fProc);
590 MNG_EXT mng_retcode MNG_DECL mng_setcb_getbkgdline   (mng_handle        hHandle,
591                                                       mng_getbkgdline   fProc);
592 MNG_EXT mng_retcode MNG_DECL mng_setcb_getalphaline  (mng_handle        hHandle,
593                                                       mng_getalphaline  fProc);
594 MNG_EXT mng_retcode MNG_DECL mng_setcb_refresh       (mng_handle        hHandle,
595                                                       mng_refresh       fProc);
596 
597 /* timing callbacks */
598 /* gettickcount is called to get the system tickcount (milliseconds);
599    this is used to determine the remaining interval between frames */
600 /* settimer is called to inform the application that it should set a timer;
601    when the timer is triggered the app must call mng_display_resume */
602 MNG_EXT mng_retcode MNG_DECL mng_setcb_gettickcount  (mng_handle        hHandle,
603                                                       mng_gettickcount  fProc);
604 MNG_EXT mng_retcode MNG_DECL mng_setcb_settimer      (mng_handle        hHandle,
605                                                       mng_settimer      fProc);
606 
607 /* color management callbacks */
608 /* called to transmit color management information to the application */
609 /* these are only used when you #define MNG_APP_CMS */
610 #ifdef MNG_APP_CMS
611 MNG_EXT mng_retcode MNG_DECL mng_setcb_processgamma  (mng_handle        hHandle,
612                                                       mng_processgamma  fProc);
613 MNG_EXT mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle        hHandle,
614                                                       mng_processchroma fProc);
615 MNG_EXT mng_retcode MNG_DECL mng_setcb_processsrgb   (mng_handle        hHandle,
616                                                       mng_processsrgb   fProc);
617 MNG_EXT mng_retcode MNG_DECL mng_setcb_processiccp   (mng_handle        hHandle,
618                                                       mng_processiccp   fProc);
619 MNG_EXT mng_retcode MNG_DECL mng_setcb_processarow   (mng_handle        hHandle,
620                                                       mng_processarow   fProc);
621 #endif /* MNG_APP_CMS */
622 #endif /* MNG_SUPPORT_DISPLAY */
623 
624 /* ************************************************************************** */
625 /* *                                                                        * */
626 /* *  Callback get functions                                                * */
627 /* *                                                                        * */
628 /* ************************************************************************** */
629 
630 /* see _setcb_ */
631 #ifndef MNG_INTERNAL_MEMMNGMT
632 MNG_EXT mng_memalloc      MNG_DECL mng_getcb_memalloc      (mng_handle hHandle);
633 MNG_EXT mng_memfree       MNG_DECL mng_getcb_memfree       (mng_handle hHandle);
634 #endif
635 
636 /* see _setcb_ */
637 #if defined(MNG_SUPPORT_READ) || defined(MNG_WRITE_SUPPORT)
638 MNG_EXT mng_openstream    MNG_DECL mng_getcb_openstream    (mng_handle hHandle);
639 MNG_EXT mng_closestream   MNG_DECL mng_getcb_closestream   (mng_handle hHandle);
640 #endif
641 
642 /* see _setcb_ */
643 #ifdef MNG_SUPPORT_READ
644 MNG_EXT mng_readdata      MNG_DECL mng_getcb_readdata      (mng_handle hHandle);
645 #endif
646 
647 /* see _setcb_ */
648 #ifdef MNG_SUPPORT_WRITE
649 MNG_EXT mng_writedata     MNG_DECL mng_getcb_writedata     (mng_handle hHandle);
650 #endif
651 
652 /* see _setcb_ */
653 MNG_EXT mng_errorproc     MNG_DECL mng_getcb_errorproc     (mng_handle hHandle);
654 
655 /* see _setcb_ */
656 #ifdef MNG_SUPPORT_TRACE
657 MNG_EXT mng_traceproc     MNG_DECL mng_getcb_traceproc     (mng_handle hHandle);
658 #endif
659 
660 /* see _setcb_ */
661 #ifdef MNG_SUPPORT_READ
662 MNG_EXT mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle);
663 MNG_EXT mng_processtext   MNG_DECL mng_getcb_processtext   (mng_handle hHandle);
664 MNG_EXT mng_processsave   MNG_DECL mng_getcb_processsave   (mng_handle hHandle);
665 MNG_EXT mng_processseek   MNG_DECL mng_getcb_processseek   (mng_handle hHandle);
666 MNG_EXT mng_processneed   MNG_DECL mng_getcb_processneed   (mng_handle hHandle);
667 MNG_EXT mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle);
668 MNG_EXT mng_processterm   MNG_DECL mng_getcb_processterm   (mng_handle hHandle);
669 #endif
670 
671 /* see _setcb_ */
672 #ifdef MNG_SUPPORT_DISPLAY
673 MNG_EXT mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle);
674 MNG_EXT mng_getbkgdline   MNG_DECL mng_getcb_getbkgdline   (mng_handle hHandle);
675 MNG_EXT mng_getalphaline  MNG_DECL mng_getcb_getalphaline  (mng_handle hHandle);
676 MNG_EXT mng_refresh       MNG_DECL mng_getcb_refresh       (mng_handle hHandle);
677 
678 /* see _setcb_ */
679 MNG_EXT mng_gettickcount  MNG_DECL mng_getcb_gettickcount  (mng_handle hHandle);
680 MNG_EXT mng_settimer      MNG_DECL mng_getcb_settimer      (mng_handle hHandle);
681 
682 /* see _setcb_ */
683 #ifdef MNG_APP_CMS
684 MNG_EXT mng_processgamma  MNG_DECL mng_getcb_processgamma  (mng_handle hHandle);
685 MNG_EXT mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle);
686 MNG_EXT mng_processsrgb   MNG_DECL mng_getcb_processsrgb   (mng_handle hHandle);
687 MNG_EXT mng_processiccp   MNG_DECL mng_getcb_processiccp   (mng_handle hHandle);
688 MNG_EXT mng_processarow   MNG_DECL mng_getcb_processarow   (mng_handle hHandle);
689 #endif /* MNG_APP_CMS */
690 #endif /* MNG_SUPPORT_DISPLAY */
691 
692 /* ************************************************************************** */
693 /* *                                                                        * */
694 /* *  Property set functions                                                * */
695 /* *                                                                        * */
696 /* ************************************************************************** */
697 
698 /* Application data pointer */
699 /* provided for application use; not used by the library */
700 MNG_EXT mng_retcode MNG_DECL mng_set_userdata        (mng_handle        hHandle,
701                                                       mng_ptr           pUserdata);
702 
703 /* The style of the drawing- & background-canvas */
704 /* only used for displaying images */
705 /* both are initially set to 24-bit RGB (eg. 8-bit per channel) */
706 MNG_EXT mng_retcode MNG_DECL mng_set_canvasstyle     (mng_handle        hHandle,
707                                                       mng_uint32        iStyle);
708 MNG_EXT mng_retcode MNG_DECL mng_set_bkgdstyle       (mng_handle        hHandle,
709                                                       mng_uint32        iStyle);
710 
711 /* The default background color */
712 /* only used if the getbkgdline callback is not defined */
713 /* for initially painting the canvas and restoring (part of) the background */
714 MNG_EXT mng_retcode MNG_DECL mng_set_bgcolor         (mng_handle        hHandle,
715                                                       mng_uint16        iRed,
716                                                       mng_uint16        iGreen,
717                                                       mng_uint16        iBlue);
718 
719 /* Indicates preferred use of the bKGD chunk for PNG images */
720 MNG_EXT mng_retcode MNG_DECL mng_set_usebkgd         (mng_handle        hHandle,
721                                                       mng_bool          bUseBKGD);
722 
723 /* Indicates storage of read chunks */
724 /* only useful if you #define mng_store_chunks */
725 /* can be used to dynamically change storage management */
726 MNG_EXT mng_retcode MNG_DECL mng_set_storechunks     (mng_handle        hHandle,
727                                                       mng_bool          bStorechunks);
728 
729 /* Indicates breaks requested when processing SAVE/SEEK */
730 /* set this to let the app handle section breaks; the library will return
731    MNG_NEEDSECTIONWAIT return-codes for each SEEK chunk */
732 MNG_EXT mng_retcode MNG_DECL mng_set_sectionbreaks   (mng_handle        hHandle,
733                                                       mng_bool          bSectionbreaks);
734 
735 /* Indicates storage of playback info (ON by default!) */
736 /* can be used to turn off caching of playback info; this is useful to
737    specifically optimize MNG-video playback; note that if caching is turned off
738    LOOP chunks will be flagged as errors! TERM chunks will be ignored and only
739    passed to the processterm() callback if it is defined by the app; also, this
740    feature can only be used with mng_readdisplay(); mng_read(),
741    mng_display_reset() and mng_display_goxxxx() will return an error;
742    once this option is turned off it can't be turned on for the same stream!!! */
743 MNG_EXT mng_retcode MNG_DECL mng_set_cacheplayback   (mng_handle        hHandle,
744                                                       mng_bool          bCacheplayback);
745 
746 /* Indicates automatic progressive refreshes for large images (ON by default!) */
747 /* turn this off if you do not want intermittent painting while a large image
748    is being read. useful if the input-stream comes from a fast medium, such
749    as a local harddisk */
750 MNG_EXT mng_retcode MNG_DECL mng_set_doprogressive   (mng_handle        hHandle,
751                                                       mng_bool          bDoProgressive);
752 
753 /* Color-management necessaries */
754 /*
755     *************************************************************************
756                   !!!!!!!! THIS BIT IS IMPORTANT !!!!!!!!!
757     *************************************************************************
758 
759     If you have defined MNG_FULL_CMS (and are using lcms), you will have to
760     think hard about the following routines.
761 
762     lcms requires 2 profiles to work off the differences in the input-image
763     and the output-device. The ICC profile for the input-image will be
764     embedded within it to reflect its color-characteristics, but the output
765     profile depends on the output-device, which is something only *YOU* know
766     about. sRGB (standard RGB) is common for x86 compatible environments
767     (eg. Windows, Linux and some others)
768 
769     If you are compiling for a sRGB compliant system you probably won't have
770     to do anything special. (unless you want to ofcourse)
771 
772     If you are compiling for a non-sRGB compliant system
773     (eg. SGI, Mac, Next, others...)
774     you *MUST* define a proper ICC profile for the generic output-device
775     associated with that platform.
776 
777     In either event, you may also want to offer an option to your users to
778     set the profile manually, or, if you know how, set it from a
779     system-defined default.
780 
781     TO RECAP: for sRGB systems (Windows, Linux) no action required!
782               for non-sRGB systems (SGI, Mac, Next) ACTION REQUIRED!
783 
784     Please visit http://www.srgb.com, http://www.color.org and
785     http://www.littlecms.com for more info.
786 
787     *************************************************************************
788                   !!!!!!!! THIS BIT IS IMPORTANT !!!!!!!!!
789     *************************************************************************
790 */
791 /* mng_set_srgb tells libmng if it's running on a sRGB compliant system or not
792    the default is already set to MNG_TRUE */
793 /* mng_set_outputprofile, mng_set_outputprofile2, mng_set_outputsrgb
794    are used to set the default profile describing the output-device
795    by default it is already initialized with an sRGB profile */
796 /* mng_set_srgbprofile, mng_set_srgbprofile2, mng_set_srgbimplicit
797    are used to set the default profile describing a standard sRGB device
798    this is used when the input-image is tagged only as being sRGB, but the
799    output-device is defined as not being sRGB compliant
800    by default it is already initialized with a standard sRGB profile */
801 #if defined(MNG_SUPPORT_DISPLAY)
802 MNG_EXT mng_retcode MNG_DECL mng_set_srgb            (mng_handle        hHandle,
803                                                       mng_bool          bIssRGB);
804 MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile   (mng_handle        hHandle,
805                                                       mng_pchar         zFilename);
806 MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile2  (mng_handle        hHandle,
807                                                       mng_uint32        iProfilesize,
808                                                       mng_ptr           pProfile);
809 MNG_EXT mng_retcode MNG_DECL mng_set_outputsrgb      (mng_handle        hHandle);
810 MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile     (mng_handle        hHandle,
811                                                       mng_pchar         zFilename);
812 MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile2    (mng_handle        hHandle,
813                                                       mng_uint32        iProfilesize,
814                                                       mng_ptr           pProfile);
815 MNG_EXT mng_retcode MNG_DECL mng_set_srgbimplicit    (mng_handle        hHandle);
816 #endif
817 
818 /* Gamma settings */
819 /* only used if you #define MNG_FULL_CMS or #define MNG_GAMMA_ONLY */
820 /* ... blabla (explain gamma processing a little; eg. formula & stuff) ... */
821 MNG_EXT mng_retcode MNG_DECL mng_set_viewgamma       (mng_handle        hHandle,
822                                                       mng_float         dGamma);
823 MNG_EXT mng_retcode MNG_DECL mng_set_displaygamma    (mng_handle        hHandle,
824                                                       mng_float         dGamma);
825 MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggamma    (mng_handle        hHandle,
826                                                       mng_float         dGamma);
827 MNG_EXT mng_retcode MNG_DECL mng_set_viewgammaint    (mng_handle        hHandle,
828                                                       mng_uint32        iGamma);
829 MNG_EXT mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle        hHandle,
830                                                       mng_uint32        iGamma);
831 MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle        hHandle,
832                                                       mng_uint32        iGamma);
833 
834 /* Ultimate clipping size */
835 /* used to limit extreme graphics from overloading the system */
836 /* if a graphic exceeds these limits a warning is issued, which can
837    be ignored by the app (using the errorproc callback). in that case
838    the library will use these settings to clip the input graphic, and
839    the app's canvas must account for this */
840 MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvaswidth  (mng_handle        hHandle,
841                                                       mng_uint32        iMaxwidth);
842 MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle        hHandle,
843                                                       mng_uint32        iMaxheight);
844 MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvassize   (mng_handle        hHandle,
845                                                       mng_uint32        iMaxwidth,
846                                                       mng_uint32        iMaxheight);
847 
848 /* ZLIB default compression parameters */
849 /* these are used when writing out chunks */
850 /* they are also used when compressing PNG image-data or JNG alpha-data;
851    in this case you can set them just before calling mng_putimgdata_ihdr */
852 /* set to your liking; usually the defaults will suffice though! */
853 /* check the documentation for ZLIB for details on these parameters */
854 #ifdef MNG_INCLUDE_ZLIB
855 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_level      (mng_handle        hHandle,
856                                                       mng_int32         iZlevel);
857 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_method     (mng_handle        hHandle,
858                                                       mng_int32         iZmethod);
859 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle        hHandle,
860                                                       mng_int32         iZwindowbits);
861 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_memlevel   (mng_handle        hHandle,
862                                                       mng_int32         iZmemlevel);
863 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_strategy   (mng_handle        hHandle,
864                                                       mng_int32         iZstrategy);
865 
866 MNG_EXT mng_retcode MNG_DECL mng_set_zlib_maxidat    (mng_handle        hHandle,
867                                                       mng_uint32        iMaxIDAT);
868 #endif /* MNG_INCLUDE_ZLIB */
869 
870 /* JNG default compression parameters (based on IJG code) */
871 /* these are used when compressing JNG image-data; so you can set them
872    just before calling mng_putimgdata_jhdr */
873 /* set to your liking; usually the defaults will suffice though! */
874 /* check the documentation for IJGSRC6B for details on these parameters */
875 #ifdef MNG_INCLUDE_JNG
876 #ifdef MNG_INCLUDE_IJG6B
877 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_dctmethod  (mng_handle        hHandle,
878                                                       mngjpeg_dctmethod eJPEGdctmethod);
879 #endif
880 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_quality    (mng_handle        hHandle,
881                                                       mng_int32         iJPEGquality);
882 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_smoothing  (mng_handle        hHandle,
883                                                       mng_int32         iJPEGsmoothing);
884 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_progressive(mng_handle        hHandle,
885                                                       mng_bool          bJPEGprogressive);
886 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_optimized  (mng_handle        hHandle,
887                                                       mng_bool          bJPEGoptimized);
888 
889 MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_maxjdat    (mng_handle        hHandle,
890                                                       mng_uint32        iMaxJDAT);
891 #endif /* MNG_INCLUDE_JNG */
892 
893 /* Suspension-mode setting */
894 /* use this to activate the internal suspension-buffer to improve
895    read-suspension processing */
896 /* TODO: write-suspension ??? */
897 #if defined(MNG_SUPPORT_READ)
898 MNG_EXT mng_retcode MNG_DECL mng_set_suspensionmode  (mng_handle        hHandle,
899                                                       mng_bool          bSuspensionmode);
900 #endif
901 
902 /* Speed setting */
903 /* use this to influence the display-speed of animations */
904 #if defined(MNG_SUPPORT_DISPLAY)
905 MNG_EXT mng_retcode MNG_DECL mng_set_speed           (mng_handle        hHandle,
906                                                       mng_speedtype     iSpeed);
907 #endif
908 
909 /* ************************************************************************** */
910 /* *                                                                        * */
911 /* *  Property get functions                                                * */
912 /* *                                                                        * */
913 /* ************************************************************************** */
914 
915 /* see _set_ */
916 MNG_EXT mng_ptr     MNG_DECL mng_get_userdata        (mng_handle        hHandle);
917 
918 /* Network Graphic header details */
919 /* these get filled once the graphics header is processed,
920    so they are available in the processheader callback; before that
921    they are zeroed out and imagetype is set to it_unknown */
922 /* this might be a good point for the app to initialize the drawing-canvas! */
923 /* note that some fields are only set for the first(!) header-chunk:
924    MNG/MHDR (imagetype = mng_it_mng) - ticks thru simplicity
925    PNG/IHDR (imagetype = mng_it_png) - bitdepth thru interlace
926    JNG/JHDR (imagetype = mng_it_jng) - bitdepth thru compression &
927                                        interlace thru alphainterlace */
928 MNG_EXT mng_imgtype MNG_DECL mng_get_sigtype         (mng_handle        hHandle);
929 MNG_EXT mng_imgtype MNG_DECL mng_get_imagetype       (mng_handle        hHandle);
930 MNG_EXT mng_uint32  MNG_DECL mng_get_imagewidth      (mng_handle        hHandle);
931 MNG_EXT mng_uint32  MNG_DECL mng_get_imageheight     (mng_handle        hHandle);
932 
933 MNG_EXT mng_uint32  MNG_DECL mng_get_ticks           (mng_handle        hHandle);
934 MNG_EXT mng_uint32  MNG_DECL mng_get_framecount      (mng_handle        hHandle);
935 MNG_EXT mng_uint32  MNG_DECL mng_get_layercount      (mng_handle        hHandle);
936 MNG_EXT mng_uint32  MNG_DECL mng_get_playtime        (mng_handle        hHandle);
937 MNG_EXT mng_uint32  MNG_DECL mng_get_simplicity      (mng_handle        hHandle);
938 
939 MNG_EXT mng_uint8   MNG_DECL mng_get_bitdepth        (mng_handle        hHandle);
940 MNG_EXT mng_uint8   MNG_DECL mng_get_colortype       (mng_handle        hHandle);
941 MNG_EXT mng_uint8   MNG_DECL mng_get_compression     (mng_handle        hHandle);
942 MNG_EXT mng_uint8   MNG_DECL mng_get_filter          (mng_handle        hHandle);
943 MNG_EXT mng_uint8   MNG_DECL mng_get_interlace       (mng_handle        hHandle);
944 MNG_EXT mng_uint8   MNG_DECL mng_get_alphabitdepth   (mng_handle        hHandle);
945 MNG_EXT mng_uint8   MNG_DECL mng_get_alphacompression(mng_handle        hHandle);
946 MNG_EXT mng_uint8   MNG_DECL mng_get_alphafilter     (mng_handle        hHandle);
947 MNG_EXT mng_uint8   MNG_DECL mng_get_alphainterlace  (mng_handle        hHandle);
948 
949 /* indicates the predicted alpha-depth required to properly display the image */
950 /* gets set once the graphics header is processed and is available in the
951    processheader callback for any type of input-image (PNG, JNG or MNG) */
952 /* possible values are 0,1,2,4,8,16
953    0  = no transparency required
954    1  = on/off transparency required (alpha-values are 0 or 2^bit_depth-1)
955    2+ = semi-transparency required (values will be scaled to the bitdepth of the
956                                     canvasstyle supplied by the application) */
957 MNG_EXT mng_uint8   MNG_DECL mng_get_alphadepth      (mng_handle        hHandle);
958 
959 /* defines whether a refresh() callback is called for an interlace pass (PNG)
960    or progressive scan (JNG) */
961 /* returns the interlace pass number for PNG or a fabricated pass number for JNG;
962    returns 0 in all other cases */
963 /* only useful if the image_type = mng_it_png or mng_it_jng and if the image
964    is actually interlaced (PNG) or progressive (JNG) */
965 MNG_EXT mng_uint8   MNG_DECL mng_get_refreshpass     (mng_handle        hHandle);
966 
967 /* see _set_ */
968 MNG_EXT mng_uint32  MNG_DECL mng_get_canvasstyle     (mng_handle        hHandle);
969 MNG_EXT mng_uint32  MNG_DECL mng_get_bkgdstyle       (mng_handle        hHandle);
970 
971 /* see _set_ */
972 MNG_EXT mng_retcode MNG_DECL mng_get_bgcolor         (mng_handle        hHandle,
973                                                       mng_uint16*       iRed,
974                                                       mng_uint16*       iGreen,
975                                                       mng_uint16*       iBlue);
976 
977 /* see _set_ */
978 MNG_EXT mng_bool    MNG_DECL mng_get_usebkgd         (mng_handle        hHandle);
979 
980 /* see _set_ */
981 MNG_EXT mng_bool    MNG_DECL mng_get_storechunks     (mng_handle        hHandle);
982 
983 /* see _set_ */
984 MNG_EXT mng_bool    MNG_DECL mng_get_sectionbreaks   (mng_handle        hHandle);
985 
986 /* see _set_ */
987 MNG_EXT mng_bool    MNG_DECL mng_get_cacheplayback   (mng_handle        hHandle);
988 
989 /* see _set_ */
990 MNG_EXT mng_bool    MNG_DECL mng_get_doprogressive   (mng_handle        hHandle);
991 
992 /* see _set_ */
993 #if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS)
994 MNG_EXT mng_bool    MNG_DECL mng_get_srgb            (mng_handle        hHandle);
995 #endif
996 
997 /* see _set_ */
998 MNG_EXT mng_float   MNG_DECL mng_get_viewgamma       (mng_handle        hHandle);
999 MNG_EXT mng_float   MNG_DECL mng_get_displaygamma    (mng_handle        hHandle);
1000 MNG_EXT mng_float   MNG_DECL mng_get_dfltimggamma    (mng_handle        hHandle);
1001 MNG_EXT mng_uint32  MNG_DECL mng_get_viewgammaint    (mng_handle        hHandle);
1002 MNG_EXT mng_uint32  MNG_DECL mng_get_displaygammaint (mng_handle        hHandle);
1003 MNG_EXT mng_uint32  MNG_DECL mng_get_dfltimggammaint (mng_handle        hHandle);
1004 
1005 /* see _set_ */
1006 MNG_EXT mng_uint32  MNG_DECL mng_get_maxcanvaswidth  (mng_handle        hHandle);
1007 MNG_EXT mng_uint32  MNG_DECL mng_get_maxcanvasheight (mng_handle        hHandle);
1008 
1009 /* see _set_ */
1010 #ifdef MNG_INCLUDE_ZLIB
1011 MNG_EXT mng_int32   MNG_DECL mng_get_zlib_level      (mng_handle        hHandle);
1012 MNG_EXT mng_int32   MNG_DECL mng_get_zlib_method     (mng_handle        hHandle);
1013 MNG_EXT mng_int32   MNG_DECL mng_get_zlib_windowbits (mng_handle        hHandle);
1014 MNG_EXT mng_int32   MNG_DECL mng_get_zlib_memlevel   (mng_handle        hHandle);
1015 MNG_EXT mng_int32   MNG_DECL mng_get_zlib_strategy   (mng_handle        hHandle);
1016 
1017 MNG_EXT mng_uint32  MNG_DECL mng_get_zlib_maxidat    (mng_handle        hHandle);
1018 #endif /* MNG_INCLUDE_ZLIB */
1019 
1020 /* see _set_ */
1021 #ifdef MNG_INCLUDE_JNG
1022 #ifdef MNG_INCLUDE_IJG6B
1023 MNG_EXT mngjpeg_dctmethod
1024                     MNG_DECL mng_get_jpeg_dctmethod  (mng_handle        hHandle);
1025 #endif
1026 MNG_EXT mng_int32   MNG_DECL mng_get_jpeg_quality    (mng_handle        hHandle);
1027 MNG_EXT mng_int32   MNG_DECL mng_get_jpeg_smoothing  (mng_handle        hHandle);
1028 MNG_EXT mng_bool    MNG_DECL mng_get_jpeg_progressive(mng_handle        hHandle);
1029 MNG_EXT mng_bool    MNG_DECL mng_get_jpeg_optimized  (mng_handle        hHandle);
1030 
1031 MNG_EXT mng_uint32  MNG_DECL mng_get_jpeg_maxjdat    (mng_handle        hHandle);
1032 #endif /* MNG_INCLUDE_JNG */
1033 
1034 /* see _set_  */
1035 #if defined(MNG_SUPPORT_READ)
1036 MNG_EXT mng_bool    MNG_DECL mng_get_suspensionmode  (mng_handle        hHandle);
1037 #endif
1038 
1039 /* see _set_  */
1040 #if defined(MNG_SUPPORT_DISPLAY)
1041 MNG_EXT mng_speedtype
1042                     MNG_DECL mng_get_speed           (mng_handle        hHandle);
1043 #endif
1044 
1045 /* Image-level */
1046 /* this can be used inside the processtext callback to determine the level of
1047    text of the image being processed; the value 1 is returned for top-level
1048    texts, and the value 2 for a text inside an embedded image inside a MNG */
1049 MNG_EXT mng_uint32  MNG_DECL mng_get_imagelevel      (mng_handle        hHandle);
1050 
1051 /* BACK info */
1052 /* can be used to retrieve the color & mandatory values for the last processed
1053    BACK chunk of a MNG (will fail for other image-types);
1054    if no BACK chunk was processed yet, it will return all zeroes */
1055 MNG_EXT mng_retcode MNG_DECL mng_get_lastbackchunk   (mng_handle        hHandle,
1056                                                       mng_uint16*       iRed,
1057                                                       mng_uint16*       iGreen,
1058                                                       mng_uint16*       iBlue,
1059                                                       mng_uint8*        iMandatory);
1060 
1061 /* Display status variables */
1062 /* these get filled & updated during display processing */
1063 /* starttime is the tickcount at the start of displaying the animation */
1064 /* runtime is the actual number of millisecs since the start of the animation */
1065 /* currentframe, currentlayer & currentplaytime indicate the current
1066    frame/layer/playtime(msecs) in the animation (these keep increasing;
1067    even after the animation loops back to the TERM chunk) */
1068 #if defined(MNG_SUPPORT_DISPLAY)
1069 MNG_EXT mng_uint32  MNG_DECL mng_get_starttime       (mng_handle        hHandle);
1070 MNG_EXT mng_uint32  MNG_DECL mng_get_runtime         (mng_handle        hHandle);
1071 MNG_EXT mng_uint32  MNG_DECL mng_get_currentframe    (mng_handle        hHandle);
1072 MNG_EXT mng_uint32  MNG_DECL mng_get_currentlayer    (mng_handle        hHandle);
1073 MNG_EXT mng_uint32  MNG_DECL mng_get_currentplaytime (mng_handle        hHandle);
1074 #endif
1075 
1076 /* Status variables */
1077 /* these indicate the internal state of the library */
1078 /* most indicate exactly what you would expect:
1079    status_error returns MNG_TRUE if the last function call returned an errorcode
1080    status_reading returns MNG_TRUE if the library is (still) reading an image
1081    status_suspendbreak returns MNG_TRUE if the library has suspended for "I/O"
1082    status_creating returns MNG_TRUE if the library is in the middle of creating an image
1083    status_writing returns MNG_TRUE if the library is in the middle of writing an image
1084    status_displaying returns MNG_TRUE if the library is displaying an image
1085    status_running returns MNG_TRUE if display processing is active (eg. not frozen or reset)
1086    status_timerbreak returns MNG_TRUE if the library has suspended for a "timer-break" */
1087 /* eg. mng_readdisplay() will turn the reading, displaying and running status on;
1088    when EOF is reached the reading status will be turned off */
1089 MNG_EXT mng_bool    MNG_DECL mng_status_error        (mng_handle        hHandle);
1090 #ifdef MNG_SUPPORT_READ
1091 MNG_EXT mng_bool    MNG_DECL mng_status_reading      (mng_handle        hHandle);
1092 MNG_EXT mng_bool    MNG_DECL mng_status_suspendbreak (mng_handle        hHandle);
1093 #endif
1094 #ifdef MNG_SUPPORT_WRITE
1095 MNG_EXT mng_bool    MNG_DECL mng_status_creating     (mng_handle        hHandle);
1096 MNG_EXT mng_bool    MNG_DECL mng_status_writing      (mng_handle        hHandle);
1097 #endif
1098 #ifdef MNG_SUPPORT_DISPLAY
1099 MNG_EXT mng_bool    MNG_DECL mng_status_displaying   (mng_handle        hHandle);
1100 MNG_EXT mng_bool    MNG_DECL mng_status_running      (mng_handle        hHandle);
1101 MNG_EXT mng_bool    MNG_DECL mng_status_timerbreak   (mng_handle        hHandle);
1102 #endif
1103 
1104 /* ************************************************************************** */
1105 /* *                                                                        * */
1106 /* *  Chunk access functions                                                * */
1107 /* *                                                                        * */
1108 /* ************************************************************************** */
1109 
1110 #ifdef MNG_ACCESS_CHUNKS
1111 
1112 /* ************************************************************************** */
1113 
1114 /* use this to iterate the stored chunks */
1115 /* requires MNG_ACCESS_CHUNKS & MNG_STORE_CHUNKS */
1116 /* starts from the supplied chunk-index-nr; the first chunk has index 0!! */
1117 MNG_EXT mng_retcode MNG_DECL mng_iterate_chunks      (mng_handle       hHandle,
1118                                                       mng_uint32       iChunkseq,
1119                                                       mng_iteratechunk fProc);
1120 
1121 /* ************************************************************************** */
1122 
1123 /* use these to get chunk data from within the callback in iterate_chunks */
1124 MNG_EXT mng_retcode MNG_DECL mng_getchunk_ihdr       (mng_handle       hHandle,
1125                                                       mng_handle       hChunk,
1126                                                       mng_uint32       *iWidth,
1127                                                       mng_uint32       *iHeight,
1128                                                       mng_uint8        *iBitdepth,
1129                                                       mng_uint8        *iColortype,
1130                                                       mng_uint8        *iCompression,
1131                                                       mng_uint8        *iFilter,
1132                                                       mng_uint8        *iInterlace);
1133 
1134 MNG_EXT mng_retcode MNG_DECL mng_getchunk_plte       (mng_handle       hHandle,
1135                                                       mng_handle       hChunk,
1136                                                       mng_uint32       *iCount,
1137                                                       mng_palette8     *aPalette);
1138 
1139 MNG_EXT mng_retcode MNG_DECL mng_getchunk_idat       (mng_handle       hHandle,
1140                                                       mng_handle       hChunk,
1141                                                       mng_uint32       *iRawlen,
1142                                                       mng_ptr          *pRawdata);
1143 
1144 MNG_EXT mng_retcode MNG_DECL mng_getchunk_trns       (mng_handle       hHandle,
1145                                                       mng_handle       hChunk,
1146                                                       mng_bool         *bEmpty,
1147                                                       mng_bool         *bGlobal,
1148                                                       mng_uint8        *iType,
1149                                                       mng_uint32       *iCount,
1150                                                       mng_uint8arr     *aAlphas,
1151                                                       mng_uint16       *iGray,
1152                                                       mng_uint16       *iRed,
1153                                                       mng_uint16       *iGreen,
1154                                                       mng_uint16       *iBlue,
1155                                                       mng_uint32       *iRawlen,
1156                                                       mng_uint8arr     *aRawdata);
1157 
1158 MNG_EXT mng_retcode MNG_DECL mng_getchunk_gama       (mng_handle       hHandle,
1159                                                       mng_handle       hChunk,
1160                                                       mng_bool         *bEmpty,
1161                                                       mng_uint32       *iGamma);
1162 
1163 MNG_EXT mng_retcode MNG_DECL mng_getchunk_chrm       (mng_handle       hHandle,
1164                                                       mng_handle       hChunk,
1165                                                       mng_bool         *bEmpty,
1166                                                       mng_uint32       *iWhitepointx,
1167                                                       mng_uint32       *iWhitepointy,
1168                                                       mng_uint32       *iRedx,
1169                                                       mng_uint32       *iRedy,
1170                                                       mng_uint32       *iGreenx,
1171                                                       mng_uint32       *iGreeny,
1172                                                       mng_uint32       *iBluex,
1173                                                       mng_uint32       *iBluey);
1174 
1175 MNG_EXT mng_retcode MNG_DECL mng_getchunk_srgb       (mng_handle       hHandle,
1176                                                       mng_handle       hChunk,
1177                                                       mng_bool         *bEmpty,
1178                                                       mng_uint8        *iRenderingintent);
1179 
1180 MNG_EXT mng_retcode MNG_DECL mng_getchunk_iccp       (mng_handle       hHandle,
1181                                                       mng_handle       hChunk,
1182                                                       mng_bool         *bEmpty,
1183                                                       mng_uint32       *iNamesize,
1184                                                       mng_pchar        *zName,
1185                                                       mng_uint8        *iCompression,
1186                                                       mng_uint32       *iProfilesize,
1187                                                       mng_ptr          *pProfile);
1188 
1189 MNG_EXT mng_retcode MNG_DECL mng_getchunk_text       (mng_handle       hHandle,
1190                                                       mng_handle       hChunk,
1191                                                       mng_uint32       *iKeywordsize,
1192                                                       mng_pchar        *zKeyword,
1193                                                       mng_uint32       *iTextsize,
1194                                                       mng_pchar        *zText);
1195 
1196 MNG_EXT mng_retcode MNG_DECL mng_getchunk_ztxt       (mng_handle       hHandle,
1197                                                       mng_handle       hChunk,
1198                                                       mng_uint32       *iKeywordsize,
1199                                                       mng_pchar        *zKeyword,
1200                                                       mng_uint8        *iCompression,
1201                                                       mng_uint32       *iTextsize,
1202                                                       mng_pchar        *zText);
1203 
1204 MNG_EXT mng_retcode MNG_DECL mng_getchunk_itxt       (mng_handle       hHandle,
1205                                                       mng_handle       hChunk,
1206                                                       mng_uint32       *iKeywordsize,
1207                                                       mng_pchar        *zKeyword,
1208                                                       mng_uint8        *iCompressionflag,
1209                                                       mng_uint8        *iCompressionmethod,
1210                                                       mng_uint32       *iLanguagesize,
1211                                                       mng_pchar        *zLanguage,
1212                                                       mng_uint32       *iTranslationsize,
1213                                                       mng_pchar        *zTranslation,
1214                                                       mng_uint32       *iTextsize,
1215                                                       mng_pchar        *zText);
1216 
1217 MNG_EXT mng_retcode MNG_DECL mng_getchunk_bkgd       (mng_handle       hHandle,
1218                                                       mng_handle       hChunk,
1219                                                       mng_bool         *bEmpty,
1220                                                       mng_uint8        *iType,
1221                                                       mng_uint8        *iIndex,
1222                                                       mng_uint16       *iGray,
1223                                                       mng_uint16       *iRed,
1224                                                       mng_uint16       *iGreen,
1225                                                       mng_uint16       *iBlue);
1226 
1227 MNG_EXT mng_retcode MNG_DECL mng_getchunk_phys       (mng_handle       hHandle,
1228                                                       mng_handle       hChunk,
1229                                                       mng_bool         *bEmpty,
1230                                                       mng_uint32       *iSizex,
1231                                                       mng_uint32       *iSizey,
1232                                                       mng_uint8        *iUnit);
1233 
1234 MNG_EXT mng_retcode MNG_DECL mng_getchunk_sbit       (mng_handle       hHandle,
1235                                                       mng_handle       hChunk,
1236                                                       mng_bool         *bEmpty,
1237                                                       mng_uint8        *iType,
1238                                                       mng_uint8arr4    *aBits);
1239 
1240 MNG_EXT mng_retcode MNG_DECL mng_getchunk_splt       (mng_handle       hHandle,
1241                                                       mng_handle       hChunk,
1242                                                       mng_bool         *bEmpty,
1243                                                       mng_uint32       *iNamesize,
1244                                                       mng_pchar        *zName,
1245                                                       mng_uint8        *iSampledepth,
1246                                                       mng_uint32       *iEntrycount,
1247                                                       mng_ptr          *pEntries);
1248 
1249 MNG_EXT mng_retcode MNG_DECL mng_getchunk_hist       (mng_handle       hHandle,
1250                                                       mng_handle       hChunk,
1251                                                       mng_uint32       *iEntrycount,
1252                                                       mng_uint16arr    *aEntries);
1253 
1254 MNG_EXT mng_retcode MNG_DECL mng_getchunk_time       (mng_handle       hHandle,
1255                                                       mng_handle       hChunk,
1256                                                       mng_uint16       *iYear,
1257                                                       mng_uint8        *iMonth,
1258                                                       mng_uint8        *iDay,
1259                                                       mng_uint8        *iHour,
1260                                                       mng_uint8        *iMinute,
1261                                                       mng_uint8        *iSecond);
1262 
1263 MNG_EXT mng_retcode MNG_DECL mng_getchunk_mhdr       (mng_handle       hHandle,
1264                                                       mng_handle       hChunk,
1265                                                       mng_uint32       *iWidth,
1266                                                       mng_uint32       *iHeight,
1267                                                       mng_uint32       *iTicks,
1268                                                       mng_uint32       *iLayercount,
1269                                                       mng_uint32       *iFramecount,
1270                                                       mng_uint32       *iPlaytime,
1271                                                       mng_uint32       *iSimplicity);
1272 
1273 MNG_EXT mng_retcode MNG_DECL mng_getchunk_loop       (mng_handle       hHandle,
1274                                                       mng_handle       hChunk,
1275                                                       mng_uint8        *iLevel,
1276                                                       mng_uint32       *iRepeat,
1277                                                       mng_uint8        *iTermination,
1278                                                       mng_uint32       *iItermin,
1279                                                       mng_uint32       *iItermax,
1280                                                       mng_uint32       *iCount,
1281                                                       mng_uint32p      *pSignals);
1282 
1283 MNG_EXT mng_retcode MNG_DECL mng_getchunk_endl       (mng_handle       hHandle,
1284                                                       mng_handle       hChunk,
1285                                                       mng_uint8        *iLevel);
1286 
1287 MNG_EXT mng_retcode MNG_DECL mng_getchunk_defi       (mng_handle       hHandle,
1288                                                       mng_handle       hChunk,
1289                                                       mng_uint16       *iObjectid,
1290                                                       mng_uint8        *iDonotshow,
1291                                                       mng_uint8        *iConcrete,
1292                                                       mng_bool         *bHasloca,
1293                                                       mng_int32        *iXlocation,
1294                                                       mng_int32        *iYlocation,
1295                                                       mng_bool         *bHasclip,
1296                                                       mng_int32        *iLeftcb,
1297                                                       mng_int32        *iRightcb,
1298                                                       mng_int32        *iTopcb,
1299                                                       mng_int32        *iBottomcb);
1300 
1301 MNG_EXT mng_retcode MNG_DECL mng_getchunk_basi       (mng_handle       hHandle,
1302                                                       mng_handle       hChunk,
1303                                                       mng_uint32       *iWidth,
1304                                                       mng_uint32       *iHeight,
1305                                                       mng_uint8        *iBitdepth,
1306                                                       mng_uint8        *iColortype,
1307                                                       mng_uint8        *iCompression,
1308                                                       mng_uint8        *iFilter,
1309                                                       mng_uint8        *iInterlace,
1310                                                       mng_uint16       *iRed,
1311                                                       mng_uint16       *iGreen,
1312                                                       mng_uint16       *iBlue,
1313                                                       mng_uint16       *iAlpha,
1314                                                       mng_uint8        *iViewable);
1315 
1316 MNG_EXT mng_retcode MNG_DECL mng_getchunk_clon       (mng_handle       hHandle,
1317                                                       mng_handle       hChunk,
1318                                                       mng_uint16       *iSourceid,
1319                                                       mng_uint16       *iCloneid,
1320                                                       mng_uint8        *iClonetype,
1321                                                       mng_uint8        *iDonotshow,
1322                                                       mng_uint8        *iConcrete,
1323                                                       mng_bool         *bHasloca,
1324                                                       mng_uint8        *iLocationtype,
1325                                                       mng_int32        *iLocationx,
1326                                                       mng_int32        *iLocationy);
1327 
1328 MNG_EXT mng_retcode MNG_DECL mng_getchunk_past       (mng_handle       hHandle,
1329                                                       mng_handle       hChunk,
1330                                                       mng_uint16       *iDestid,
1331                                                       mng_uint8        *iTargettype,
1332                                                       mng_int32        *iTargetx,
1333                                                       mng_int32        *iTargety,
1334                                                       mng_uint32       *iCount);
1335 
1336 MNG_EXT mng_retcode MNG_DECL mng_getchunk_past_src   (mng_handle       hHandle,
1337                                                       mng_handle       hChunk,
1338                                                       mng_uint32       iEntry,
1339                                                       mng_uint16       *iSourceid,
1340                                                       mng_uint8        *iComposition,
1341                                                       mng_uint8        *iOrientation,
1342                                                       mng_uint8        *iOffsettype,
1343                                                       mng_int32        *iOffsetx,
1344                                                       mng_int32        *iOffsety,
1345                                                       mng_uint8        *iBoundarytype,
1346                                                       mng_int32        *iBoundaryl,
1347                                                       mng_int32        *iBoundaryr,
1348                                                       mng_int32        *iBoundaryt,
1349                                                       mng_int32        *iBoundaryb);
1350 
1351 MNG_EXT mng_retcode MNG_DECL mng_getchunk_disc       (mng_handle       hHandle,
1352                                                       mng_handle       hChunk,
1353                                                       mng_uint32       *iCount,
1354                                                       mng_uint16p      *pObjectids);
1355 
1356 MNG_EXT mng_retcode MNG_DECL mng_getchunk_back       (mng_handle       hHandle,
1357                                                       mng_handle       hChunk,
1358                                                       mng_uint16       *iRed,
1359                                                       mng_uint16       *iGreen,
1360                                                       mng_uint16       *iBlue,
1361                                                       mng_uint8        *iMandatory,
1362                                                       mng_uint16       *iImageid,
1363                                                       mng_uint8        *iTile);
1364 
1365 MNG_EXT mng_retcode MNG_DECL mng_getchunk_fram       (mng_handle       hHandle,
1366                                                       mng_handle       hChunk,
1367                                                       mng_bool         *bEmpty,
1368                                                       mng_uint8        *iMode,
1369                                                       mng_uint32       *iNamesize,
1370                                                       mng_pchar        *zName,
1371                                                       mng_uint8        *iChangedelay,
1372                                                       mng_uint8        *iChangetimeout,
1373                                                       mng_uint8        *iChangeclipping,
1374                                                       mng_uint8        *iChangesyncid,
1375                                                       mng_uint32       *iDelay,
1376                                                       mng_uint32       *iTimeout,
1377                                                       mng_uint8        *iBoundarytype,
1378                                                       mng_int32        *iBoundaryl,
1379                                                       mng_int32        *iBoundaryr,
1380                                                       mng_int32        *iBoundaryt,
1381                                                       mng_int32        *iBoundaryb,
1382                                                       mng_uint32       *iCount,
1383                                                       mng_uint32p      *pSyncids);
1384 
1385 MNG_EXT mng_retcode MNG_DECL mng_getchunk_move       (mng_handle       hHandle,
1386                                                       mng_handle       hChunk,
1387                                                       mng_uint16       *iFirstid,
1388                                                       mng_uint16       *iLastid,
1389                                                       mng_uint8        *iMovetype,
1390                                                       mng_int32        *iMovex,
1391                                                       mng_int32        *iMovey);
1392 
1393 MNG_EXT mng_retcode MNG_DECL mng_getchunk_clip       (mng_handle       hHandle,
1394                                                       mng_handle       hChunk,
1395                                                       mng_uint16       *iFirstid,
1396                                                       mng_uint16       *iLastid,
1397                                                       mng_uint8        *iCliptype,
1398                                                       mng_int32        *iClipl,
1399                                                       mng_int32        *iClipr,
1400                                                       mng_int32        *iClipt,
1401                                                       mng_int32        *iClipb);
1402 
1403 MNG_EXT mng_retcode MNG_DECL mng_getchunk_show       (mng_handle       hHandle,
1404                                                       mng_handle       hChunk,
1405                                                       mng_bool         *bEmpty,
1406                                                       mng_uint16       *iFirstid,
1407                                                       mng_uint16       *iLastid,
1408                                                       mng_uint8        *iMode);
1409 
1410 MNG_EXT mng_retcode MNG_DECL mng_getchunk_term       (mng_handle       hHandle,
1411                                                       mng_handle       hChunk,
1412                                                       mng_uint8        *iTermaction,
1413                                                       mng_uint8        *iIteraction,
1414                                                       mng_uint32       *iDelay,
1415                                                       mng_uint32       *iItermax);
1416 
1417 MNG_EXT mng_retcode MNG_DECL mng_getchunk_save       (mng_handle       hHandle,
1418                                                       mng_handle       hChunk,
1419                                                       mng_bool         *bEmpty,
1420                                                       mng_uint8        *iOffsettype,
1421                                                       mng_uint32       *iCount);
1422 
1423 MNG_EXT mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle       hHandle,
1424                                                       mng_handle       hChunk,
1425                                                       mng_uint32       iEntry,
1426                                                       mng_uint8        *iEntrytype,
1427                                                       mng_uint32arr2   *iOffset,
1428                                                       mng_uint32arr2   *iStarttime,
1429                                                       mng_uint32       *iLayernr,
1430                                                       mng_uint32       *iFramenr,
1431                                                       mng_uint32       *iNamesize,
1432                                                       mng_pchar        *zName);
1433 
1434 MNG_EXT mng_retcode MNG_DECL mng_getchunk_seek       (mng_handle       hHandle,
1435                                                       mng_handle       hChunk,
1436                                                       mng_uint32       *iNamesize,
1437                                                       mng_pchar        *zName);
1438 
1439 MNG_EXT mng_retcode MNG_DECL mng_getchunk_expi       (mng_handle       hHandle,
1440                                                       mng_handle       hChunk,
1441                                                       mng_uint16       *iSnapshotid,
1442                                                       mng_uint32       *iNamesize,
1443                                                       mng_pchar        *zName);
1444 
1445 MNG_EXT mng_retcode MNG_DECL mng_getchunk_fpri       (mng_handle       hHandle,
1446                                                       mng_handle       hChunk,
1447                                                       mng_uint8        *iDeltatype,
1448                                                       mng_uint8        *iPriority);
1449 
1450 MNG_EXT mng_retcode MNG_DECL mng_getchunk_need       (mng_handle       hHandle,
1451                                                       mng_handle       hChunk,
1452                                                       mng_uint32       *iKeywordssize,
1453                                                       mng_pchar        *zKeywords);
1454 
1455 MNG_EXT mng_retcode MNG_DECL mng_getchunk_phyg       (mng_handle       hHandle,
1456                                                       mng_handle       hChunk,
1457                                                       mng_bool         *bEmpty,
1458                                                       mng_uint32       *iSizex,
1459                                                       mng_uint32       *iSizey,
1460                                                       mng_uint8        *iUnit);
1461 
1462 MNG_EXT mng_retcode MNG_DECL mng_getchunk_jhdr       (mng_handle       hHandle,
1463                                                       mng_handle       hChunk,
1464                                                       mng_uint32       *iWidth,
1465                                                       mng_uint32       *iHeight,
1466                                                       mng_uint8        *iColortype,
1467                                                       mng_uint8        *iImagesampledepth,
1468                                                       mng_uint8        *iImagecompression,
1469                                                       mng_uint8        *iImageinterlace,
1470                                                       mng_uint8        *iAlphasampledepth,
1471                                                       mng_uint8        *iAlphacompression,
1472                                                       mng_uint8        *iAlphafilter,
1473                                                       mng_uint8        *iAlphainterlace);
1474 
1475 MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdat       (mng_handle       hHandle,
1476                                                       mng_handle       hChunk,
1477                                                       mng_uint32       *iRawlen,
1478                                                       mng_ptr          *pRawdata);
1479 
1480 MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdaa       (mng_handle       hHandle,
1481                                                       mng_handle       hChunk,
1482                                                       mng_uint32       *iRawlen,
1483                                                       mng_ptr          *pRawdata);
1484 
1485 MNG_EXT mng_retcode MNG_DECL mng_getchunk_dhdr       (mng_handle       hHandle,
1486                                                       mng_handle       hChunk,
1487                                                       mng_uint16       *iObjectid,
1488                                                       mng_uint8        *iImagetype,
1489                                                       mng_uint8        *iDeltatype,
1490                                                       mng_uint32       *iBlockwidth,
1491                                                       mng_uint32       *iBlockheight,
1492                                                       mng_uint32       *iBlockx,
1493                                                       mng_uint32       *iBlocky);
1494 
1495 MNG_EXT mng_retcode MNG_DECL mng_getchunk_prom       (mng_handle       hHandle,
1496                                                       mng_handle       hChunk,
1497                                                       mng_uint8        *iColortype,
1498                                                       mng_uint8        *iSampledepth,
1499                                                       mng_uint8        *iFilltype);
1500 
1501 MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt       (mng_handle       hHandle,
1502                                                       mng_handle       hChunk,
1503                                                       mng_uint32       *iCount);
1504 
1505 MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle       hHandle,
1506                                                       mng_handle       hChunk,
1507                                                       mng_uint32       iEntry,
1508                                                       mng_uint16       *iRed,
1509                                                       mng_uint16       *iGreen,
1510                                                       mng_uint16       *iBlue,
1511                                                       mng_uint16       *iAlpha,
1512                                                       mng_bool         *bUsed);
1513 
1514 MNG_EXT mng_retcode MNG_DECL mng_getchunk_drop       (mng_handle       hHandle,
1515                                                       mng_handle       hChunk,
1516                                                       mng_uint32       *iCount,
1517                                                       mng_chunkidp     *pChunknames);
1518 
1519 MNG_EXT mng_retcode MNG_DECL mng_getchunk_dbyk       (mng_handle       hHandle,
1520                                                       mng_handle       hChunk,
1521                                                       mng_chunkid      *iChunkname,
1522                                                       mng_uint8        *iPolarity,
1523                                                       mng_uint32       *iKeywordssize,
1524                                                       mng_pchar        *zKeywords);
1525 
1526 MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr       (mng_handle       hHandle,
1527                                                       mng_handle       hChunk,
1528                                                       mng_uint32       *iCount);
1529 
1530 MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle       hHandle,
1531                                                       mng_handle       hChunk,
1532                                                       mng_uint32       iEntry,
1533                                                       mng_chunkid      *iChunkname,
1534                                                       mng_uint8        *iOrdertype);
1535 
1536 MNG_EXT mng_retcode MNG_DECL mng_getchunk_magn       (mng_handle       hHandle,
1537                                                       mng_handle       hChunk,
1538                                                       mng_uint16       *iFirstid,
1539                                                       mng_uint16       *iLastid,
1540                                                       mng_uint16       *iMethodX,
1541                                                       mng_uint16       *iMX,
1542                                                       mng_uint16       *iMY,
1543                                                       mng_uint16       *iML,
1544                                                       mng_uint16       *iMR,
1545                                                       mng_uint16       *iMT,
1546                                                       mng_uint16       *iMB,
1547                                                       mng_uint16       *iMethodY);
1548 
1549 MNG_EXT mng_retcode MNG_DECL mng_getchunk_unknown    (mng_handle       hHandle,
1550                                                       mng_handle       hChunk,
1551                                                       mng_chunkid      *iChunkname,
1552                                                       mng_uint32       *iRawlen,
1553                                                       mng_ptr          *pRawdata);
1554 
1555 /* ************************************************************************** */
1556 
1557 #ifdef MNG_INCLUDE_WRITE_PROCS
1558 
1559 /* use these to create new chunks at the end of the chunk-list */
1560 /* requires at least MNG_ACCESS_CHUNKS (MNG_SUPPORT_WRITE may be nice too) */
1561 MNG_EXT mng_retcode MNG_DECL mng_putchunk_ihdr       (mng_handle       hHandle,
1562                                                       mng_uint32       iWidth,
1563                                                       mng_uint32       iHeight,
1564                                                       mng_uint8        iBitdepth,
1565                                                       mng_uint8        iColortype,
1566                                                       mng_uint8        iCompression,
1567                                                       mng_uint8        iFilter,
1568                                                       mng_uint8        iInterlace);
1569 
1570 MNG_EXT mng_retcode MNG_DECL mng_putchunk_plte       (mng_handle       hHandle,
1571                                                       mng_uint32       iCount,
1572                                                       mng_palette8     aPalette);
1573 
1574 MNG_EXT mng_retcode MNG_DECL mng_putchunk_idat       (mng_handle       hHandle,
1575                                                       mng_uint32       iRawlen,
1576                                                       mng_ptr          pRawdata);
1577 
1578 MNG_EXT mng_retcode MNG_DECL mng_putchunk_iend       (mng_handle       hHandle);
1579 
1580 MNG_EXT mng_retcode MNG_DECL mng_putchunk_trns       (mng_handle       hHandle,
1581                                                       mng_bool         bEmpty,
1582                                                       mng_bool         bGlobal,
1583                                                       mng_uint8        iType,
1584                                                       mng_uint32       iCount,
1585                                                       mng_uint8arr     aAlphas,
1586                                                       mng_uint16       iGray,
1587                                                       mng_uint16       iRed,
1588                                                       mng_uint16       iGreen,
1589                                                       mng_uint16       iBlue,
1590                                                       mng_uint32       iRawlen,
1591                                                       mng_uint8arr     aRawdata);
1592 
1593 MNG_EXT mng_retcode MNG_DECL mng_putchunk_gama       (mng_handle       hHandle,
1594                                                       mng_bool         bEmpty,
1595                                                       mng_uint32       iGamma);
1596 
1597 MNG_EXT mng_retcode MNG_DECL mng_putchunk_chrm       (mng_handle       hHandle,
1598                                                       mng_bool         bEmpty,
1599                                                       mng_uint32       iWhitepointx,
1600                                                       mng_uint32       iWhitepointy,
1601                                                       mng_uint32       iRedx,
1602                                                       mng_uint32       iRedy,
1603                                                       mng_uint32       iGreenx,
1604                                                       mng_uint32       iGreeny,
1605                                                       mng_uint32       iBluex,
1606                                                       mng_uint32       iBluey);
1607 
1608 MNG_EXT mng_retcode MNG_DECL mng_putchunk_srgb       (mng_handle       hHandle,
1609                                                       mng_bool         bEmpty,
1610                                                       mng_uint8        iRenderingintent);
1611 
1612 MNG_EXT mng_retcode MNG_DECL mng_putchunk_iccp       (mng_handle       hHandle,
1613                                                       mng_bool         bEmpty,
1614                                                       mng_uint32       iNamesize,
1615                                                       mng_pchar        zName,
1616                                                       mng_uint8        iCompression,
1617                                                       mng_uint32       iProfilesize,
1618                                                       mng_ptr          pProfile);
1619 
1620 MNG_EXT mng_retcode MNG_DECL mng_putchunk_text       (mng_handle       hHandle,
1621                                                       mng_uint32       iKeywordsize,
1622                                                       mng_pchar        zKeyword,
1623                                                       mng_uint32       iTextsize,
1624                                                       mng_pchar        zText);
1625 
1626 MNG_EXT mng_retcode MNG_DECL mng_putchunk_ztxt       (mng_handle       hHandle,
1627                                                       mng_uint32       iKeywordsize,
1628                                                       mng_pchar        zKeyword,
1629                                                       mng_uint8        iCompression,
1630                                                       mng_uint32       iTextsize,
1631                                                       mng_pchar        zText);
1632 
1633 MNG_EXT mng_retcode MNG_DECL mng_putchunk_itxt       (mng_handle       hHandle,
1634                                                       mng_uint32       iKeywordsize,
1635                                                       mng_pchar        zKeyword,
1636                                                       mng_uint8        iCompressionflag,
1637                                                       mng_uint8        iCompressionmethod,
1638                                                       mng_uint32       iLanguagesize,
1639                                                       mng_pchar        zLanguage,
1640                                                       mng_uint32       iTranslationsize,
1641                                                       mng_pchar        zTranslation,
1642                                                       mng_uint32       iTextsize,
1643                                                       mng_pchar        zText);
1644 
1645 MNG_EXT mng_retcode MNG_DECL mng_putchunk_bkgd       (mng_handle       hHandle,
1646                                                       mng_bool         bEmpty,
1647                                                       mng_uint8        iType,
1648                                                       mng_uint8        iIndex,
1649                                                       mng_uint16       iGray,
1650                                                       mng_uint16       iRed,
1651                                                       mng_uint16       iGreen,
1652                                                       mng_uint16       iBlue);
1653 
1654 MNG_EXT mng_retcode MNG_DECL mng_putchunk_phys       (mng_handle       hHandle,
1655                                                       mng_bool         bEmpty,
1656                                                       mng_uint32       iSizex,
1657                                                       mng_uint32       iSizey,
1658                                                       mng_uint8        iUnit);
1659 
1660 MNG_EXT mng_retcode MNG_DECL mng_putchunk_sbit       (mng_handle       hHandle,
1661                                                       mng_bool         bEmpty,
1662                                                       mng_uint8        iType,
1663                                                       mng_uint8arr4    aBits);
1664 
1665 MNG_EXT mng_retcode MNG_DECL mng_putchunk_splt       (mng_handle       hHandle,
1666                                                       mng_bool         bEmpty,
1667                                                       mng_uint32       iNamesize,
1668                                                       mng_pchar        zName,
1669                                                       mng_uint8        iSampledepth,
1670                                                       mng_uint32       iEntrycount,
1671                                                       mng_ptr          pEntries);
1672 
1673 MNG_EXT mng_retcode MNG_DECL mng_putchunk_hist       (mng_handle       hHandle,
1674                                                       mng_uint32       iEntrycount,
1675                                                       mng_uint16arr    aEntries);
1676 
1677 MNG_EXT mng_retcode MNG_DECL mng_putchunk_time       (mng_handle       hHandle,
1678                                                       mng_uint16       iYear,
1679                                                       mng_uint8        iMonth,
1680                                                       mng_uint8        iDay,
1681                                                       mng_uint8        iHour,
1682                                                       mng_uint8        iMinute,
1683                                                       mng_uint8        iSecond);
1684 
1685 MNG_EXT mng_retcode MNG_DECL mng_putchunk_mhdr       (mng_handle       hHandle,
1686                                                       mng_uint32       iWidth,
1687                                                       mng_uint32       iHeight,
1688                                                       mng_uint32       iTicks,
1689                                                       mng_uint32       iLayercount,
1690                                                       mng_uint32       iFramecount,
1691                                                       mng_uint32       iPlaytime,
1692                                                       mng_uint32       iSimplicity);
1693 
1694 MNG_EXT mng_retcode MNG_DECL mng_putchunk_mend       (mng_handle       hHandle);
1695 
1696 MNG_EXT mng_retcode MNG_DECL mng_putchunk_loop       (mng_handle       hHandle,
1697                                                       mng_uint8        iLevel,
1698                                                       mng_uint32       iRepeat,
1699                                                       mng_uint8        iTermination,
1700                                                       mng_uint32       iItermin,
1701                                                       mng_uint32       iItermax,
1702                                                       mng_uint32       iCount,
1703                                                       mng_uint32p      pSignals);
1704 
1705 MNG_EXT mng_retcode MNG_DECL mng_putchunk_endl       (mng_handle       hHandle,
1706                                                       mng_uint8        iLevel);
1707 
1708 MNG_EXT mng_retcode MNG_DECL mng_putchunk_defi       (mng_handle       hHandle,
1709                                                       mng_uint16       iObjectid,
1710                                                       mng_uint8        iDonotshow,
1711                                                       mng_uint8        iConcrete,
1712                                                       mng_bool         bHasloca,
1713                                                       mng_int32        iXlocation,
1714                                                       mng_int32        iYlocation,
1715                                                       mng_bool         bHasclip,
1716                                                       mng_int32        iLeftcb,
1717                                                       mng_int32        iRightcb,
1718                                                       mng_int32        iTopcb,
1719                                                       mng_int32        iBottomcb);
1720 
1721 MNG_EXT mng_retcode MNG_DECL mng_putchunk_basi       (mng_handle       hHandle,
1722                                                       mng_uint32       iWidth,
1723                                                       mng_uint32       iHeight,
1724                                                       mng_uint8        iBitdepth,
1725                                                       mng_uint8        iColortype,
1726                                                       mng_uint8        iCompression,
1727                                                       mng_uint8        iFilter,
1728                                                       mng_uint8        iInterlace,
1729                                                       mng_uint16       iRed,
1730                                                       mng_uint16       iGreen,
1731                                                       mng_uint16       iBlue,
1732                                                       mng_uint16       iAlpha,
1733                                                       mng_uint8        iViewable);
1734 
1735 MNG_EXT mng_retcode MNG_DECL mng_putchunk_clon       (mng_handle       hHandle,
1736                                                       mng_uint16       iSourceid,
1737                                                       mng_uint16       iCloneid,
1738                                                       mng_uint8        iClonetype,
1739                                                       mng_uint8        iDonotshow,
1740                                                       mng_uint8        iConcrete,
1741                                                       mng_bool         bHasloca,
1742                                                       mng_uint8        iLocationtype,
1743                                                       mng_int32        iLocationx,
1744                                                       mng_int32        iLocationy);
1745 
1746 MNG_EXT mng_retcode MNG_DECL mng_putchunk_past       (mng_handle       hHandle,
1747                                                       mng_uint16       iDestid,
1748                                                       mng_uint8        iTargettype,
1749                                                       mng_int32        iTargetx,
1750                                                       mng_int32        iTargety,
1751                                                       mng_uint32       iCount);
1752 
1753 MNG_EXT mng_retcode MNG_DECL mng_putchunk_past_src   (mng_handle       hHandle,
1754                                                       mng_uint32       iEntry,
1755                                                       mng_uint16       iSourceid,
1756                                                       mng_uint8        iComposition,
1757                                                       mng_uint8        iOrientation,
1758                                                       mng_uint8        iOffsettype,
1759                                                       mng_int32        iOffsetx,
1760                                                       mng_int32        iOffsety,
1761                                                       mng_uint8        iBoundarytype,
1762                                                       mng_int32        iBoundaryl,
1763                                                       mng_int32        iBoundaryr,
1764                                                       mng_int32        iBoundaryt,
1765                                                       mng_int32        iBoundaryb);
1766 
1767 MNG_EXT mng_retcode MNG_DECL mng_putchunk_disc       (mng_handle       hHandle,
1768                                                       mng_uint32       iCount,
1769                                                       mng_uint16p      pObjectids);
1770 
1771 MNG_EXT mng_retcode MNG_DECL mng_putchunk_back       (mng_handle       hHandle,
1772                                                       mng_uint16       iRed,
1773                                                       mng_uint16       iGreen,
1774                                                       mng_uint16       iBlue,
1775                                                       mng_uint8        iMandatory,
1776                                                       mng_uint16       iImageid,
1777                                                       mng_uint8        iTile);
1778 
1779 MNG_EXT mng_retcode MNG_DECL mng_putchunk_fram       (mng_handle       hHandle,
1780                                                       mng_bool         bEmpty,
1781                                                       mng_uint8        iMode,
1782                                                       mng_uint32       iNamesize,
1783                                                       mng_pchar        zName,
1784                                                       mng_uint8        iChangedelay,
1785                                                       mng_uint8        iChangetimeout,
1786                                                       mng_uint8        iChangeclipping,
1787                                                       mng_uint8        iChangesyncid,
1788                                                       mng_uint32       iDelay,
1789                                                       mng_uint32       iTimeout,
1790                                                       mng_uint8        iBoundarytype,
1791                                                       mng_int32        iBoundaryl,
1792                                                       mng_int32        iBoundaryr,
1793                                                       mng_int32        iBoundaryt,
1794                                                       mng_int32        iBoundaryb,
1795                                                       mng_uint32       iCount,
1796                                                       mng_uint32p      pSyncids);
1797 
1798 MNG_EXT mng_retcode MNG_DECL mng_putchunk_move       (mng_handle       hHandle,
1799                                                       mng_uint16       iFirstid,
1800                                                       mng_uint16       iLastid,
1801                                                       mng_uint8        iMovetype,
1802                                                       mng_int32        iMovex,
1803                                                       mng_int32        iMovey);
1804 
1805 MNG_EXT mng_retcode MNG_DECL mng_putchunk_clip       (mng_handle       hHandle,
1806                                                       mng_uint16       iFirstid,
1807                                                       mng_uint16       iLastid,
1808                                                       mng_uint8        iCliptype,
1809                                                       mng_int32        iClipl,
1810                                                       mng_int32        iClipr,
1811                                                       mng_int32        iClipt,
1812                                                       mng_int32        iClipb);
1813 
1814 MNG_EXT mng_retcode MNG_DECL mng_putchunk_show       (mng_handle       hHandle,
1815                                                       mng_bool         bEmpty,
1816                                                       mng_uint16       iFirstid,
1817                                                       mng_uint16       iLastid,
1818                                                       mng_uint8        iMode);
1819 
1820 MNG_EXT mng_retcode MNG_DECL mng_putchunk_term       (mng_handle       hHandle,
1821                                                       mng_uint8        iTermaction,
1822                                                       mng_uint8        iIteraction,
1823                                                       mng_uint32       iDelay,
1824                                                       mng_uint32       iItermax);
1825 
1826 MNG_EXT mng_retcode MNG_DECL mng_putchunk_save       (mng_handle       hHandle,
1827                                                       mng_bool         bEmpty,
1828                                                       mng_uint8        iOffsettype,
1829                                                       mng_uint32       iCount);
1830 
1831 MNG_EXT mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle       hHandle,
1832                                                       mng_uint32       iEntry,
1833                                                       mng_uint8        iEntrytype,
1834                                                       mng_uint32arr2   iOffset,
1835                                                       mng_uint32arr2   iStarttime,
1836                                                       mng_uint32       iLayernr,
1837                                                       mng_uint32       iFramenr,
1838                                                       mng_uint32       iNamesize,
1839                                                       mng_pchar        zName);
1840 
1841 MNG_EXT mng_retcode MNG_DECL mng_putchunk_seek       (mng_handle       hHandle,
1842                                                       mng_uint32       iNamesize,
1843                                                       mng_pchar        zName);
1844 
1845 MNG_EXT mng_retcode MNG_DECL mng_putchunk_expi       (mng_handle       hHandle,
1846                                                       mng_uint16       iSnapshotid,
1847                                                       mng_uint32       iNamesize,
1848                                                       mng_pchar        zName);
1849 
1850 MNG_EXT mng_retcode MNG_DECL mng_putchunk_fpri       (mng_handle       hHandle,
1851                                                       mng_uint8        iDeltatype,
1852                                                       mng_uint8        iPriority);
1853 
1854 MNG_EXT mng_retcode MNG_DECL mng_putchunk_need       (mng_handle       hHandle,
1855                                                       mng_uint32       iKeywordssize,
1856                                                       mng_pchar        zKeywords);
1857 
1858 MNG_EXT mng_retcode MNG_DECL mng_putchunk_phyg       (mng_handle       hHandle,
1859                                                       mng_bool         bEmpty,
1860                                                       mng_uint32       iSizex,
1861                                                       mng_uint32       iSizey,
1862                                                       mng_uint8        iUnit);
1863 
1864 MNG_EXT mng_retcode MNG_DECL mng_putchunk_jhdr       (mng_handle       hHandle,
1865                                                       mng_uint32       iWidth,
1866                                                       mng_uint32       iHeight,
1867                                                       mng_uint8        iColortype,
1868                                                       mng_uint8        iImagesampledepth,
1869                                                       mng_uint8        iImagecompression,
1870                                                       mng_uint8        iImageinterlace,
1871                                                       mng_uint8        iAlphasampledepth,
1872                                                       mng_uint8        iAlphacompression,
1873                                                       mng_uint8        iAlphafilter,
1874                                                       mng_uint8        iAlphainterlace);
1875 
1876 MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdat       (mng_handle       hHandle,
1877                                                       mng_uint32       iRawlen,
1878                                                       mng_ptr          pRawdata);
1879 
1880 MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdaa       (mng_handle       hHandle,
1881                                                       mng_uint32       iRawlen,
1882                                                       mng_ptr          pRawdata);
1883 
1884 MNG_EXT mng_retcode MNG_DECL mng_putchunk_jsep       (mng_handle       hHandle);
1885 
1886 MNG_EXT mng_retcode MNG_DECL mng_putchunk_dhdr       (mng_handle       hHandle,
1887                                                       mng_uint16       iObjectid,
1888                                                       mng_uint8        iImagetype,
1889                                                       mng_uint8        iDeltatype,
1890                                                       mng_uint32       iBlockwidth,
1891                                                       mng_uint32       iBlockheight,
1892                                                       mng_uint32       iBlockx,
1893                                                       mng_uint32       iBlocky);
1894 
1895 MNG_EXT mng_retcode MNG_DECL mng_putchunk_prom       (mng_handle       hHandle,
1896                                                       mng_uint8        iColortype,
1897                                                       mng_uint8        iSampledepth,
1898                                                       mng_uint8        iFilltype);
1899 
1900 MNG_EXT mng_retcode MNG_DECL mng_putchunk_ipng       (mng_handle       hHandle);
1901 
1902 MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt       (mng_handle       hHandle,
1903                                                       mng_uint32       iCount);
1904 
1905 MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle       hHandle,
1906                                                       mng_uint32       iEntry,
1907                                                       mng_uint16       iRed,
1908                                                       mng_uint16       iGreen,
1909                                                       mng_uint16       iBlue,
1910                                                       mng_uint16       iAlpha,
1911                                                       mng_bool         bUsed);
1912 
1913 MNG_EXT mng_retcode MNG_DECL mng_putchunk_jpng       (mng_handle       hHandle);
1914 
1915 MNG_EXT mng_retcode MNG_DECL mng_putchunk_drop       (mng_handle       hHandle,
1916                                                       mng_uint32       iCount,
1917                                                       mng_chunkidp     pChunknames);
1918 
1919 MNG_EXT mng_retcode MNG_DECL mng_putchunk_dbyk       (mng_handle       hHandle,
1920                                                       mng_chunkid      iChunkname,
1921                                                       mng_uint8        iPolarity,
1922                                                       mng_uint32       iKeywordssize,
1923                                                       mng_pchar        zKeywords);
1924 
1925 MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr       (mng_handle       hHandle,
1926                                                       mng_uint32       iCount);
1927 
1928 MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle       hHandle,
1929                                                       mng_uint32       iEntry,
1930                                                       mng_chunkid      iChunkname,
1931                                                       mng_uint8        iOrdertype);
1932 
1933 MNG_EXT mng_retcode MNG_DECL mng_putchunk_magn       (mng_handle       hHandle,
1934                                                       mng_uint16       iFirstid,
1935                                                       mng_uint16       iLastid,
1936                                                       mng_uint16       iMethodX,
1937                                                       mng_uint16       iMX,
1938                                                       mng_uint16       iMY,
1939                                                       mng_uint16       iML,
1940                                                       mng_uint16       iMR,
1941                                                       mng_uint16       iMT,
1942                                                       mng_uint16       iMB,
1943                                                       mng_uint16       iMethodY);
1944 
1945 MNG_EXT mng_retcode MNG_DECL mng_putchunk_unknown    (mng_handle       hHandle,
1946                                                       mng_chunkid      iChunkname,
1947                                                       mng_uint32       iRawlen,
1948                                                       mng_ptr          pRawdata);
1949 
1950 #endif /* MNG_INCLUDE_WRITE_PROCS */
1951 
1952 /* ************************************************************************** */
1953 
1954 /* use these functions to access the actual image-data in stored chunks,
1955    as opposed to the IDAT/JDAT data */
1956 /* to get accurate pixel-data the canvasstyle should seriously reflect the
1957    bitdepth/colortype combination of the preceding IHDR/JHDR/BASI/DHDR;
1958    all input can be converted to rgb(a)8 (rgb(a)16 for 16-bit images), but
1959    there are only limited conversions back (see below for putimgdata)  */
1960 
1961 /* call this function if you want to extract the nth image from the list;
1962    the first image is designated seqnr 0! */
1963 /* this function finds the IHDR/JHDR/BASI/DHDR with the appropriate seqnr,
1964    starting from the beginning of the chunk-list; this may tend to get a little
1965    slow for animations with a large number of chunks for images near the end */
1966 /* supplying a seqnr past the last image in the animation will return with
1967    an errorcode */
1968 MNG_EXT mng_retcode MNG_DECL mng_getimgdata_seq      (mng_handle        hHandle,
1969                                                       mng_uint32        iSeqnr,
1970                                                       mng_uint32        iCanvasstyle,
1971                                                       mng_getcanvasline fGetcanvasline);
1972 
1973 /* both the following functions will search forward to find the first IDAT/JDAT,
1974    and then traverse back to find the start of the image (IHDR,JHDR,DHDR,BASI);
1975    note that this is very fast compared to decoding the IDAT/JDAT, so there's
1976    not really a need for optimization; either can be called from the
1977    iterate_chunks callback when a IHDR/JHDR is encountered; for BASI/DHDR there
1978    may not be real image-data so it's wisest to keep iterating till the IEND,
1979    and then call either of these functions if necessary (remember the correct seqnr!) */
1980 
1981 /* call this function if you want to extract the image starting at or after the nth
1982    position in the chunk-list; this number is returned in the iterate_chunks callback */
1983 MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle        hHandle,
1984                                                       mng_uint32        iSeqnr,
1985                                                       mng_uint32        iCanvasstyle,
1986                                                       mng_getcanvasline fGetcanvasline);
1987 
1988 /* call this function if you want to extract the image starting at or after the
1989    indicated chunk; the handle of a chunk is returned in the iterate_chunks callback */
1990 MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunk    (mng_handle        hHandle,
1991                                                       mng_handle        hChunk,
1992                                                       mng_uint32        iCanvasstyle,
1993                                                       mng_getcanvasline fGetcanvasline);
1994 
1995 /* ************************************************************************** */
1996 
1997 #ifdef MNG_INCLUDE_WRITE_PROCS
1998 
1999 /* use the following functions to add image-data to the list of stored chunks */
2000 /* note that this only adds the IDAT or JDAT chunks and no others; you must call
2001    one of these functions after you 'put' the initial chunks of the image and
2002    before you 'put' the closing chunks */
2003 /* the canvasstyle should seriously reflect the bitdepth/colortype combination;
2004    eg. bitdepth=16 would expect a 16-bit canvasstyle,
2005    colortype=g or ga would expect a gray or gray+alpha style respectively
2006    and so on, and so forth ...
2007    (nb. the number of conversions will be extremely limited for the moment!) */
2008 
2009 MNG_EXT mng_retcode MNG_DECL mng_putimgdata_ihdr     (mng_handle        hHandle,
2010                                                       mng_uint32        iWidth,
2011                                                       mng_uint32        iHeight,
2012                                                       mng_uint8         iColortype,
2013                                                       mng_uint8         iBitdepth,
2014                                                       mng_uint8         iCompression,
2015                                                       mng_uint8         iFilter,
2016                                                       mng_uint8         iInterlace,
2017                                                       mng_uint32        iCanvasstyle,
2018                                                       mng_getcanvasline fGetcanvasline);
2019 
2020 MNG_EXT mng_retcode MNG_DECL mng_putimgdata_jhdr     (mng_handle        hHandle,
2021                                                       mng_uint32        iWidth,
2022                                                       mng_uint32        iHeight,
2023                                                       mng_uint8         iColortype,
2024                                                       mng_uint8         iBitdepth,
2025                                                       mng_uint8         iCompression,
2026                                                       mng_uint8         iInterlace,
2027                                                       mng_uint8         iAlphaBitdepth,
2028                                                       mng_uint8         iAlphaCompression,
2029                                                       mng_uint8         iAlphaFilter,
2030                                                       mng_uint8         iAlphaInterlace,
2031                                                       mng_uint32        iCanvasstyle,
2032                                                       mng_getcanvasline fGetcanvasline);
2033 
2034 /* ************************************************************************** */
2035 
2036 /* use the following functions to set the framecount/layercount/playtime or
2037    simplicity of an animation you are creating; this may be useful if these
2038    variables are calculated during the creation-process */
2039 
2040 MNG_EXT mng_retcode MNG_DECL mng_updatemngheader     (mng_handle        hHandle,
2041                                                       mng_uint32        iFramecount,
2042                                                       mng_uint32        iLayercount,
2043                                                       mng_uint32        iPlaytime);
2044 
2045 MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle        hHandle,
2046                                                       mng_uint32        iSimplicity);
2047 
2048 /* ************************************************************************** */
2049 
2050 #endif /* MNG_INCLUDE_WRITE_PROCS */
2051 
2052 #endif /* MNG_ACCESS_CHUNKS */
2053 
2054 /* ************************************************************************** */
2055 /* *                                                                        * */
2056 /* * Error-code structure                                                   * */
2057 /* *                                                                        * */
2058 /* * 0b0000 00xx xxxx xxxx - basic errors; severity 9 (environment)         * */
2059 /* * 0b0000 01xx xxxx xxxx - chunk errors; severity 9 (image induced)       * */
2060 /* * 0b0000 10xx xxxx xxxx - severity 5 errors (application induced)        * */
2061 /* * 0b0001 00xx xxxx xxxx - severity 2 warnings (recoverable)              * */
2062 /* * 0b0010 00xx xxxx xxxx - severity 1 warnings (recoverable)              * */
2063 /* *                                                                        * */
2064 /* ************************************************************************** */
2065 
2066 #define MNG_NOERROR          (mng_retcode)0    /* er.. indicates all's well   */
2067 
2068 #define MNG_OUTOFMEMORY      (mng_retcode)1    /* oops, buy some megabytes!   */
2069 #define MNG_INVALIDHANDLE    (mng_retcode)2    /* call mng_initialize first   */
2070 #define MNG_NOCALLBACK       (mng_retcode)3    /* set the callbacks please    */
2071 #define MNG_UNEXPECTEDEOF    (mng_retcode)4    /* what'd ya do with the data? */
2072 #define MNG_ZLIBERROR        (mng_retcode)5    /* zlib burped                 */
2073 #define MNG_JPEGERROR        (mng_retcode)6    /* jpglib complained           */
2074 #define MNG_LCMSERROR        (mng_retcode)7    /* little cms stressed out     */
2075 #define MNG_NOOUTPUTPROFILE  (mng_retcode)8    /* no output-profile defined   */
2076 #define MNG_NOSRGBPROFILE    (mng_retcode)9    /* no sRGB-profile defined     */
2077 #define MNG_BUFOVERFLOW      (mng_retcode)10   /* zlib output-buffer overflow */
2078 #define MNG_FUNCTIONINVALID  (mng_retcode)11   /* ay, totally inappropriate   */
2079 #define MNG_OUTPUTERROR      (mng_retcode)12   /* disk full ?                 */
2080 #define MNG_JPEGBUFTOOSMALL  (mng_retcode)13   /* can't handle buffer overflow*/
2081 #define MNG_NEEDMOREDATA     (mng_retcode)14   /* I'm hungry, give me more    */
2082 #define MNG_NEEDTIMERWAIT    (mng_retcode)15   /* Sleep a while then wake me  */
2083 #define MNG_NEEDSECTIONWAIT  (mng_retcode)16   /* just processed a SEEK       */
2084 #define MNG_LOOPWITHCACHEOFF (mng_retcode)17   /* LOOP when playback info off */
2085 
2086 #define MNG_DLLNOTLOADED     (mng_retcode)99   /* late binding failed         */
2087 
2088 #define MNG_APPIOERROR       (mng_retcode)901  /* application I/O error       */
2089 #define MNG_APPTIMERERROR    (mng_retcode)902  /* application timing error    */
2090 #define MNG_APPCMSERROR      (mng_retcode)903  /* application CMS error       */
2091 #define MNG_APPMISCERROR     (mng_retcode)904  /* application other error     */
2092 #define MNG_APPTRACEABORT    (mng_retcode)905  /* application aborts on trace */
2093 
2094 #define MNG_INTERNALERROR    (mng_retcode)999  /* internal inconsistancy      */
2095 
2096 #define MNG_INVALIDSIG       (mng_retcode)1025 /* invalid graphics file       */
2097 #define MNG_INVALIDCRC       (mng_retcode)1027 /* crc check failed            */
2098 #define MNG_INVALIDLENGTH    (mng_retcode)1028 /* chunklength mystifies me    */
2099 #define MNG_SEQUENCEERROR    (mng_retcode)1029 /* invalid chunk sequence      */
2100 #define MNG_CHUNKNOTALLOWED  (mng_retcode)1030 /* completely out-of-place     */
2101 #define MNG_MULTIPLEERROR    (mng_retcode)1031 /* only one occurence allowed  */
2102 #define MNG_PLTEMISSING      (mng_retcode)1032 /* indexed-color requires PLTE */
2103 #define MNG_IDATMISSING      (mng_retcode)1033 /* IHDR-block requires IDAT    */
2104 #define MNG_CANNOTBEEMPTY    (mng_retcode)1034 /* must contain some data      */
2105 #define MNG_GLOBALLENGTHERR  (mng_retcode)1035 /* global data incorrect       */
2106 #define MNG_INVALIDBITDEPTH  (mng_retcode)1036 /* bitdepth out-of-range       */
2107 #define MNG_INVALIDCOLORTYPE (mng_retcode)1037 /* colortype out-of-range      */
2108 #define MNG_INVALIDCOMPRESS  (mng_retcode)1038 /* compression method invalid  */
2109 #define MNG_INVALIDFILTER    (mng_retcode)1039 /* filter method invalid       */
2110 #define MNG_INVALIDINTERLACE (mng_retcode)1040 /* interlace method invalid    */
2111 #define MNG_NOTENOUGHIDAT    (mng_retcode)1041 /* ran out of compressed data  */
2112 #define MNG_PLTEINDEXERROR   (mng_retcode)1042 /* palette-index out-of-range  */
2113 #define MNG_NULLNOTFOUND     (mng_retcode)1043 /* couldn't find null-separator*/
2114 #define MNG_KEYWORDNULL      (mng_retcode)1044 /* keyword cannot be empty     */
2115 #define MNG_OBJECTUNKNOWN    (mng_retcode)1045 /* the object can't be found   */
2116 #define MNG_OBJECTEXISTS     (mng_retcode)1046 /* the object already exists   */
2117 #define MNG_TOOMUCHIDAT      (mng_retcode)1047 /* got too much compressed data*/
2118 #define MNG_INVSAMPLEDEPTH   (mng_retcode)1048 /* sampledepth out-of-range    */
2119 #define MNG_INVOFFSETSIZE    (mng_retcode)1049 /* invalid offset-size         */
2120 #define MNG_INVENTRYTYPE     (mng_retcode)1050 /* invalid entry-type          */
2121 #define MNG_ENDWITHNULL      (mng_retcode)1051 /* may not end with NULL       */
2122 #define MNG_INVIMAGETYPE     (mng_retcode)1052 /* invalid image_type          */
2123 #define MNG_INVDELTATYPE     (mng_retcode)1053 /* invalid delta_type          */
2124 #define MNG_INVALIDINDEX     (mng_retcode)1054 /* index-value invalid         */
2125 #define MNG_TOOMUCHJDAT      (mng_retcode)1055 /* got too much compressed data*/
2126 #define MNG_JPEGPARMSERR     (mng_retcode)1056 /* JHDR/JPEG parms do not match*/
2127 #define MNG_INVFILLMETHOD    (mng_retcode)1057 /* invalid fill_method         */
2128 #define MNG_OBJNOTCONCRETE   (mng_retcode)1058 /* object must be concrete     */
2129 #define MNG_TARGETNOALPHA    (mng_retcode)1059 /* object has no alpha-channel */
2130 #define MNG_MNGTOOCOMPLEX    (mng_retcode)1060 /* can't handle complexity     */
2131 #define MNG_UNKNOWNCRITICAL  (mng_retcode)1061 /* unknown critical chunk found*/
2132 #define MNG_UNSUPPORTEDNEED  (mng_retcode)1062 /* nEED requirement unsupported*/
2133 #define MNG_INVALIDDELTA     (mng_retcode)1063 /* Delta operation illegal     */
2134 #define MNG_INVALIDMETHOD    (mng_retcode)1064 /* invalid MAGN method         */
2135 
2136 #define MNG_INVALIDCNVSTYLE  (mng_retcode)2049 /* can't make anything of this */
2137 #define MNG_WRONGCHUNK       (mng_retcode)2050 /* accessing the wrong chunk   */
2138 #define MNG_INVALIDENTRYIX   (mng_retcode)2051 /* accessing the wrong entry   */
2139 #define MNG_NOHEADER         (mng_retcode)2052 /* must have had header first  */
2140 #define MNG_NOCORRCHUNK      (mng_retcode)2053 /* can't find parent chunk     */
2141 #define MNG_NOMHDR           (mng_retcode)2054 /* no MNG header available     */
2142 
2143 #define MNG_IMAGETOOLARGE    (mng_retcode)4097 /* input-image way too big     */
2144 #define MNG_NOTANANIMATION   (mng_retcode)4098 /* file not a MNG              */
2145 #define MNG_FRAMENRTOOHIGH   (mng_retcode)4099 /* frame-nr out-of-range       */
2146 #define MNG_LAYERNRTOOHIGH   (mng_retcode)4100 /* layer-nr out-of-range       */
2147 #define MNG_PLAYTIMETOOHIGH  (mng_retcode)4101 /* playtime out-of-range       */
2148 #define MNG_FNNOTIMPLEMENTED (mng_retcode)4102 /* function not yet available  */
2149 
2150 #define MNG_IMAGEFROZEN      (mng_retcode)8193 /* stopped displaying          */
2151 
2152 #define MNG_LCMS_NOHANDLE    1                 /* LCMS returned NULL handle   */
2153 #define MNG_LCMS_NOMEM       2                 /* LCMS returned NULL gammatab */
2154 #define MNG_LCMS_NOTRANS     3                 /* LCMS returned NULL transform*/
2155 
2156 /* ************************************************************************** */
2157 /* *                                                                        * */
2158 /* *  Canvas styles                                                         * */
2159 /* *                                                                        * */
2160 /* *  Note that the intentions are pretty darn good, but that the focus     * */
2161 /* *  is currently on 8-bit color support                                   * */
2162 /* *                                                                        * */
2163 /* *  The RGB8_A8 style is defined for apps that require a separate         * */
2164 /* *  canvas for the color-planes and the alpha-plane (eg. mozilla)         * */
2165 /* *  This requires for the app to supply the "getalphaline" callback!!!    * */
2166 /* *                                                                        * */
2167 /* ************************************************************************** */
2168 
2169 #define MNG_CANVAS_RGB8      0x00000000L
2170 #define MNG_CANVAS_RGBA8     0x00001000L
2171 #define MNG_CANVAS_ARGB8     0x00003000L
2172 #define MNG_CANVAS_RGB8_A8   0x00005000L
2173 #define MNG_CANVAS_BGR8      0x00000001L
2174 #define MNG_CANVAS_BGRA8     0x00001001L
2175 #define MNG_CANVAS_BGRA8PM   0x00009001L
2176 #define MNG_CANVAS_ABGR8     0x00003001L
2177 #define MNG_CANVAS_RGB16     0x00000100L         /* not supported yet */
2178 #define MNG_CANVAS_RGBA16    0x00001100L         /* not supported yet */
2179 #define MNG_CANVAS_ARGB16    0x00003100L         /* not supported yet */
2180 #define MNG_CANVAS_BGR16     0x00000101L         /* not supported yet */
2181 #define MNG_CANVAS_BGRA16    0x00001101L         /* not supported yet */
2182 #define MNG_CANVAS_ABGR16    0x00003101L         /* not supported yet */
2183 #define MNG_CANVAS_GRAY8     0x00000002L         /* not supported yet */
2184 #define MNG_CANVAS_GRAY16    0x00000102L         /* not supported yet */
2185 #define MNG_CANVAS_GRAYA8    0x00001002L         /* not supported yet */
2186 #define MNG_CANVAS_GRAYA16   0x00001102L         /* not supported yet */
2187 #define MNG_CANVAS_AGRAY8    0x00003002L         /* not supported yet */
2188 #define MNG_CANVAS_AGRAY16   0x00003102L         /* not supported yet */
2189 #define MNG_CANVAS_DX15      0x00000003L         /* not supported yet */
2190 #define MNG_CANVAS_DX16      0x00000004L         /* not supported yet */
2191 
2192 #define MNG_CANVAS_PIXELTYPE(C)  (C & 0x000000FFL)
2193 #define MNG_CANVAS_BITDEPTH(C)   (C & 0x00000100L)
2194 #define MNG_CANVAS_HASALPHA(C)   (C & 0x00001000L)
2195 #define MNG_CANVAS_ALPHAFIRST(C) (C & 0x00002000L)
2196 #define MNG_CANVAS_ALPHASEPD(C)  (C & 0x00004000L)
2197 #define MNG_CANVAS_ALPHAPM(C)    (C & 0x00008000L)
2198 
2199 #define MNG_CANVAS_RGB(C)        (MNG_CANVAS_PIXELTYPE (C) == 0)
2200 #define MNG_CANVAS_BGR(C)        (MNG_CANVAS_PIXELTYPE (C) == 1)
2201 #define MNG_CANVAS_GRAY(C)       (MNG_CANVAS_PIXELTYPE (C) == 2)
2202 #define MNG_CANVAS_DIRECTX15(C)  (MNG_CANVAS_PIXELTYPE (C) == 3)
2203 #define MNG_CANVAS_DIRECTX16(C)  (MNG_CANVAS_PIXELTYPE (C) == 4)
2204 #define MNG_CANVAS_8BIT(C)       (!MNG_CANVAS_BITDEPTH (C))
2205 #define MNG_CANVAS_16BIT(C)      (MNG_CANVAS_BITDEPTH (C))
2206 #define MNG_CANVAS_PIXELFIRST(C) (!MNG_CANVAS_ALPHAFIRST (C))
2207 
2208 /* ************************************************************************** */
2209 /* *                                                                        * */
2210 /* *  Chunk names (idea adapted from libpng 1.1.0 - png.h)                  * */
2211 /* *                                                                        * */
2212 /* ************************************************************************** */
2213 
2214 #define MNG_UINT_HUH  0x40404040L
2215 
2216 #define MNG_UINT_BACK 0x4241434bL
2217 #define MNG_UINT_BASI 0x42415349L
2218 #define MNG_UINT_CLIP 0x434c4950L
2219 #define MNG_UINT_CLON 0x434c4f4eL
2220 #define MNG_UINT_DBYK 0x4442594bL
2221 #define MNG_UINT_DEFI 0x44454649L
2222 #define MNG_UINT_DHDR 0x44484452L
2223 #define MNG_UINT_DISC 0x44495343L
2224 #define MNG_UINT_DROP 0x44524f50L
2225 #define MNG_UINT_ENDL 0x454e444cL
2226 #define MNG_UINT_FRAM 0x4652414dL
2227 #define MNG_UINT_IDAT 0x49444154L
2228 #define MNG_UINT_IEND 0x49454e44L
2229 #define MNG_UINT_IHDR 0x49484452L
2230 #define MNG_UINT_IJNG 0x494a4e47L
2231 #define MNG_UINT_IPNG 0x49504e47L
2232 #define MNG_UINT_JDAA 0x4a444141L
2233 #define MNG_UINT_JDAT 0x4a444154L
2234 #define MNG_UINT_JHDR 0x4a484452L
2235 #define MNG_UINT_JSEP 0x4a534550L
2236 #define MNG_UINT_JdAA 0x4a644141L
2237 #define MNG_UINT_LOOP 0x4c4f4f50L
2238 #define MNG_UINT_MAGN 0x4d41474eL
2239 #define MNG_UINT_MEND 0x4d454e44L
2240 #define MNG_UINT_MHDR 0x4d484452L
2241 #define MNG_UINT_MOVE 0x4d4f5645L
2242 #define MNG_UINT_ORDR 0x4f524452L
2243 #define MNG_UINT_PAST 0x50415354L
2244 #define MNG_UINT_PLTE 0x504c5445L
2245 #define MNG_UINT_PPLT 0x50504c54L
2246 #define MNG_UINT_PROM 0x50524f4dL
2247 #define MNG_UINT_SAVE 0x53415645L
2248 #define MNG_UINT_SEEK 0x5345454bL
2249 #define MNG_UINT_SHOW 0x53484f57L
2250 #define MNG_UINT_TERM 0x5445524dL
2251 #define MNG_UINT_bKGD 0x624b4744L
2252 #define MNG_UINT_cHRM 0x6348524dL
2253 #define MNG_UINT_eXPI 0x65585049L
2254 #define MNG_UINT_fPRI 0x66505249L
2255 #define MNG_UINT_gAMA 0x67414d41L
2256 #define MNG_UINT_hIST 0x68495354L
2257 #define MNG_UINT_iCCP 0x69434350L
2258 #define MNG_UINT_iTXt 0x69545874L
2259 #define MNG_UINT_nEED 0x6e454544L
2260 #define MNG_UINT_oFFs 0x6f464673L
2261 #define MNG_UINT_pCAL 0x7043414cL
2262 #define MNG_UINT_pHYg 0x70444167L
2263 #define MNG_UINT_pHYs 0x70485973L
2264 #define MNG_UINT_sBIT 0x73424954L
2265 #define MNG_UINT_sCAL 0x7343414cL
2266 #define MNG_UINT_sPLT 0x73504c54L
2267 #define MNG_UINT_sRGB 0x73524742L
2268 #define MNG_UINT_tEXt 0x74455874L
2269 #define MNG_UINT_tIME 0x74494d45L
2270 #define MNG_UINT_tRNS 0x74524e53L
2271 #define MNG_UINT_zTXt 0x7a545874L
2272 
2273 /* ************************************************************************** */
2274 /* *                                                                        * */
2275 /* *  Chunk property values                                                 * */
2276 /* *                                                                        * */
2277 /* ************************************************************************** */
2278 
2279 #define MNG_BITDEPTH_1                   1       /* IHDR, BASI, JHDR, PROM */
2280 #define MNG_BITDEPTH_2                   2
2281 #define MNG_BITDEPTH_4                   4
2282 #define MNG_BITDEPTH_8                   8       /* sPLT */
2283 #define MNG_BITDEPTH_16                 16
2284 
2285 #define MNG_COLORTYPE_GRAY               0       /* IHDR, BASI, PROM */
2286 #define MNG_COLORTYPE_RGB                2
2287 #define MNG_COLORTYPE_INDEXED            3
2288 #define MNG_COLORTYPE_GRAYA              4
2289 #define MNG_COLORTYPE_RGBA               6
2290 
2291 #define MNG_COMPRESSION_DEFLATE          0       /* IHDR, zTXt, iTXt, iCCP,
2292                                                     BASI, JHDR */
2293 
2294 #define MNG_FILTER_ADAPTIVE              0       /* IHDR, BASI, JHDR */
2295 /* #define MNG_FILTER_NO_ADAPTIVE           1 */
2296 #define MNG_FILTER_NO_DIFFERING          0
2297 #define MNG_FILTER_DIFFERING             0x40
2298 /* #define MNG_FILTER_MASK                  (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING) */
2299 
2300 #define MNG_INTERLACE_NONE               0       /* IHDR, BASI, JHDR */
2301 #define MNG_INTERLACE_ADAM7              1
2302 
2303 #define MNG_FILTER_NONE                  0       /* IDAT */
2304 #define MNG_FILTER_SUB                   1
2305 #define MNG_FILTER_UP                    2
2306 #define MNG_FILTER_AVERAGE               3
2307 #define MNG_FILTER_PAETH                 4
2308 
2309 #define MNG_INTENT_PERCEPTUAL            0       /* sRGB */
2310 #define MNG_INTENT_RELATIVECOLORIMETRIC  1
2311 #define MNG_INTENT_SATURATION            2
2312 #define MNG_INTENT_ABSOLUTECOLORIMETRIC  3
2313                                                  /* tEXt, zTXt, iTXt */
2314 #define MNG_TEXT_TITLE                   "Title"
2315 #define MNG_TEXT_AUTHOR                  "Author"
2316 #define MNG_TEXT_DESCRIPTION             "Description"
2317 #define MNG_TEXT_COPYRIGHT               "Copyright"
2318 #define MNG_TEXT_CREATIONTIME            "Creation Time"
2319 #define MNG_TEXT_SOFTWARE                "Software"
2320 #define MNG_TEXT_DISCLAIMER              "Disclaimer"
2321 #define MNG_TEXT_WARNING                 "Warning"
2322 #define MNG_TEXT_SOURCE                  "Source"
2323 #define MNG_TEXT_COMMENT                 "Comment"
2324 
2325 #define MNG_FLAG_UNCOMPRESSED            0       /* iTXt */
2326 #define MNG_FLAG_COMPRESSED              1
2327 
2328 #define MNG_UNIT_UNKNOWN                 0       /* pHYs, pHYg */
2329 #define MNG_UNIT_METER                   1
2330                                                  /* MHDR */
2331 #define MNG_SIMPLICITY_VALID             0x00000001
2332 #define MNG_SIMPLICITY_SIMPLEFEATURES    0x00000002
2333 #define MNG_SIMPLICITY_COMPLEXFEATURES   0x00000004
2334 #define MNG_SIMPLICITY_TRANSPARENCY      0x00000008
2335 #define MNG_SIMPLICITY_JNG               0x00000010
2336 #define MNG_SIMPLICITY_DELTAPNG          0x00000020
2337 
2338 #define MNG_TERMINATION_DECODER_NC       0       /* LOOP */
2339 #define MNG_TERMINATION_USER_NC          1
2340 #define MNG_TERMINATION_EXTERNAL_NC      2
2341 #define MNG_TERMINATION_DETERMINISTIC_NC 3
2342 #define MNG_TERMINATION_DECODER_C        4
2343 #define MNG_TERMINATION_USER_C           5
2344 #define MNG_TERMINATION_EXTERNAL_C       6
2345 #define MNG_TERMINATION_DETERMINISTIC_C  7
2346 
2347 #define MNG_DONOTSHOW_VISIBLE            0       /* DEFI */
2348 #define MNG_DONOTSHOW_NOTVISIBLE         1
2349 
2350 #define MNG_ABSTRACT                     0       /* DEFI */
2351 #define MNG_CONCRETE                     1
2352 
2353 #define MNG_NOTVIEWABLE                  0       /* BASI */
2354 #define MNG_VIEWABLE                     1
2355 
2356 #define MNG_FULL_CLONE                   0       /* CLON */
2357 #define MNG_PARTIAL_CLONE                1
2358 #define MNG_RENUMBER                     2
2359 
2360 #define MNG_CONCRETE_ASPARENT            0       /* CLON */
2361 #define MNG_CONCRETE_MAKEABSTRACT        1
2362 
2363 #define MNG_LOCATION_ABSOLUTE            0       /* CLON, MOVE */
2364 #define MNG_LOCATION_RELATIVE            1
2365 
2366 #define MNG_TARGET_ABSOLUTE              0       /* PAST */
2367 #define MNG_TARGET_RELATIVE_SAMEPAST     1
2368 #define MNG_TARGET_RELATIVE_PREVPAST     2
2369 
2370 #define MNG_COMPOSITE_OVER               0       /* PAST */
2371 #define MNG_COMPOSITE_REPLACE            1
2372 #define MNG_COMPOSITE_UNDER              2
2373 
2374 #define MNG_ORIENTATION_SAME             0       /* PAST */
2375 #define MNG_ORIENTATION_180DEG           2
2376 #define MNG_ORIENTATION_FLIPHORZ         4
2377 #define MNG_ORIENTATION_FLIPVERT         6
2378 #define MNG_ORIENTATION_TILED            8
2379 
2380 #define MNG_OFFSET_ABSOLUTE              0       /* PAST */
2381 #define MNG_OFFSET_RELATIVE              1
2382 
2383 #define MNG_BOUNDARY_ABSOLUTE            0       /* PAST, FRAM */
2384 #define MNG_BOUNDARY_RELATIVE            1
2385 
2386 #define MNG_BACKGROUNDCOLOR_MANDATORY    0x01    /* BACK */
2387 #define MNG_BACKGROUNDIMAGE_MANDATORY    0x02    /* BACK */
2388 
2389 #define MNG_BACKGROUNDIMAGE_NOTILE       0       /* BACK */
2390 #define MNG_BACKGROUNDIMAGE_TILE         1
2391 
2392 #define MNG_FRAMINGMODE_NOCHANGE         0       /* FRAM */
2393 #define MNG_FRAMINGMODE_1                1
2394 #define MNG_FRAMINGMODE_2                2
2395 #define MNG_FRAMINGMODE_3                3
2396 #define MNG_FRAMINGMODE_4                4
2397 
2398 #define MNG_CHANGEDELAY_NO               0       /* FRAM */
2399 #define MNG_CHANGEDELAY_NEXTSUBFRAME     1
2400 #define MNG_CHANGEDELAY_DEFAULT          2
2401 
2402 #define MNG_CHANGETIMOUT_NO              0       /* FRAM */
2403 #define MNG_CHANGETIMOUT_DETERMINISTIC_1 1
2404 #define MNG_CHANGETIMOUT_DETERMINISTIC_2 2
2405 #define MNG_CHANGETIMOUT_DECODER_1       3
2406 #define MNG_CHANGETIMOUT_DECODER_2       4
2407 #define MNG_CHANGETIMOUT_USER_1          5
2408 #define MNG_CHANGETIMOUT_USER_2          6
2409 #define MNG_CHANGETIMOUT_EXTERNAL_1      7
2410 #define MNG_CHANGETIMOUT_EXTERNAL_2      8
2411 
2412 #define MNG_CHANGECLIPPING_NO            0       /* FRAM */
2413 #define MNG_CHANGECLIPPING_NEXTSUBFRAME  1
2414 #define MNG_CHANGECLIPPING_DEFAULT       2
2415 
2416 #define MNG_CHANGESYNCID_NO              0       /* FRAM */
2417 #define MNG_CHANGESYNCID_NEXTSUBFRAME    1
2418 #define MNG_CHANGESYNCID_DEFAULT         2
2419 
2420 #define MNG_CLIPPING_ABSOLUTE            0       /* CLIP */
2421 #define MNG_CLIPPING_RELATIVE            1
2422 
2423 #define MNG_SHOWMODE_0                   0       /* SHOW */
2424 #define MNG_SHOWMODE_1                   1
2425 #define MNG_SHOWMODE_2                   2
2426 #define MNG_SHOWMODE_3                   3
2427 #define MNG_SHOWMODE_4                   4
2428 #define MNG_SHOWMODE_5                   5
2429 #define MNG_SHOWMODE_6                   6
2430 #define MNG_SHOWMODE_7                   7
2431 
2432 #define MNG_TERMACTION_LASTFRAME         0       /* TERM */
2433 #define MNG_TERMACTION_CLEAR             1
2434 #define MNG_TERMACTION_FIRSTFRAME        2
2435 #define MNG_TERMACTION_REPEAT            3
2436 
2437 #define MNG_ITERACTION_LASTFRAME         0       /* TERM */
2438 #define MNG_ITERACTION_CLEAR             1
2439 #define MNG_ITERACTION_FIRSTFRAME        2
2440 
2441 #define MNG_SAVEOFFSET_4BYTE             4       /* SAVE */
2442 #define MNG_SAVEOFFSET_8BYTE             8
2443 
2444 #define MNG_SAVEENTRY_SEGMENTFULL        0       /* SAVE */
2445 #define MNG_SAVEENTRY_SEGMENT            1
2446 #define MNG_SAVEENTRY_SUBFRAME           2
2447 #define MNG_SAVEENTRY_EXPORTEDIMAGE      3
2448 
2449 #define MNG_PRIORITY_ABSOLUTE            0       /* fPRI */
2450 #define MNG_PRIORITY_RELATIVE            1
2451 
2452 #ifdef MNG_INCLUDE_JNG
2453 #define MNG_COLORTYPE_JPEGGRAY           8       /* JHDR */
2454 #define MNG_COLORTYPE_JPEGCOLOR         10
2455 #define MNG_COLORTYPE_JPEGGRAYA         12
2456 #define MNG_COLORTYPE_JPEGCOLORA        14
2457 
2458 #define MNG_BITDEPTH_JPEG8               8       /* JHDR */
2459 #define MNG_BITDEPTH_JPEG12             12
2460 #define MNG_BITDEPTH_JPEG8AND12         20
2461 
2462 #define MNG_COMPRESSION_BASELINEJPEG     8       /* JHDR */
2463 
2464 #define MNG_INTERLACE_SEQUENTIAL         0       /* JHDR */
2465 #define MNG_INTERLACE_PROGRESSIVE        8
2466 #endif /* MNG_INCLUDE_JNG */
2467 
2468 #define MNG_IMAGETYPE_UNKNOWN            0       /* DHDR */
2469 #define MNG_IMAGETYPE_PNG                1
2470 #define MNG_IMAGETYPE_JNG                2
2471 
2472 #define MNG_DELTATYPE_REPLACE            0       /* DHDR */
2473 #define MNG_DELTATYPE_BLOCKPIXELADD      1
2474 #define MNG_DELTATYPE_BLOCKALPHAADD      2
2475 #define MNG_DELTATYPE_BLOCKCOLORADD      3
2476 #define MNG_DELTATYPE_BLOCKPIXELREPLACE  4
2477 #define MNG_DELTATYPE_BLOCKALPHAREPLACE  5
2478 #define MNG_DELTATYPE_BLOCKCOLORREPLACE  6
2479 #define MNG_DELTATYPE_NOCHANGE           7
2480 
2481 #define MNG_FILLMETHOD_LEFTBITREPLICATE  0       /* PROM */
2482 #define MNG_FILLMETHOD_ZEROFILL          1
2483 
2484 #define MNG_DELTATYPE_REPLACERGB         0       /* PPLT */
2485 #define MNG_DELTATYPE_DELTARGB           1
2486 #define MNG_DELTATYPE_REPLACEALPHA       2
2487 #define MNG_DELTATYPE_DELTAALPHA         3
2488 #define MNG_DELTATYPE_REPLACERGBA        4
2489 #define MNG_DELTATYPE_DELTARGBA          5
2490 
2491 #define MNG_POLARITY_ONLY                0       /* DBYK */
2492 #define MNG_POLARITY_ALLBUT              1
2493 
2494 /* ************************************************************************** */
2495 /* *                                                                        * */
2496 /* *  Processtext callback types                                            * */
2497 /* *                                                                        * */
2498 /* ************************************************************************** */
2499 
2500 #define MNG_TYPE_TEXT 0
2501 #define MNG_TYPE_ZTXT 1
2502 #define MNG_TYPE_ITXT 2
2503 
2504 /* ************************************************************************** */
2505 
2506 #ifdef __cplusplus
2507 }
2508 #endif
2509 
2510 #endif /* _libmng_h_ */
2511 
2512 /* ************************************************************************** */
2513 /* * end of file                                                            * */
2514 /* ************************************************************************** */
2515 
2516