il.h 24 KB

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