1 //-----------------------------------------------------------------------------
2 //
3 // ImageLib Sources
4 // Copyright (C) 2000-2009 by Denton Woods
5 // Last modified: 03/07/2009
6 //
7 // Filename: IL/il.h
8 //
9 // Description: The main include file for DevIL
10 //
11 //-----------------------------------------------------------------------------
12 
13 // Doxygen comment
14 /*! \file il.h
15     The main include file for DevIL
16 */
17 
18 #ifndef __il_h_
19 #ifndef __IL_H__
20 
21 #define __il_h_
22 #define __IL_H__
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 //this define controls if floats and doubles are clampled to [0..1]
29 //during conversion. It takes a little more time, but it is the correct
30 //way of doing this. If you are sure your floats are always valid,
31 //you can undefine this value...
32 #define CLAMP_HALF		1
33 #define CLAMP_FLOATS	1
34 #define CLAMP_DOUBLES	1
35 
36 /*#ifdef _WIN32_WCE
37 	#define IL_NO_EXR
38 	#define IL_NO_GIF
39 	#define IL_NO_JP2
40 	#define IL_NO_JPG
41 	#define IL_NO_MNG
42 	#define IL_NO_PNG
43 	#define IL_NO_TIF
44 	#define IL_NO_LCMS
45 #endif //_WIN32_WCE
46 
47 #ifdef DJGPP
48 	#define IL_NO_EXR
49 	#define IL_NO_GIF
50 	#define IL_NO_JP2
51 	#define IL_NO_JPG
52 	#define IL_NO_MNG
53 	#define IL_NO_PNG
54 	#define IL_NO_TIF
55 	#define IL_NO_LCMS
56 #endif //DJGPP*/
57 
58 #ifdef _WIN32
59 	#if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
60 		#if defined(_MSC_VER) || defined(__BORLANDC__)
61 			#pragma comment(lib, "DevIL.lib")
62 		#endif
63 	#endif
64 #endif
65 
66 #ifdef RESTRICT_KEYWORD
67 #define RESTRICT restrict
68 #define CONST_RESTRICT const restrict
69 #else
70 #define RESTRICT
71 #define CONST_RESTRICT const
72 #endif
73 
74 #include <stdio.h>
75 
76 typedef unsigned int   ILenum;
77 typedef unsigned char  ILboolean;
78 typedef unsigned int   ILbitfield;
79 typedef signed char    ILbyte;
80 typedef signed short   ILshort;
81 typedef int     	   ILint;
82 typedef size_t         ILsizei;
83 typedef unsigned char  ILubyte;
84 typedef unsigned short ILushort;
85 typedef unsigned int   ILuint;
86 typedef float          ILfloat;
87 typedef float          ILclampf;
88 typedef double         ILdouble;
89 typedef double         ILclampd;
90 
91 #ifdef _MSC_VER
92 typedef __int64          ILint64;
93 typedef unsigned __int64 ILuint64;
94 #else
95 typedef long long int          ILint64;
96 typedef long long unsigned int ILuint64;
97 #endif
98 
99 
100 #include <limits.h>
101 #ifdef _UNICODE
102 	#ifndef _WIN32_WCE
103 		#include <wchar.h>
104 	#endif
105 	//if we use a define instead of a typedef,
106 	//ILconst_string works as intended
107 	#define ILchar wchar_t
108 	#define ILstring wchar_t*
109 	#define ILconst_string  wchar_t const *
110 #else
111 	//if we use a define instead of a typedef,
112 	//ILconst_string works as intended
113 	#define ILchar char
114 	#define ILstring char*
115 	#define ILconst_string char const *
116 #endif //_UNICODE
117 
118 #define IL_FALSE			0
119 #define IL_TRUE				1
120 
121 //  Matches OpenGL's right now.
122 //! Data formats \link Formats Formats\endlink
123 #define IL_COLOUR_INDEX     0x1900
124 #define IL_COLOR_INDEX      0x1900
125 #define IL_ALPHA			0x1906
126 #define IL_RGB              0x1907
127 #define IL_RGBA             0x1908
128 #define IL_BGR              0x80E0
129 #define IL_BGRA             0x80E1
130 #define IL_LUMINANCE        0x1909
131 #define IL_LUMINANCE_ALPHA  0x190A
132 
133 //! Data types \link Types Types\endlink
134 #define IL_BYTE           0x1400
135 #define IL_UNSIGNED_BYTE  0x1401
136 #define IL_SHORT          0x1402
137 #define IL_UNSIGNED_SHORT 0x1403
138 #define IL_INT            0x1404
139 #define IL_UNSIGNED_INT   0x1405
140 #define IL_FLOAT          0x1406
141 #define IL_DOUBLE         0x140A
142 #define IL_HALF           0x140B
143 
144 
145 #define IL_MAX_BYTE		  		SCHAR_MAX
146 #define IL_MAX_UNSIGNED_BYTE  	UCHAR_MAX
147 #define IL_MAX_SHORT	  		SHRT_MAX
148 #define IL_MAX_UNSIGNED_SHORT 	USHRT_MAX
149 #define IL_MAX_INT		  		INT_MAX
150 #define IL_MAX_UNSIGNED_INT   	UINT_MAX
151 
152 #define IL_LIMIT(x,m,M)		(x<m?m:(x>M?M:x))
153 #define IL_CLAMP(x) 		IL_LIMIT(x,0,1)
154 
155 #define IL_VENDOR   0x1F00
156 #define IL_LOAD_EXT 0x1F01
157 #define IL_SAVE_EXT 0x1F02
158 
159 
160 //
161 // IL-specific #define's
162 //
163 
164 #define IL_VERSION_1_7_8 1
165 #define IL_VERSION       178
166 
167 
168 // Attribute Bits
169 #define IL_ORIGIN_BIT          0x00000001
170 #define IL_FILE_BIT            0x00000002
171 #define IL_PAL_BIT             0x00000004
172 #define IL_FORMAT_BIT          0x00000008
173 #define IL_TYPE_BIT            0x00000010
174 #define IL_COMPRESS_BIT        0x00000020
175 #define IL_LOADFAIL_BIT        0x00000040
176 #define IL_FORMAT_SPECIFIC_BIT 0x00000080
177 #define IL_ALL_ATTRIB_BITS     0x000FFFFF
178 
179 
180 // Palette types
181 #define IL_PAL_NONE   0x0400
182 #define IL_PAL_RGB24  0x0401
183 #define IL_PAL_RGB32  0x0402
184 #define IL_PAL_RGBA32 0x0403
185 #define IL_PAL_BGR24  0x0404
186 #define IL_PAL_BGR32  0x0405
187 #define IL_PAL_BGRA32 0x0406
188 
189 
190 // Image types
191 #define IL_TYPE_UNKNOWN 0x0000
192 #define IL_BMP          0x0420  //!< Microsoft Windows Bitmap - .bmp extension
193 #define IL_CUT          0x0421  //!< Dr. Halo - .cut extension
194 #define IL_DOOM         0x0422  //!< DooM walls - no specific extension
195 #define IL_DOOM_FLAT    0x0423  //!< DooM flats - no specific extension
196 #define IL_ICO          0x0424  //!< Microsoft Windows Icons and Cursors - .ico and .cur extensions
197 #define IL_JPG          0x0425  //!< JPEG - .jpg, .jpe and .jpeg extensions
198 #define IL_JFIF         0x0425  //!<
199 #define IL_ILBM         0x0426  //!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions
200 #define IL_PCD          0x0427  //!< Kodak PhotoCD - .pcd extension
201 #define IL_PCX          0x0428  //!< ZSoft PCX - .pcx extension
202 #define IL_PIC          0x0429  //!< PIC - .pic extension
203 #define IL_PNG          0x042A  //!< Portable Network Graphics - .png extension
204 #define IL_PNM          0x042B  //!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions
205 #define IL_SGI          0x042C  //!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions
206 #define IL_TGA          0x042D  //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions
207 #define IL_TIF          0x042E  //!< Tagged Image File Format - .tif and .tiff extensions
208 #define IL_CHEAD        0x042F  //!< C-Style Header - .h extension
209 #define IL_RAW          0x0430  //!< Raw Image Data - any extension
210 #define IL_MDL          0x0431  //!< Half-Life Model Texture - .mdl extension
211 #define IL_WAL          0x0432  //!< Quake 2 Texture - .wal extension
212 #define IL_LIF          0x0434  //!< Homeworld Texture - .lif extension
213 #define IL_MNG          0x0435  //!< Multiple-image Network Graphics - .mng extension
214 #define IL_JNG          0x0435  //!<
215 #define IL_GIF          0x0436  //!< Graphics Interchange Format - .gif extension
216 #define IL_DDS          0x0437  //!< DirectDraw Surface - .dds extension
217 #define IL_DCX          0x0438  //!< ZSoft Multi-PCX - .dcx extension
218 #define IL_PSD          0x0439  //!< Adobe PhotoShop - .psd extension
219 #define IL_EXIF         0x043A  //!<
220 #define IL_PSP          0x043B  //!< PaintShop Pro - .psp extension
221 #define IL_PIX          0x043C  //!< PIX - .pix extension
222 #define IL_PXR          0x043D  //!< Pixar - .pxr extension
223 #define IL_XPM          0x043E  //!< X Pixel Map - .xpm extension
224 #define IL_HDR          0x043F  //!< Radiance High Dynamic Range - .hdr extension
225 #define IL_ICNS			0x0440  //!< Macintosh Icon - .icns extension
226 #define IL_JP2			0x0441  //!< Jpeg 2000 - .jp2 extension
227 #define IL_EXR			0x0442  //!< OpenEXR - .exr extension
228 #define IL_WDP			0x0443  //!< Microsoft HD Photo - .wdp and .hdp extension
229 #define IL_VTF			0x0444  //!< Valve Texture Format - .vtf extension
230 #define IL_WBMP			0x0445  //!< Wireless Bitmap - .wbmp extension
231 #define IL_SUN			0x0446  //!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions
232 #define IL_IFF			0x0447  //!< Interchange File Format - .iff extension
233 #define IL_TPL			0x0448  //!< Gamecube Texture - .tpl extension
234 #define IL_FITS			0x0449  //!< Flexible Image Transport System - .fit and .fits extensions
235 #define IL_DICOM		0x044A  //!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions
236 #define IL_IWI			0x044B  //!< Call of Duty Infinity Ward Image - .iwi extension
237 #define IL_BLP			0x044C  //!< Blizzard Texture Format - .blp extension
238 #define IL_FTX			0x044D  //!< Heavy Metal: FAKK2 Texture - .ftx extension
239 #define IL_ROT			0x044E  //!< Homeworld 2 - Relic Texture - .rot extension
240 #define IL_TEXTURE		0x044F  //!< Medieval II: Total War Texture - .texture extension
241 #define IL_DPX			0x0450  //!< Digital Picture Exchange - .dpx extension
242 #define IL_UTX			0x0451  //!< Unreal (and Unreal Tournament) Texture - .utx extension
243 #define IL_MP3			0x0452  //!< MPEG-1 Audio Layer 3 - .mp3 extension
244 
245 
246 #define IL_JASC_PAL     0x0475  //!< PaintShop Pro Palette
247 
248 
249 // Error Types
250 #define IL_NO_ERROR             0x0000
251 #define IL_INVALID_ENUM         0x0501
252 #define IL_OUT_OF_MEMORY        0x0502
253 #define IL_FORMAT_NOT_SUPPORTED 0x0503
254 #define IL_INTERNAL_ERROR       0x0504
255 #define IL_INVALID_VALUE        0x0505
256 #define IL_ILLEGAL_OPERATION    0x0506
257 #define IL_ILLEGAL_FILE_VALUE   0x0507
258 #define IL_INVALID_FILE_HEADER  0x0508
259 #define IL_INVALID_PARAM        0x0509
260 #define IL_COULD_NOT_OPEN_FILE  0x050A
261 #define IL_INVALID_EXTENSION    0x050B
262 #define IL_FILE_ALREADY_EXISTS  0x050C
263 #define IL_OUT_FORMAT_SAME      0x050D
264 #define IL_STACK_OVERFLOW       0x050E
265 #define IL_STACK_UNDERFLOW      0x050F
266 #define IL_INVALID_CONVERSION   0x0510
267 #define IL_BAD_DIMENSIONS       0x0511
268 #define IL_FILE_READ_ERROR      0x0512  // 05/12/2002: Addition by Sam.
269 #define IL_FILE_WRITE_ERROR     0x0512
270 
271 #define IL_LIB_GIF_ERROR  0x05E1
272 #define IL_LIB_JPEG_ERROR 0x05E2
273 #define IL_LIB_PNG_ERROR  0x05E3
274 #define IL_LIB_TIFF_ERROR 0x05E4
275 #define IL_LIB_MNG_ERROR  0x05E5
276 #define IL_LIB_JP2_ERROR  0x05E6
277 #define IL_LIB_EXR_ERROR  0x05E7
278 #define IL_UNKNOWN_ERROR  0x05FF
279 
280 
281 // Origin Definitions
282 #define IL_ORIGIN_SET        0x0600
283 #define IL_ORIGIN_LOWER_LEFT 0x0601
284 #define IL_ORIGIN_UPPER_LEFT 0x0602
285 #define IL_ORIGIN_MODE       0x0603
286 
287 
288 // Format and Type Mode Definitions
289 #define IL_FORMAT_SET  0x0610
290 #define IL_FORMAT_MODE 0x0611
291 #define IL_TYPE_SET    0x0612
292 #define IL_TYPE_MODE   0x0613
293 
294 
295 // File definitions
296 #define IL_FILE_OVERWRITE	0x0620
297 #define IL_FILE_MODE		0x0621
298 
299 
300 // Palette definitions
301 #define IL_CONV_PAL			0x0630
302 
303 
304 // Load fail definitions
305 #define IL_DEFAULT_ON_FAIL	0x0632
306 
307 
308 // Key colour and alpha definitions
309 #define IL_USE_KEY_COLOUR	0x0635
310 #define IL_USE_KEY_COLOR	0x0635
311 #define IL_BLIT_BLEND		0x0636
312 
313 
314 // Interlace definitions
315 #define IL_SAVE_INTERLACED	0x0639
316 #define IL_INTERLACE_MODE	0x063A
317 
318 
319 // Quantization definitions
320 #define IL_QUANTIZATION_MODE 0x0640
321 #define IL_WU_QUANT          0x0641
322 #define IL_NEU_QUANT         0x0642
323 #define IL_NEU_QUANT_SAMPLE  0x0643
324 #define IL_MAX_QUANT_INDEXS  0x0644 //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256
325 #define IL_MAX_QUANT_INDICES 0x0644 // Redefined, since the above #define is misspelled
326 
327 
328 // Hints
329 #define IL_FASTEST          0x0660
330 #define IL_LESS_MEM         0x0661
331 #define IL_DONT_CARE        0x0662
332 #define IL_MEM_SPEED_HINT   0x0665
333 #define IL_USE_COMPRESSION  0x0666
334 #define IL_NO_COMPRESSION   0x0667
335 #define IL_COMPRESSION_HINT 0x0668
336 
337 
338 // Compression
339 #define IL_NVIDIA_COMPRESS	0x0670
340 #define IL_SQUISH_COMPRESS	0x0671
341 
342 
343 // Subimage types
344 #define IL_SUB_NEXT   0x0680
345 #define IL_SUB_MIPMAP 0x0681
346 #define IL_SUB_LAYER  0x0682
347 
348 
349 // Compression definitions
350 #define IL_COMPRESS_MODE 0x0700
351 #define IL_COMPRESS_NONE 0x0701
352 #define IL_COMPRESS_RLE  0x0702
353 #define IL_COMPRESS_LZO  0x0703
354 #define IL_COMPRESS_ZLIB 0x0704
355 
356 
357 // File format-specific values
358 #define IL_TGA_CREATE_STAMP        0x0710
359 #define IL_JPG_QUALITY             0x0711
360 #define IL_PNG_INTERLACE           0x0712
361 #define IL_TGA_RLE                 0x0713
362 #define IL_BMP_RLE                 0x0714
363 #define IL_SGI_RLE                 0x0715
364 #define IL_TGA_ID_STRING           0x0717
365 #define IL_TGA_AUTHNAME_STRING     0x0718
366 #define IL_TGA_AUTHCOMMENT_STRING  0x0719
367 #define IL_PNG_AUTHNAME_STRING     0x071A
368 #define IL_PNG_TITLE_STRING        0x071B
369 #define IL_PNG_DESCRIPTION_STRING  0x071C
370 #define IL_TIF_DESCRIPTION_STRING  0x071D
371 #define IL_TIF_HOSTCOMPUTER_STRING 0x071E
372 #define IL_TIF_DOCUMENTNAME_STRING 0x071F
373 #define IL_TIF_AUTHNAME_STRING     0x0720
374 #define IL_JPG_SAVE_FORMAT         0x0721
375 #define IL_CHEAD_HEADER_STRING     0x0722
376 #define IL_PCD_PICNUM              0x0723
377 #define IL_PNG_ALPHA_INDEX 0x0724 //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color
378 #define IL_JPG_PROGRESSIVE         0x0725
379 #define IL_VTF_COMP                0x0726
380 #define IL_PNG_COMPRESSION         0x0727
381 
382 
383 // DXTC definitions
384 #define IL_DXTC_FORMAT      0x0705
385 #define IL_DXT1             0x0706
386 #define IL_DXT2             0x0707
387 #define IL_DXT3             0x0708
388 #define IL_DXT4             0x0709
389 #define IL_DXT5             0x070A
390 #define IL_DXT_NO_COMP      0x070B
391 #define IL_KEEP_DXTC_DATA   0x070C
392 #define IL_DXTC_DATA_FORMAT 0x070D
393 #define IL_3DC              0x070E
394 #define IL_RXGB             0x070F
395 #define IL_ATI1N            0x0710
396 #define IL_DXT1A            0x0711  // Normally the same as IL_DXT1, except for nVidia Texture Tools.
397 
398 // Environment map definitions
399 #define IL_CUBEMAP_POSITIVEX 0x00000400
400 #define IL_CUBEMAP_NEGATIVEX 0x00000800
401 #define IL_CUBEMAP_POSITIVEY 0x00001000
402 #define IL_CUBEMAP_NEGATIVEY 0x00002000
403 #define IL_CUBEMAP_POSITIVEZ 0x00004000
404 #define IL_CUBEMAP_NEGATIVEZ 0x00008000
405 #define IL_SPHEREMAP         0x00010000
406 
407 
408 // Values
409 #define IL_VERSION_NUM           0x0DE2
410 #define IL_IMAGE_WIDTH           0x0DE4
411 #define IL_IMAGE_HEIGHT          0x0DE5
412 #define IL_IMAGE_DEPTH           0x0DE6
413 #define IL_IMAGE_SIZE_OF_DATA    0x0DE7
414 #define IL_IMAGE_BPP             0x0DE8
415 #define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8
416 #define IL_IMAGE_BPP             0x0DE8
417 #define IL_IMAGE_BITS_PER_PIXEL  0x0DE9
418 #define IL_IMAGE_FORMAT          0x0DEA
419 #define IL_IMAGE_TYPE            0x0DEB
420 #define IL_PALETTE_TYPE          0x0DEC
421 #define IL_PALETTE_SIZE          0x0DED
422 #define IL_PALETTE_BPP           0x0DEE
423 #define IL_PALETTE_NUM_COLS      0x0DEF
424 #define IL_PALETTE_BASE_TYPE     0x0DF0
425 #define IL_NUM_FACES             0x0DE1
426 #define IL_NUM_IMAGES            0x0DF1
427 #define IL_NUM_MIPMAPS           0x0DF2
428 #define IL_NUM_LAYERS            0x0DF3
429 #define IL_ACTIVE_IMAGE          0x0DF4
430 #define IL_ACTIVE_MIPMAP         0x0DF5
431 #define IL_ACTIVE_LAYER          0x0DF6
432 #define IL_ACTIVE_FACE           0x0E00
433 #define IL_CUR_IMAGE             0x0DF7
434 #define IL_IMAGE_DURATION        0x0DF8
435 #define IL_IMAGE_PLANESIZE       0x0DF9
436 #define IL_IMAGE_BPC             0x0DFA
437 #define IL_IMAGE_OFFX            0x0DFB
438 #define IL_IMAGE_OFFY            0x0DFC
439 #define IL_IMAGE_CUBEFLAGS       0x0DFD
440 #define IL_IMAGE_ORIGIN          0x0DFE
441 #define IL_IMAGE_CHANNELS        0x0DFF
442 
443 # if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0))
444 // __attribute__((deprecated)) is supported by GCC 3.1 and later.
445 #  define DEPRECATED(D) D __attribute__((deprecated))
446 # elif defined _MSC_VER && _MSC_VER >= 1300
447 // __declspec(deprecated) is supported by MSVC 7.0 and later.
448 #  define DEPRECATED(D) __declspec(deprecated) D
449 # else
450 #  define DEPRECATED (D) D
451 # endif
452 
453 //
454 // Section shamelessly modified from the glut header.
455 //
456 
457 // This is from Win32's <windef.h>
458 #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
459 	#define ILAPIENTRY __stdcall
460 	#define IL_PACKSTRUCT
461 //#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364
462 #elif defined( __GNUC__ )
463   // this should work for any of the above commented platforms
464   // plus any platform using GCC
465 	#ifdef __MINGW32__
466 		#define ILAPIENTRY __stdcall
467 	#else
468 		#define ILAPIENTRY
469 	#endif
470 	#define IL_PACKSTRUCT __attribute__ ((packed))
471 #else
472 	#define ILAPIENTRY
473 	#define IL_PACKSTRUCT
474 #endif
475 
476 // This is from Win32's <wingdi.h> and <winnt.h>
477 #if defined(__LCC__)
478 	#define ILAPI __stdcall
479 #elif defined(_WIN32) //changed 20031221 to fix bug 840421
480 	#ifdef IL_STATIC_LIB
481 		#define ILAPI
482 	#else
483 		#ifdef _IL_BUILD_LIBRARY
484 			#define ILAPI __declspec(dllexport)
485 		#else
486 			#define ILAPI __declspec(dllimport)
487 		#endif
488 	#endif
489 #elif __APPLE__
490 	#define ILAPI extern
491 #else
492 	#define ILAPI
493 #endif
494 
495 
496 #define IL_SEEK_SET	0
497 #define IL_SEEK_CUR	1
498 #define IL_SEEK_END	2
499 #define IL_EOF		-1
500 
501 
502 // Callback functions for file reading
503 typedef void* ILHANDLE;
504 typedef void      (ILAPIENTRY *fCloseRProc)(ILHANDLE);
505 typedef ILboolean (ILAPIENTRY *fEofProc)   (ILHANDLE);
506 typedef ILint     (ILAPIENTRY *fGetcProc)  (ILHANDLE);
507 typedef ILHANDLE  (ILAPIENTRY *fOpenRProc) (ILconst_string);
508 typedef ILint     (ILAPIENTRY *fReadProc)  (void*, ILuint, ILuint, ILHANDLE);
509 typedef ILint     (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
510 typedef ILint     (ILAPIENTRY *fTellRProc) (ILHANDLE);
511 
512 // Callback functions for file writing
513 typedef void     (ILAPIENTRY *fCloseWProc)(ILHANDLE);
514 typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (ILconst_string);
515 typedef ILint    (ILAPIENTRY *fPutcProc)  (ILubyte, ILHANDLE);
516 typedef ILint    (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
517 typedef ILint    (ILAPIENTRY *fTellWProc) (ILHANDLE);
518 typedef ILint    (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE);
519 
520 // Callback functions for allocation and deallocation
521 typedef void* (ILAPIENTRY *mAlloc)(const ILsizei);
522 typedef void  (ILAPIENTRY *mFree) (const void* CONST_RESTRICT);
523 
524 // Registered format procedures
525 typedef ILenum (ILAPIENTRY *IL_LOADPROC)(ILconst_string);
526 typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(ILconst_string);
527 
528 
529 // ImageLib Functions
530 ILAPI ILboolean ILAPIENTRY ilActiveFace(ILuint Number);
531 ILAPI ILboolean ILAPIENTRY ilActiveImage(ILuint Number);
532 ILAPI ILboolean ILAPIENTRY ilActiveLayer(ILuint Number);
533 ILAPI ILboolean ILAPIENTRY ilActiveMipmap(ILuint Number);
534 ILAPI ILboolean ILAPIENTRY ilApplyPal(ILconst_string FileName);
535 ILAPI ILboolean ILAPIENTRY ilApplyProfile(ILstring InProfile, ILstring OutProfile);
536 ILAPI void		ILAPIENTRY ilBindImage(ILuint Image);
537 ILAPI ILboolean ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth);
538 ILAPI ILboolean ILAPIENTRY ilClampNTSC(void);
539 ILAPI void		ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
540 ILAPI ILboolean ILAPIENTRY ilClearImage(void);
541 ILAPI ILuint    ILAPIENTRY ilCloneCurImage(void);
542 ILAPI ILubyte*	ILAPIENTRY ilCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint *DXTCSize);
543 ILAPI ILboolean ILAPIENTRY ilCompressFunc(ILenum Mode);
544 ILAPI ILboolean ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType);
545 ILAPI ILboolean ILAPIENTRY ilConvertPal(ILenum DestFormat);
546 ILAPI ILboolean ILAPIENTRY ilCopyImage(ILuint Src);
547 ILAPI ILuint    ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data);
548 ILAPI ILuint    ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num);
549 ILAPI ILboolean ILAPIENTRY ilDefaultImage(void);
550 ILAPI void		ILAPIENTRY ilDeleteImage(const ILuint Num);
551 ILAPI void      ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images);
552 ILAPI ILenum	ILAPIENTRY ilDetermineType(ILconst_string FileName);
553 ILAPI ILenum	ILAPIENTRY ilDetermineTypeF(ILHANDLE File);
554 ILAPI ILenum	ILAPIENTRY ilDetermineTypeL(const void *Lump, ILuint Size);
555 ILAPI ILboolean ILAPIENTRY ilDisable(ILenum Mode);
556 ILAPI ILboolean ILAPIENTRY ilDxtcDataToImage(void);
557 ILAPI ILboolean ILAPIENTRY ilDxtcDataToSurface(void);
558 ILAPI ILboolean ILAPIENTRY ilEnable(ILenum Mode);
559 ILAPI void		ILAPIENTRY ilFlipSurfaceDxtcData(void);
560 ILAPI ILboolean ILAPIENTRY ilFormatFunc(ILenum Mode);
561 ILAPI void	    ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images);
562 ILAPI ILuint	ILAPIENTRY ilGenImage(void);
563 ILAPI ILubyte*  ILAPIENTRY ilGetAlpha(ILenum Type);
564 ILAPI ILboolean ILAPIENTRY ilGetBoolean(ILenum Mode);
565 ILAPI void      ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param);
566 ILAPI ILubyte*  ILAPIENTRY ilGetData(void);
567 ILAPI ILuint    ILAPIENTRY ilGetDXTCData(void *Buffer, ILuint BufferSize, ILenum DXTCFormat);
568 ILAPI ILenum    ILAPIENTRY ilGetError(void);
569 ILAPI ILint     ILAPIENTRY ilGetInteger(ILenum Mode);
570 ILAPI void      ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param);
571 ILAPI ILuint    ILAPIENTRY ilGetLumpPos(void);
572 ILAPI ILubyte*  ILAPIENTRY ilGetPalette(void);
573 ILAPI ILconst_string  ILAPIENTRY ilGetString(ILenum StringName);
574 ILAPI void      ILAPIENTRY ilHint(ILenum Target, ILenum Mode);
575 ILAPI ILboolean	ILAPIENTRY ilInvertSurfaceDxtcDataAlpha(void);
576 ILAPI void      ILAPIENTRY ilInit(void);
577 ILAPI ILboolean ILAPIENTRY ilImageToDxtcData(ILenum Format);
578 ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode);
579 ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode);
580 ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image);
581 ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName);
582 ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File);
583 ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, void *Lump, ILuint Size);
584 ILAPI void      ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
585 ILAPI ILboolean ILAPIENTRY ilLoad(ILenum Type, ILconst_string FileName);
586 ILAPI ILboolean ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File);
587 ILAPI ILboolean ILAPIENTRY ilLoadImage(ILconst_string FileName);
588 ILAPI ILboolean ILAPIENTRY ilLoadL(ILenum Type, const void *Lump, ILuint Size);
589 ILAPI ILboolean ILAPIENTRY ilLoadPal(ILconst_string FileName);
590 ILAPI void      ILAPIENTRY ilModAlpha(ILdouble AlphaValue);
591 ILAPI ILboolean ILAPIENTRY ilOriginFunc(ILenum Mode);
592 ILAPI ILboolean ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord);
593 ILAPI void      ILAPIENTRY ilPopAttrib(void);
594 ILAPI void      ILAPIENTRY ilPushAttrib(ILuint Bits);
595 ILAPI void      ILAPIENTRY ilRegisterFormat(ILenum Format);
596 ILAPI ILboolean ILAPIENTRY ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load);
597 ILAPI ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num);
598 ILAPI ILboolean ILAPIENTRY ilRegisterNumFaces(ILuint Num);
599 ILAPI ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num);
600 ILAPI void      ILAPIENTRY ilRegisterOrigin(ILenum Origin);
601 ILAPI void      ILAPIENTRY ilRegisterPal(void *Pal, ILuint Size, ILenum Type);
602 ILAPI ILboolean ILAPIENTRY ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save);
603 ILAPI void      ILAPIENTRY ilRegisterType(ILenum Type);
604 ILAPI ILboolean ILAPIENTRY ilRemoveLoad(ILconst_string Ext);
605 ILAPI ILboolean ILAPIENTRY ilRemoveSave(ILconst_string Ext);
606 ILAPI void      ILAPIENTRY ilResetMemory(void); // Deprecated
607 ILAPI void      ILAPIENTRY ilResetRead(void);
608 ILAPI void      ILAPIENTRY ilResetWrite(void);
609 ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName);
610 ILAPI ILuint    ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File);
611 ILAPI ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName);
612 ILAPI ILuint    ILAPIENTRY ilSaveL(ILenum Type, void *Lump, ILuint Size);
613 ILAPI ILboolean ILAPIENTRY ilSavePal(ILconst_string FileName);
614 ILAPI ILboolean ILAPIENTRY ilSetAlpha(ILdouble AlphaValue);
615 ILAPI ILboolean ILAPIENTRY ilSetData(void *Data);
616 ILAPI ILboolean ILAPIENTRY ilSetDuration(ILuint Duration);
617 ILAPI void      ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param);
618 ILAPI void      ILAPIENTRY ilSetMemory(mAlloc, mFree);
619 ILAPI void      ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data);
620 ILAPI void      ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc);
621 ILAPI void      ILAPIENTRY ilSetString(ILenum Mode, const char *String);
622 ILAPI void      ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc);
623 ILAPI void      ILAPIENTRY ilShutDown(void);
624 ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format);
625 ILAPI ILboolean ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data);
626 ILAPI ILboolean ILAPIENTRY ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const ILubyte* data);
627 ILAPI ILenum    ILAPIENTRY ilTypeFromExt(ILconst_string FileName);
628 ILAPI ILboolean ILAPIENTRY ilTypeFunc(ILenum Mode);
629 ILAPI ILboolean ILAPIENTRY ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
630 ILAPI ILboolean ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
631 ILAPI ILboolean ILAPIENTRY ilLoadDataL(void *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
632 ILAPI ILboolean ILAPIENTRY ilSaveData(ILconst_string FileName);
633 
634 // For all those weirdos that spell "colour" without the 'u'.
635 #define ilClearColor	ilClearColour
636 #define ilKeyColor      ilKeyColour
637 
638 #define imemclear(x,y) memset(x,0,y);
639 
640 #ifdef __cplusplus
641 }
642 #endif
643 
644 #endif // __IL_H__
645 #endif // __il_h__
646