1 /* DO NOT EDIT THIS FILE.
3 It has been auto-edited by fixincludes from:
5 "/usr/include/libmng_types.h"
7 This had to be done to correct non-standard usages in the
8 original, manufacturer supplied header file. */
10 /* ************************************************************************** */
11 /* * For conditions of distribution and use, * */
12 /* * see copyright notice in libmng.h * */
13 /* ************************************************************************** */
15 /* * project : libmng * */
16 /* * file : libmng_types.h copyright (c) 2000-2004 G.Juyn * */
17 /* * version : 1.0.8 * */
19 /* * purpose : type specifications * */
21 /* * author : G.Juyn * */
23 /* * comment : Specification of the types used by the library * */
24 /* * Creates platform-independant structure * */
26 /* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
27 /* * - added iteratechunk callback definition * */
28 /* * 0.5.1 - 05/08/2000 - G.Juyn * */
29 /* * - improved definitions for DLL support * */
30 /* * - added 8-bit palette definition * */
31 /* * - added general array definitions * */
32 /* * - added MNG_NULL definition * */
33 /* * - changed strict-ANSI stuff * */
34 /* * 0.5.1 - 05/11/2000 - G.Juyn * */
35 /* * - changed most callback prototypes to allow the app * */
36 /* * to report errors during callback processing * */
37 /* * 0.5.1 - 05/16/2000 - G.Juyn * */
38 /* * - moved standard header includes into this file * */
39 /* * (stdlib/mem for mem-mngmt & math for fp gamma-calc) * */
41 /* * 0.5.2 - 05/18/2000 - G.Juyn * */
42 /* * - B003 - fixed problem with <mem.h> being proprietary * */
43 /* * to Borland platform * */
44 /* * - added helper definitions for JNG (IJG-based) * */
45 /* * - fixed support for IJGSRC6B * */
46 /* * 0.5.2 - 05/24/2000 - G.Juyn * */
47 /* * - added default IJG compression parameters and such * */
48 /* * 0.5.2 - 05/31/2000 - G.Juyn * */
49 /* * - fixed inclusion for memcpy (contributed by Tim Rowley) * */
50 /* * - added mng_int32p (contributed by Tim Rowley) * */
51 /* * 0.5.2 - 06/02/2000 - G.Juyn * */
52 /* * - removed SWAP_ENDIAN reference (contributed by Tim Rowley)* */
53 /* * - added getalphaline callback for RGB8_A8 canvasstyle * */
55 /* * 0.5.3 - 06/21/2000 - G.Juyn * */
56 /* * - added speedtype to facilitate testing * */
57 /* * 0.5.3 - 06/27/2000 - G.Juyn * */
58 /* * - added typedef for mng_size_t * */
59 /* * - changed size parameter for memory callbacks to * */
61 /* * 0.5.3 - 06/28/2000 - G.Juyn * */
62 /* * - changed definition of 32-bit ints (64-bit platforms) * */
63 /* * - changed definition of mng_handle (64-bit platforms) * */
64 /* * 0.5.3 - 06/29/2000 - G.Juyn * */
65 /* * - changed definition of mng_handle (again) * */
66 /* * - swapped refresh parameters * */
67 /* * - added inclusion of stdlib.h for abs() * */
69 /* * 0.9.0 - 06/30/2000 - G.Juyn * */
70 /* * - changed refresh parameters to 'x,y,width,height' * */
71 /* * 0.9.1 - 07/10/2000 - G.Juyn * */
72 /* * - added suspendbuffer constants * */
73 /* * 0.9.1 - 07/15/2000 - G.Juyn * */
74 /* * - added callbacks for SAVE/SEEK processing * */
76 /* * 0.9.2 - 08/05/2000 - G.Juyn * */
77 /* * - changed file-prefixes * */
79 /* * 0.9.3 - 08/07/2000 - G.Juyn * */
80 /* * - B111300 - fixup for improved portability * */
81 /* * 0.9.3 - 08/12/2000 - G.Juyn * */
82 /* * - added workaround for faulty PhotoShop iCCP chunk * */
83 /* * 0.9.3 - 09/11/2000 - G.Juyn * */
84 /* * - added export of zlib functions from windows dll * */
85 /* * - fixed inclusion parameters once again to make those * */
86 /* * external libs work together * */
87 /* * - re-fixed fixed inclusion parameters * */
88 /* * (these freeking libraries make me mad) * */
89 /* * 0.9.3 - 10/11/2000 - G.Juyn * */
90 /* * - added support for nEED * */
91 /* * 0.9.3 - 10/17/2000 - G.Juyn * */
92 /* * - added callback to process non-critical unknown chunks * */
94 /* * 0.9.4 - 11/20/2000 - R.Giles * */
95 /* * - fixed inclusion of lcms header for non-windows platforms * */
96 /* * 0.9.4 - 12/12/2000 - G.Juyn * */
97 /* * - changed callback convention for MSVC (Thanks Chad) * */
98 /* * 0.9.4 - 12/16/2000 - G.Juyn * */
99 /* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */
101 /* * 1.0.1 - 02/08/2001 - G.Juyn * */
102 /* * - added MEND processing callback * */
104 /* * 1.0.2 - 06/23/2001 - G.Juyn * */
105 /* * - added processterm callback * */
107 /* * 1.0.3 - 08/06/2001 - G.Juyn * */
108 /* * - changed inclusion of lcms.h for Linux platforms * */
110 /* * 1.0.5 - 08/19/2002 - G.Juyn * */
111 /* * - B597134 - libmng pollutes the linker namespace * */
113 /* * 1.0.6 - 04/11/2003 - G.Juyn * */
114 /* * - B719420 - fixed several MNG_APP_CMS problems * */
115 /* * 1.0.6 - 06/15/2003 - R.Giles * */
116 /* * - lcms.h inclusion is generally no longer prefixed * */
117 /* * 1.0.6 - 07/07/2003 - G. R-P. * */
118 /* * - added png_imgtypes enumeration * */
120 /* * 1.0.7 - 03/10/2004 - G.R-P * */
121 /* * - added conditionals around openstream/closestream * */
122 /* * 1.0.8 - 04/11/2004 - G.Juyn * */
123 /* * - added data-push mechanisms for specialized decoders * */
124 /* * 1.0.8 - 08/01/2004 - G.Juyn * */
125 /* * - added support for 3+byte pixelsize for JPEG's * */
127 /* ************************************************************************** */
129 #ifndef _libmng_types_h_
130 #define _libmng_types_h_
132 /* ************************************************************************** */
135 #pragma option -AT /* turn off strict ANSI-C for the moment */
139 #if defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || defined(_WINDOWS)
140 #define WIN32 /* gather them into a single define */
144 /* ************************************************************************** */
146 /* * Here's where the external & standard libs are embedded * */
148 /* * (it can be a bit of a pain in the lower-back to get them to work * */
151 /* ************************************************************************** */
153 #ifdef WIN32 /* only include needed stuff */
154 #ifndef WIN32_LEAN_AND_MEAN
155 #define WIN32_LEAN_AND_MEAN
161 #undef MNG_INCLUDE_ZLIB
164 #undef MNG_INCLUDE_LCMS
166 #ifdef MNG_SKIP_IJG6B
167 #undef MNG_INCLUDE_IJG6B
171 #ifdef MNG_INCLUDE_ZLIB /* zlib by Mark Adler & Jean-loup Gailly */
175 #ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria Saguer */
179 #if defined(WIN32) || defined(__linux__) /* different header locations */
182 #include "lcms/lcms.h"
184 #endif /* MNG_INCLUDE_LCMS */
186 #ifdef MNG_INCLUDE_IJG6B /* IJG's jpgsrc6b */
188 #ifdef MNG_USE_SETJMP
189 #include <setjmp.h> /* needed for error-recovery (blergh) */
192 #define USE_WINDOWS_MESSAGEBOX /* display a messagebox under Windoze */
194 #endif /* MNG_USE_SETJMP */
196 #undef FAR /* possibly defined by zlib or lcms */
198 #define JPEG_INTERNAL_OPTIONS /* for RGB_PIXELSIZE */
199 #include "jpeglib.h" /* all that for JPEG support :-) */
200 #endif /* MNG_INCLUDE_IJG6B */
202 #if defined(MNG_INTERNAL_MEMMNGMT) || defined(MNG_INCLUDE_FILTERS)
203 #include <stdlib.h> /* "calloc" & "free" & "abs" */
206 #include <limits.h> /* get proper integer widths */
209 #if defined __BORLANDC__
210 #include <mem.h> /* defines "memcpy" for BCB */
212 #include <memory.h> /* defines "memcpy" for other win32 platforms */
214 #include <string.h> /* "strncmp" + "strcmp" */
217 #include <strings.h> /* defines "memcpy", etc for BSD (?) */
219 #include <string.h> /* defines "memcpy", etc for all others (???) */
223 #if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
224 #include <math.h> /* fp gamma-calculation */
227 /* ************************************************************************** */
229 /* * Platform-dependant stuff * */
231 /* ************************************************************************** */
233 /* TODO: this may require some elaboration for other platforms;
234 only works with BCB for now */
237 #if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL)
242 #define MNG_LOCAL static
244 #if defined(MNG_DLL) && defined(WIN32) /* setup DLL calling conventions */
245 #define MNG_DECL __stdcall
246 #if defined(MNG_BUILD_DLL)
247 #define MNG_EXT __declspec(dllexport)
248 #elif defined(MNG_USE_DLL)
249 #define MNG_EXT __declspec(dllimport)
253 #ifdef MNG_STRICT_ANSI
254 #undef MNG_STRICT_ANSI /* can't do strict-ANSI with this DLL-stuff */
257 #define MNG_DECL /* dummies for non-DLL */
259 #endif /* MNG_DLL && WIN32 */
261 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
262 #pragma option -A /* now force ANSI-C from here on */
265 /* ************************************************************************** */
267 #if USHRT_MAX == 0xffffffffU /* get the proper 32-bit width !!! */
268 typedef unsigned short mng_uint32;
269 typedef signed short mng_int32;
270 #elif UINT_MAX == 0xffffffffU
271 typedef unsigned int mng_uint32;
272 typedef signed int mng_int32;
273 #elif ULONG_MAX == 0xffffffffU
274 typedef unsigned long mng_uint32;
275 typedef signed long mng_int32;
277 #error "Sorry, I can't find any 32-bit integers on this platform."
280 typedef signed short mng_int16; /* other basic integers */
281 typedef unsigned short mng_uint16;
282 typedef signed char mng_int8;
283 typedef unsigned char mng_uint8;
285 typedef double mng_float; /* basic float */
287 typedef size_t mng_size_t; /* size field for memory allocation */
289 typedef char * mng_pchar; /* string */
290 typedef void * mng_ptr; /* generic pointer */
291 typedef void (*mng_fptr) (void); /* generic function pointer */
293 /* ************************************************************************** */
295 /* * Platform-independant from here * */
297 /* ************************************************************************** */
299 typedef mng_uint32 * mng_uint32p; /* pointer to unsigned longs */
300 typedef mng_int32 * mng_int32p; /* pointer to longs */
301 typedef mng_uint16 * mng_uint16p; /* pointer to unsigned words */
302 typedef mng_uint8 * mng_uint8p; /* pointer to unsigned bytes */
304 typedef mng_int8 mng_bool; /* booleans */
306 struct mng_data_struct;
307 typedef struct mng_data_struct * mng_handle; /* generic handle */
309 typedef mng_int32 mng_retcode; /* generic return code */
310 typedef mng_int32 mng_chunkid; /* 4-byte chunkname identifier */
311 typedef mng_ptr mng_chunkp; /* pointer to a chunk-structure */
312 typedef mng_ptr mng_objectp; /* pointer to an object-structure */
314 typedef mng_chunkid * mng_chunkidp; /* pointer to chunkid */
316 typedef struct { /* 8-bit palette element */
321 typedef mng_palette8e mng_palette8[256]; /* 8-bit palette */
322 typedef mng_palette8e * mng_palette8ep;
324 typedef mng_uint8 mng_uint8arr[256]; /* generic arrays */
325 typedef mng_uint8 mng_uint8arr4[4];
326 typedef mng_uint16 mng_uint16arr[256];
327 typedef mng_uint32 mng_uint32arr2[2];
329 /* ************************************************************************** */
335 #define MNG_SUSPENDBUFFERSIZE 32768
336 #define MNG_SUSPENDREQUESTSIZE 1024
338 /* ************************************************************************** */
340 #ifdef MNG_INCLUDE_ZLIB
342 /* size of temporary zlib buffer for deflate processing */
343 #define MNG_ZLIB_MAXBUF 8192
345 /* default zlib compression parameters for deflateinit2 */
346 #define MNG_ZLIB_LEVEL 9 /* level */
347 #define MNG_ZLIB_METHOD Z_DEFLATED /* method */
348 #define MNG_ZLIB_WINDOWBITS 15 /* window size */
349 #define MNG_ZLIB_MEMLEVEL 9 /* memory level */
350 #define MNG_ZLIB_STRATEGY Z_DEFAULT_STRATEGY /* strategy */
352 #define MNG_MAX_IDAT_SIZE 4096 /* maximum size of IDAT data */
354 #endif /* MNG_INCLUDE_ZLIB */
356 /* ************************************************************************** */
358 #ifdef MNG_INCLUDE_JNG
360 #ifdef MNG_INCLUDE_IJG6B /* IJG helper defs */
361 typedef struct jpeg_compress_struct mngjpeg_comp;
362 typedef struct jpeg_decompress_struct mngjpeg_decomp;
363 typedef struct jpeg_error_mgr mngjpeg_error;
364 typedef struct jpeg_source_mgr mngjpeg_source;
366 typedef mngjpeg_comp * mngjpeg_compp;
367 typedef mngjpeg_decomp * mngjpeg_decompp;
368 typedef mngjpeg_error * mngjpeg_errorp;
369 typedef mngjpeg_source * mngjpeg_sourcep;
371 typedef J_DCT_METHOD mngjpeg_dctmethod;
373 /* default IJG parameters for compression */
374 #define MNG_JPEG_DCT JDCT_DEFAULT /* DCT algorithm (JDCT_ISLOW) */
375 #define MNG_JPEG_QUALITY 100 /* quality 0..100; 100=best */
376 #define MNG_JPEG_SMOOTHING 0 /* default no smoothing */
377 #define MNG_JPEG_PROGRESSIVE MNG_FALSE /* default is just baseline */
378 #define MNG_JPEG_OPTIMIZED MNG_FALSE /* default is not optimized */
379 #endif /* MNG_INCLUDE_IJG6B */
381 #define MNG_JPEG_MAXBUF 65500 /* max size of temp JPEG buffer */
382 #define MNG_MAX_JDAT_SIZE 4096 /* maximum size of JDAT data */
384 #endif /* MNG_INCLUDE_JNG */
386 /* ************************************************************************** */
388 #ifdef MNG_INCLUDE_LCMS
389 typedef cmsHPROFILE mng_cmsprof; /* little CMS helper defs */
390 typedef cmsHTRANSFORM mng_cmstrans;
391 typedef cmsCIExyY mng_CIExyY;
392 typedef cmsCIExyYTRIPLE mng_CIExyYTRIPLE;
393 typedef LPGAMMATABLE mng_gammatabp;
394 #endif /* MNG_INCLUDE_LCMS */
396 /* ************************************************************************** */
398 /* enumeration of known graphics types */
399 enum mng_imgtypes {mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng};
400 typedef enum mng_imgtypes mng_imgtype;
402 /* enumeration of animation speed-types */
403 enum mng_speedtypes {mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest};
404 typedef enum mng_speedtypes mng_speedtype;
407 /* ************************************************************************** */
409 /* enumeration of PNG image types */
410 #ifdef MNG_OPTIMIZE_FOOTPRINT_INIT
424 #ifdef MNG_INCLUDE_JNG
430 #ifndef MNG_NO_16BIT_SUPPORT
435 #ifdef MNG_INCLUDE_JNG
442 typedef enum png_imgtypes png_imgtype;
444 /* ************************************************************************** */
446 /* memory management callbacks */
447 typedef mng_ptr (MNG_DECL *mng_memalloc) (mng_size_t iLen);
448 typedef void (MNG_DECL *mng_memfree) (mng_ptr iPtr,
451 typedef void (MNG_DECL *mng_releasedata) (mng_ptr pUserdata,
455 /* I/O management callbacks */
456 #ifndef MNG_NO_OPEN_CLOSE_STREAM
457 typedef mng_bool (MNG_DECL *mng_openstream) (mng_handle hHandle);
458 typedef mng_bool (MNG_DECL *mng_closestream) (mng_handle hHandle);
460 typedef mng_bool (MNG_DECL *mng_readdata) (mng_handle hHandle,
464 typedef mng_bool (MNG_DECL *mng_writedata) (mng_handle hHandle,
467 mng_uint32p pWritten);
469 /* error & trace processing callbacks */
470 typedef mng_bool (MNG_DECL *mng_errorproc) (mng_handle hHandle,
471 mng_int32 iErrorcode,
473 mng_chunkid iChunkname,
474 mng_uint32 iChunkseq,
477 mng_pchar zErrortext);
478 typedef mng_bool (MNG_DECL *mng_traceproc) (mng_handle hHandle,
481 mng_pchar zFuncname);
483 /* read processing callbacks */
484 typedef mng_bool (MNG_DECL *mng_processheader) (mng_handle hHandle,
487 typedef mng_bool (MNG_DECL *mng_processtext) (mng_handle hHandle,
492 mng_pchar zTranslation);
493 typedef mng_bool (MNG_DECL *mng_processsave) (mng_handle hHandle);
494 typedef mng_bool (MNG_DECL *mng_processseek) (mng_handle hHandle,
496 typedef mng_bool (MNG_DECL *mng_processneed) (mng_handle hHandle,
498 typedef mng_bool (MNG_DECL *mng_processmend) (mng_handle hHandle,
499 mng_uint32 iIterationsdone,
500 mng_uint32 iIterationsleft);
501 typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle,
502 mng_chunkid iChunkid,
505 typedef mng_bool (MNG_DECL *mng_processterm) (mng_handle hHandle,
506 mng_uint8 iTermaction,
507 mng_uint8 iIteraction,
509 mng_uint32 iItermax);
511 /* display processing callbacks */
512 typedef mng_ptr (MNG_DECL *mng_getcanvasline) (mng_handle hHandle,
514 typedef mng_ptr (MNG_DECL *mng_getbkgdline) (mng_handle hHandle,
516 typedef mng_ptr (MNG_DECL *mng_getalphaline) (mng_handle hHandle,
518 typedef mng_bool (MNG_DECL *mng_refresh) (mng_handle hHandle,
524 /* timer management callbacks */
525 typedef mng_uint32 (MNG_DECL *mng_gettickcount) (mng_handle hHandle);
526 typedef mng_bool (MNG_DECL *mng_settimer) (mng_handle hHandle,
529 /* color management callbacks */
530 typedef mng_bool (MNG_DECL *mng_processgamma) (mng_handle hHandle,
532 typedef mng_bool (MNG_DECL *mng_processchroma) (mng_handle hHandle,
533 mng_uint32 iWhitepointx,
534 mng_uint32 iWhitepointy,
541 typedef mng_bool (MNG_DECL *mng_processsrgb) (mng_handle hHandle,
542 mng_uint8 iRenderingintent);
543 typedef mng_bool (MNG_DECL *mng_processiccp) (mng_handle hHandle,
544 mng_uint32 iProfilesize,
546 typedef mng_bool (MNG_DECL *mng_processarow) (mng_handle hHandle,
547 mng_uint32 iRowsamples,
551 /* chunk access callback(s) */
552 typedef mng_bool (MNG_DECL *mng_iteratechunk) (mng_handle hHandle,
554 mng_chunkid iChunkid,
555 mng_uint32 iChunkseq);
557 /* ************************************************************************** */
559 #endif /* _libmng_types_h_ */
561 /* ************************************************************************** */
562 /* * end of file * */
563 /* ************************************************************************** */