[657] | 1 | //-----------------------------------------------------------------------------
|
---|
| 2 | //
|
---|
| 3 | // ImageLib Sources
|
---|
| 4 | // Copyright (C) 2000-2002 by Denton Woods
|
---|
| 5 | // Last modified: 06/23/2002 <--Y2K Compliant! =]
|
---|
| 6 | //
|
---|
| 7 | // Filename: IL/il.h
|
---|
| 8 | //
|
---|
| 9 | // Description: The main include file for DevIL
|
---|
| 10 | //
|
---|
| 11 | //-----------------------------------------------------------------------------
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | #ifndef __il_h_
|
---|
| 15 | #ifndef __IL_H__
|
---|
| 16 |
|
---|
| 17 | #define __il_h_
|
---|
| 18 | #define __IL_H__
|
---|
| 19 |
|
---|
| 20 | #ifdef __cplusplus
|
---|
| 21 | extern "C" {
|
---|
| 22 | #endif
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | //#define IL_NO_BMP
|
---|
| 28 | //#define IL_NO_CUT
|
---|
| 29 | //#define IL_NO_CHEAD
|
---|
| 30 | //#define IL_NO_DCX
|
---|
| 31 | //#define IL_NO_DDS
|
---|
| 32 | //#define IL_NO_DOOM
|
---|
| 33 | //#define IL_NO_GIF
|
---|
| 34 | //#define IL_NO_HDR
|
---|
| 35 | //#define IL_NO_ICO
|
---|
| 36 | //#define IL_NO_JPG
|
---|
| 37 | //#define IL_NO_LIF
|
---|
| 38 | //#define IL_NO_MDL
|
---|
| 39 | //#define IL_NO_MNG
|
---|
| 40 | //#define IL_NO_PCD
|
---|
| 41 | //#define IL_NO_PCX
|
---|
| 42 | //#define IL_NO_PIC
|
---|
| 43 | //#define IL_NO_PIX
|
---|
| 44 | //#define IL_NO_PNG
|
---|
| 45 | //#define IL_NO_PNM
|
---|
| 46 | //#define IL_NO_PSD
|
---|
| 47 | //#define IL_NO_PSP
|
---|
| 48 | //#define IL_NO_PXR
|
---|
| 49 | //#define IL_NO_RAW
|
---|
| 50 | //#define IL_NO_SGI
|
---|
| 51 | //#define IL_NO_TGA
|
---|
| 52 | //#define IL_NO_TIF
|
---|
| 53 | //#define IL_NO_WAL
|
---|
| 54 | //#define IL_NO_XPM
|
---|
| 55 |
|
---|
| 56 | // Compiling Options
|
---|
| 57 | #define IL_INLINE_ASM
|
---|
| 58 | //#define IL_DEBUG
|
---|
| 59 | //#define IL_STATIC_LIB
|
---|
| 60 | //#define IL_NO_LCMS
|
---|
| 61 |
|
---|
| 62 | //This is now in config.h
|
---|
| 63 | //#ifdef _WIN32
|
---|
| 64 | // #ifndef IL_USE_JPEGLIB_UNMODIFIED
|
---|
| 65 | // #define IL_USE_JPEGLIB_UNMODIFIED
|
---|
| 66 | // #endif
|
---|
| 67 | //#endif
|
---|
| 68 |
|
---|
| 69 | #ifdef _WIN32_WCE
|
---|
| 70 | #define IL_NO_GIF
|
---|
| 71 | #define IL_NO_JPG
|
---|
| 72 | #define IL_NO_MNG
|
---|
| 73 | #define IL_NO_PNG
|
---|
| 74 | #define IL_NO_TIF
|
---|
| 75 | #define IL_NO_LCMS
|
---|
| 76 | #endif//_WIN32_WCE
|
---|
| 77 |
|
---|
| 78 | #ifdef DJGPP
|
---|
| 79 | #define IL_NO_GIF
|
---|
| 80 | #define IL_NO_JPG
|
---|
| 81 | #define IL_NO_MNG
|
---|
| 82 | #define IL_NO_PNG
|
---|
| 83 | #define IL_NO_TIF
|
---|
| 84 | #define IL_NO_LCMS
|
---|
| 85 | #endif//DJGPP
|
---|
| 86 |
|
---|
| 87 | /*#ifdef __APPLE__
|
---|
| 88 | #define IL_NO_GIF
|
---|
| 89 | #define IL_NO_JPG
|
---|
| 90 | #define IL_NO_MNG
|
---|
| 91 | #define IL_NO_PNG
|
---|
| 92 | #define IL_NO_TIF
|
---|
| 93 | #define IL_NO_LCMS
|
---|
| 94 | #endif//__APPLE__*/
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | #ifdef _WIN32
|
---|
| 98 | #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
|
---|
| 99 | #if defined(_MSC_VER) || defined(__BORLANDC__)
|
---|
| 100 | #pragma comment(lib, "DevIL.lib")
|
---|
| 101 | #endif
|
---|
| 102 | #endif
|
---|
| 103 | #endif
|
---|
| 104 |
|
---|
| 105 | #include <stdio.h>
|
---|
| 106 |
|
---|
| 107 | typedef unsigned int ILenum;
|
---|
| 108 | typedef unsigned char ILboolean;
|
---|
| 109 | typedef unsigned int ILbitfield;
|
---|
| 110 | typedef char ILbyte;
|
---|
| 111 | typedef short ILshort;
|
---|
| 112 | typedef int ILint;
|
---|
| 113 | typedef int ILsizei;
|
---|
| 114 | typedef unsigned char ILubyte;
|
---|
| 115 | typedef unsigned short ILushort;
|
---|
| 116 | typedef unsigned int ILuint;
|
---|
| 117 | typedef float ILfloat;
|
---|
| 118 | typedef float ILclampf;
|
---|
| 119 | typedef double ILdouble;
|
---|
| 120 | typedef double ILclampd;
|
---|
| 121 | typedef void ILvoid;
|
---|
| 122 |
|
---|
| 123 | #ifdef _UNICODE
|
---|
| 124 | #ifndef _WIN32_WCE
|
---|
| 125 | #include <wchar.h>
|
---|
| 126 | #endif
|
---|
| 127 | typedef wchar_t* ILstring;
|
---|
| 128 | #else
|
---|
| 129 | typedef char* ILstring;
|
---|
| 130 | #endif//_UNICODE
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 | #define IL_FALSE 0
|
---|
| 134 | #define IL_TRUE 1
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | // Matches OpenGL's right now.
|
---|
| 138 | #define IL_COLOUR_INDEX 0x1900
|
---|
| 139 | #define IL_COLOR_INDEX 0x1900
|
---|
| 140 | #define IL_RGB 0x1907
|
---|
| 141 | #define IL_RGBA 0x1908
|
---|
| 142 | #define IL_BGR 0x80E0
|
---|
| 143 | #define IL_BGRA 0x80E1
|
---|
| 144 | #define IL_LUMINANCE 0x1909
|
---|
| 145 | #define IL_LUMINANCE_ALPHA 0x190A
|
---|
| 146 |
|
---|
| 147 |
|
---|
| 148 | #define IL_BYTE 0x1400
|
---|
| 149 | #define IL_UNSIGNED_BYTE 0x1401
|
---|
| 150 | #define IL_SHORT 0x1402
|
---|
| 151 | #define IL_UNSIGNED_SHORT 0x1403
|
---|
| 152 | #define IL_INT 0x1404
|
---|
| 153 | #define IL_UNSIGNED_INT 0x1405
|
---|
| 154 | #define IL_FLOAT 0x1406
|
---|
| 155 | #define IL_DOUBLE 0x140A
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | #define IL_VENDOR 0x1F00
|
---|
| 159 | #define IL_LOAD_EXT 0x1F01
|
---|
| 160 | #define IL_SAVE_EXT 0x1F02
|
---|
| 161 |
|
---|
| 162 |
|
---|
| 163 | //
|
---|
| 164 | // IL-specific #define's
|
---|
| 165 | //
|
---|
| 166 |
|
---|
| 167 | #define IL_VERSION_1_6_7 1
|
---|
| 168 | #define IL_VERSION 167
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | // Attribute Bits
|
---|
| 172 | #define IL_ORIGIN_BIT 0x00000001
|
---|
| 173 | #define IL_FILE_BIT 0x00000002
|
---|
| 174 | #define IL_PAL_BIT 0x00000004
|
---|
| 175 | #define IL_FORMAT_BIT 0x00000008
|
---|
| 176 | #define IL_TYPE_BIT 0x00000010
|
---|
| 177 | #define IL_COMPRESS_BIT 0x00000020
|
---|
| 178 | #define IL_LOADFAIL_BIT 0x00000040
|
---|
| 179 | #define IL_FORMAT_SPECIFIC_BIT 0x00000080
|
---|
| 180 | #define IL_ALL_ATTRIB_BITS 0x000FFFFF
|
---|
| 181 |
|
---|
| 182 |
|
---|
| 183 | // Palette types
|
---|
| 184 | #define IL_PAL_NONE 0x0400
|
---|
| 185 | #define IL_PAL_RGB24 0x0401
|
---|
| 186 | #define IL_PAL_RGB32 0x0402
|
---|
| 187 | #define IL_PAL_RGBA32 0x0403
|
---|
| 188 | #define IL_PAL_BGR24 0x0404
|
---|
| 189 | #define IL_PAL_BGR32 0x0405
|
---|
| 190 | #define IL_PAL_BGRA32 0x0406
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | // Image types
|
---|
| 194 | #define IL_TYPE_UNKNOWN 0x0000
|
---|
| 195 | #define IL_BMP 0x0420
|
---|
| 196 | #define IL_CUT 0x0421
|
---|
| 197 | #define IL_DOOM 0x0422
|
---|
| 198 | #define IL_DOOM_FLAT 0x0423
|
---|
| 199 | #define IL_ICO 0x0424
|
---|
| 200 | #define IL_JPG 0x0425
|
---|
| 201 | #define IL_JFIF 0x0425
|
---|
| 202 | #define IL_LBM 0x0426
|
---|
| 203 | #define IL_PCD 0x0427
|
---|
| 204 | #define IL_PCX 0x0428
|
---|
| 205 | #define IL_PIC 0x0429
|
---|
| 206 | #define IL_PNG 0x042A
|
---|
| 207 | #define IL_PNM 0x042B
|
---|
| 208 | #define IL_SGI 0x042C
|
---|
| 209 | #define IL_TGA 0x042D
|
---|
| 210 | #define IL_TIF 0x042E
|
---|
| 211 | #define IL_CHEAD 0x042F
|
---|
| 212 | #define IL_RAW 0x0430
|
---|
| 213 | #define IL_MDL 0x0431
|
---|
| 214 | #define IL_WAL 0x0432
|
---|
| 215 | #define IL_LIF 0x0434
|
---|
| 216 | #define IL_MNG 0x0435
|
---|
| 217 | #define IL_JNG 0x0435
|
---|
| 218 | #define IL_GIF 0x0436
|
---|
| 219 | #define IL_DDS 0x0437
|
---|
| 220 | #define IL_DCX 0x0438
|
---|
| 221 | #define IL_PSD 0x0439
|
---|
| 222 | #define IL_EXIF 0x043A
|
---|
| 223 | #define IL_PSP 0x043B
|
---|
| 224 | #define IL_PIX 0x043C
|
---|
| 225 | #define IL_PXR 0x043D
|
---|
| 226 | #define IL_XPM 0x043E
|
---|
| 227 | #define IL_HDR 0x043F
|
---|
| 228 |
|
---|
| 229 | #define IL_JASC_PAL 0x0475
|
---|
| 230 |
|
---|
| 231 |
|
---|
| 232 | // Error Types
|
---|
| 233 | #define IL_NO_ERROR 0x0000
|
---|
| 234 | #define IL_INVALID_ENUM 0x0501
|
---|
| 235 | #define IL_OUT_OF_MEMORY 0x0502
|
---|
| 236 | #define IL_FORMAT_NOT_SUPPORTED 0x0503
|
---|
| 237 | #define IL_INTERNAL_ERROR 0x0504
|
---|
| 238 | #define IL_INVALID_VALUE 0x0505
|
---|
| 239 | #define IL_ILLEGAL_OPERATION 0x0506
|
---|
| 240 | #define IL_ILLEGAL_FILE_VALUE 0x0507
|
---|
| 241 | #define IL_INVALID_FILE_HEADER 0x0508
|
---|
| 242 | #define IL_INVALID_PARAM 0x0509
|
---|
| 243 | #define IL_COULD_NOT_OPEN_FILE 0x050A
|
---|
| 244 | #define IL_INVALID_EXTENSION 0x050B
|
---|
| 245 | #define IL_FILE_ALREADY_EXISTS 0x050C
|
---|
| 246 | #define IL_OUT_FORMAT_SAME 0x050D
|
---|
| 247 | #define IL_STACK_OVERFLOW 0x050E
|
---|
| 248 | #define IL_STACK_UNDERFLOW 0x050F
|
---|
| 249 | #define IL_INVALID_CONVERSION 0x0510
|
---|
| 250 | #define IL_BAD_DIMENSIONS 0x0511
|
---|
| 251 | #define IL_FILE_READ_ERROR 0x0512 // 05/12/2002: Addition by Sam.
|
---|
| 252 | #define IL_FILE_WRITE_ERROR 0x0512
|
---|
| 253 |
|
---|
| 254 | #define IL_LIB_GIF_ERROR 0x05E1
|
---|
| 255 | #define IL_LIB_JPEG_ERROR 0x05E2
|
---|
| 256 | #define IL_LIB_PNG_ERROR 0x05E3
|
---|
| 257 | #define IL_LIB_TIFF_ERROR 0x05E4
|
---|
| 258 | #define IL_LIB_MNG_ERROR 0x05E5
|
---|
| 259 | #define IL_UNKNOWN_ERROR 0x05FF
|
---|
| 260 |
|
---|
| 261 |
|
---|
| 262 | // Origin Definitions
|
---|
| 263 | #define IL_ORIGIN_SET 0x0600
|
---|
| 264 | #define IL_ORIGIN_LOWER_LEFT 0x0601
|
---|
| 265 | #define IL_ORIGIN_UPPER_LEFT 0x0602
|
---|
| 266 | #define IL_ORIGIN_MODE 0x0603
|
---|
| 267 |
|
---|
| 268 |
|
---|
| 269 | // Format and Type Mode Definitions
|
---|
| 270 | #define IL_FORMAT_SET 0x0610
|
---|
| 271 | #define IL_FORMAT_MODE 0x0611
|
---|
| 272 | #define IL_TYPE_SET 0x0612
|
---|
| 273 | #define IL_TYPE_MODE 0x0613
|
---|
| 274 |
|
---|
| 275 |
|
---|
| 276 | // File definitions
|
---|
| 277 | #define IL_FILE_OVERWRITE 0x0620
|
---|
| 278 | #define IL_FILE_MODE 0x0621
|
---|
| 279 |
|
---|
| 280 |
|
---|
| 281 | // Palette definitions
|
---|
| 282 | #define IL_CONV_PAL 0x0630
|
---|
| 283 |
|
---|
| 284 |
|
---|
| 285 | // Load fail definitions
|
---|
| 286 | #define IL_DEFAULT_ON_FAIL 0x0632
|
---|
| 287 |
|
---|
| 288 |
|
---|
| 289 | // Key colour definitions
|
---|
| 290 | #define IL_USE_KEY_COLOUR 0x0635
|
---|
| 291 | #define IL_USE_KEY_COLOR 0x0635
|
---|
| 292 |
|
---|
| 293 |
|
---|
| 294 | // Interlace definitions
|
---|
| 295 | #define IL_SAVE_INTERLACED 0x0639
|
---|
| 296 | #define IL_INTERLACE_MODE 0x063A
|
---|
| 297 |
|
---|
| 298 |
|
---|
| 299 | // Quantization definitions
|
---|
| 300 | #define IL_QUANTIZATION_MODE 0x0640
|
---|
| 301 | #define IL_WU_QUANT 0x0641
|
---|
| 302 | #define IL_NEU_QUANT 0x0642
|
---|
| 303 | #define IL_NEU_QUANT_SAMPLE 0x0643
|
---|
| 304 | #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
|
---|
| 305 |
|
---|
| 306 |
|
---|
| 307 | // Hints
|
---|
| 308 | #define IL_FASTEST 0x0660
|
---|
| 309 | #define IL_LESS_MEM 0x0661
|
---|
| 310 | #define IL_DONT_CARE 0x0662
|
---|
| 311 | #define IL_MEM_SPEED_HINT 0x0665
|
---|
| 312 | #define IL_USE_COMPRESSION 0x0666
|
---|
| 313 | #define IL_NO_COMPRESSION 0x0667
|
---|
| 314 | #define IL_COMPRESSION_HINT 0x0668
|
---|
| 315 |
|
---|
| 316 |
|
---|
| 317 | // Subimage types
|
---|
| 318 | #define IL_SUB_NEXT 0x0680
|
---|
| 319 | #define IL_SUB_MIPMAP 0x0681
|
---|
| 320 | #define IL_SUB_LAYER 0x0682
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | // Compression definitions
|
---|
| 324 | #define IL_COMPRESS_MODE 0x0700
|
---|
| 325 | #define IL_COMPRESS_NONE 0x0701
|
---|
| 326 | #define IL_COMPRESS_RLE 0x0702
|
---|
| 327 | #define IL_COMPRESS_LZO 0x0703
|
---|
| 328 | #define IL_COMPRESS_ZLIB 0x0704
|
---|
| 329 |
|
---|
| 330 |
|
---|
| 331 | // File format-specific values
|
---|
| 332 | #define IL_TGA_CREATE_STAMP 0x0710
|
---|
| 333 | #define IL_JPG_QUALITY 0x0711
|
---|
| 334 | #define IL_PNG_INTERLACE 0x0712
|
---|
| 335 | #define IL_TGA_RLE 0x0713
|
---|
| 336 | #define IL_BMP_RLE 0x0714
|
---|
| 337 | #define IL_SGI_RLE 0x0715
|
---|
| 338 | #define IL_TGA_ID_STRING 0x0717
|
---|
| 339 | #define IL_TGA_AUTHNAME_STRING 0x0718
|
---|
| 340 | #define IL_TGA_AUTHCOMMENT_STRING 0x0719
|
---|
| 341 | #define IL_PNG_AUTHNAME_STRING 0x071A
|
---|
| 342 | #define IL_PNG_TITLE_STRING 0x071B
|
---|
| 343 | #define IL_PNG_DESCRIPTION_STRING 0x071C
|
---|
| 344 | #define IL_TIF_DESCRIPTION_STRING 0x071D
|
---|
| 345 | #define IL_TIF_HOSTCOMPUTER_STRING 0x071E
|
---|
| 346 | #define IL_TIF_DOCUMENTNAME_STRING 0x071F
|
---|
| 347 | #define IL_TIF_AUTHNAME_STRING 0x0720
|
---|
| 348 | #define IL_JPG_SAVE_FORMAT 0x0721
|
---|
| 349 | #define IL_CHEAD_HEADER_STRING 0x0722
|
---|
| 350 | #define IL_PCD_PICNUM 0x0723
|
---|
| 351 |
|
---|
| 352 | #define IL_PNG_ALPHA_INDEX 0x0724 //XIX : ILint : the color in the pallete at this index value (0-255) is considered transparent, -1 for no trasparent color
|
---|
| 353 |
|
---|
| 354 | // DXTC definitions
|
---|
| 355 | #define IL_DXTC_FORMAT 0x0705
|
---|
| 356 | #define IL_DXT1 0x0706
|
---|
| 357 | #define IL_DXT2 0x0707
|
---|
| 358 | #define IL_DXT3 0x0708
|
---|
| 359 | #define IL_DXT4 0x0709
|
---|
| 360 | #define IL_DXT5 0x070A
|
---|
| 361 | #define IL_DXT_NO_COMP 0x070B
|
---|
| 362 | #define IL_KEEP_DXTC_DATA 0x070C
|
---|
| 363 | #define IL_DXTC_DATA_FORMAT 0x070D
|
---|
| 364 | #define IL_3DC 0x070E
|
---|
| 365 | #define IL_RXGB 0x070F
|
---|
| 366 |
|
---|
| 367 |
|
---|
| 368 | // Cube map definitions
|
---|
| 369 | #define IL_CUBEMAP_POSITIVEX 0x00000400
|
---|
| 370 | #define IL_CUBEMAP_NEGATIVEX 0x00000800
|
---|
| 371 | #define IL_CUBEMAP_POSITIVEY 0x00001000
|
---|
| 372 | #define IL_CUBEMAP_NEGATIVEY 0x00002000
|
---|
| 373 | #define IL_CUBEMAP_POSITIVEZ 0x00004000
|
---|
| 374 | #define IL_CUBEMAP_NEGATIVEZ 0x00008000
|
---|
| 375 |
|
---|
| 376 |
|
---|
| 377 | // Values
|
---|
| 378 | #define IL_VERSION_NUM 0x0DE2
|
---|
| 379 | #define IL_IMAGE_WIDTH 0x0DE4
|
---|
| 380 | #define IL_IMAGE_HEIGHT 0x0DE5
|
---|
| 381 | #define IL_IMAGE_DEPTH 0x0DE6
|
---|
| 382 | #define IL_IMAGE_SIZE_OF_DATA 0x0DE7
|
---|
| 383 | #define IL_IMAGE_BPP 0x0DE8
|
---|
| 384 | #define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8
|
---|
| 385 | #define IL_IMAGE_BPP 0x0DE8
|
---|
| 386 | #define IL_IMAGE_BITS_PER_PIXEL 0x0DE9
|
---|
| 387 | #define IL_IMAGE_FORMAT 0x0DEA
|
---|
| 388 | #define IL_IMAGE_TYPE 0x0DEB
|
---|
| 389 | #define IL_PALETTE_TYPE 0x0DEC
|
---|
| 390 | #define IL_PALETTE_SIZE 0x0DED
|
---|
| 391 | #define IL_PALETTE_BPP 0x0DEE
|
---|
| 392 | #define IL_PALETTE_NUM_COLS 0x0DEF
|
---|
| 393 | #define IL_PALETTE_BASE_TYPE 0x0DF0
|
---|
| 394 | #define IL_NUM_IMAGES 0x0DF1
|
---|
| 395 | #define IL_NUM_MIPMAPS 0x0DF2
|
---|
| 396 | #define IL_NUM_LAYERS 0x0DF3
|
---|
| 397 | #define IL_ACTIVE_IMAGE 0x0DF4
|
---|
| 398 | #define IL_ACTIVE_MIPMAP 0x0DF5
|
---|
| 399 | #define IL_ACTIVE_LAYER 0x0DF6
|
---|
| 400 | #define IL_CUR_IMAGE 0x0DF7
|
---|
| 401 | #define IL_IMAGE_DURATION 0x0DF8
|
---|
| 402 | #define IL_IMAGE_PLANESIZE 0x0DF9
|
---|
| 403 | #define IL_IMAGE_BPC 0x0DFA
|
---|
| 404 | #define IL_IMAGE_OFFX 0x0DFB
|
---|
| 405 | #define IL_IMAGE_OFFY 0x0DFC
|
---|
| 406 | #define IL_IMAGE_CUBEFLAGS 0x0DFD
|
---|
| 407 | #define IL_IMAGE_ORIGIN 0x0DFE
|
---|
| 408 | #define IL_IMAGE_CHANNELS 0x0DFF
|
---|
| 409 |
|
---|
| 410 | //
|
---|
| 411 | // Section shamelessly modified from the glut header.
|
---|
| 412 | //
|
---|
| 413 |
|
---|
| 414 | // This is from Win32's <windef.h>
|
---|
| 415 | #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
|
---|
| 416 | #define ILAPIENTRY __stdcall
|
---|
| 417 | #define IL_PACKSTRUCT
|
---|
| 418 | //#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364
|
---|
| 419 | #elif defined( __GNUC__ )
|
---|
| 420 | // this should work for any of the above commented platforms
|
---|
| 421 | // plus any platform using GCC
|
---|
| 422 | #define ILAPIENTRY
|
---|
| 423 | #define IL_PACKSTRUCT __attribute__ ((packed))
|
---|
| 424 | #else
|
---|
| 425 | #define ILAPIENTRY
|
---|
| 426 | #define IL_PACKSTRUCT
|
---|
| 427 | #endif
|
---|
| 428 |
|
---|
| 429 | // This is from Win32's <wingdi.h> and <winnt.h>
|
---|
| 430 | #if defined(__LCC__)
|
---|
| 431 | #define ILAPI __stdcall
|
---|
| 432 | #elif defined(_WIN32) //changed 20031221 to fix bug 840421
|
---|
| 433 | #ifdef IL_STATIC_LIB
|
---|
| 434 | #define ILAPI
|
---|
| 435 | #else
|
---|
| 436 | #ifdef _IL_BUILD_LIBRARY
|
---|
| 437 | #define ILAPI __declspec(dllexport)
|
---|
| 438 | #else
|
---|
| 439 | #define ILAPI __declspec(dllimport)
|
---|
| 440 | #endif
|
---|
| 441 | #endif
|
---|
| 442 | #elif __APPLE__
|
---|
| 443 | #define ILAPI extern
|
---|
| 444 | #else
|
---|
| 445 | #define ILAPI
|
---|
| 446 | #endif
|
---|
| 447 |
|
---|
| 448 |
|
---|
| 449 | #define IL_SEEK_SET 0
|
---|
| 450 | #define IL_SEEK_CUR 1
|
---|
| 451 | #define IL_SEEK_END 2
|
---|
| 452 | #define IL_EOF -1
|
---|
| 453 |
|
---|
| 454 |
|
---|
| 455 | // Callback functions for file reading
|
---|
| 456 | typedef void* ILHANDLE;
|
---|
| 457 | typedef ILvoid (ILAPIENTRY *fCloseRProc)(ILHANDLE);
|
---|
| 458 | typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE);
|
---|
| 459 | typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE);
|
---|
| 460 | typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (const ILstring);
|
---|
| 461 | typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE);
|
---|
| 462 | typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
|
---|
| 463 | typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE);
|
---|
| 464 |
|
---|
| 465 | // Callback functions for file writing
|
---|
| 466 | typedef ILvoid (ILAPIENTRY *fCloseWProc)(ILHANDLE);
|
---|
| 467 | typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (const ILstring);
|
---|
| 468 | typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE);
|
---|
| 469 | typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
|
---|
| 470 | typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE);
|
---|
| 471 | typedef ILint (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE);
|
---|
| 472 |
|
---|
| 473 | // Callback functions for allocation and deallocation
|
---|
| 474 | typedef ILvoid* (ILAPIENTRY *mAlloc)(ILuint);
|
---|
| 475 | typedef ILvoid (ILAPIENTRY *mFree) (ILvoid*);
|
---|
| 476 |
|
---|
| 477 | // Registered format procedures
|
---|
| 478 | typedef ILenum (ILAPIENTRY *IL_LOADPROC)(const ILstring);
|
---|
| 479 | typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(const ILstring);
|
---|
| 480 |
|
---|
| 481 |
|
---|
| 482 | // ImageLib Functions
|
---|
| 483 | ILAPI ILboolean ILAPIENTRY ilActiveImage(ILuint Number);
|
---|
| 484 | ILAPI ILboolean ILAPIENTRY ilActiveLayer(ILuint Number);
|
---|
| 485 | ILAPI ILboolean ILAPIENTRY ilActiveMipmap(ILuint Number);
|
---|
| 486 | ILAPI ILboolean ILAPIENTRY ilApplyPal(const ILstring FileName);
|
---|
| 487 | ILAPI ILboolean ILAPIENTRY ilApplyProfile(const ILstring InProfile, const ILstring OutProfile);
|
---|
| 488 | ILAPI ILvoid ILAPIENTRY ilBindImage(ILuint Image);
|
---|
| 489 | ILAPI ILboolean ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth);
|
---|
| 490 | ILAPI ILvoid ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
|
---|
| 491 | ILAPI ILboolean ILAPIENTRY ilClearImage(ILvoid);
|
---|
| 492 | ILAPI ILuint ILAPIENTRY ilCloneCurImage(ILvoid);
|
---|
| 493 | ILAPI ILboolean ILAPIENTRY ilCompressFunc(ILenum Mode);
|
---|
| 494 | ILAPI ILboolean ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType);
|
---|
| 495 | ILAPI ILboolean ILAPIENTRY ilConvertPal(ILenum DestFormat);
|
---|
| 496 | ILAPI ILboolean ILAPIENTRY ilCopyImage(ILuint Src);
|
---|
| 497 | ILAPI ILuint ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data);
|
---|
| 498 | ILAPI ILuint ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num);
|
---|
| 499 | ILAPI ILboolean ILAPIENTRY ilDefaultImage(ILvoid);
|
---|
| 500 | ILAPI ILvoid ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images);
|
---|
| 501 | ILAPI ILboolean ILAPIENTRY ilDisable(ILenum Mode);
|
---|
| 502 | ILAPI ILboolean ILAPIENTRY ilEnable(ILenum Mode);
|
---|
| 503 | ILAPI ILboolean ILAPIENTRY ilFormatFunc(ILenum Mode);
|
---|
| 504 | ILAPI ILvoid ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images);
|
---|
| 505 | ILAPI ILubyte* ILAPIENTRY ilGetAlpha(ILenum Type);
|
---|
| 506 | ILAPI ILvoid ILAPIENTRY ilModAlpha( ILdouble AlphaValue );
|
---|
| 507 | ILAPI ILvoid ILAPIENTRY ilSetAlpha( ILdouble AlphaValue );
|
---|
| 508 | ILAPI ILboolean ILAPIENTRY ilGetBoolean(ILenum Mode);
|
---|
| 509 | ILAPI ILvoid ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param);
|
---|
| 510 | ILAPI ILubyte* ILAPIENTRY ilGetData(ILvoid);
|
---|
| 511 | ILAPI ILuint ILAPIENTRY ilGetDXTCData(ILvoid *Buffer, ILuint BufferSize, ILenum DXTCFormat);
|
---|
| 512 | ILAPI ILenum ILAPIENTRY ilGetError(ILvoid);
|
---|
| 513 | ILAPI ILint ILAPIENTRY ilGetInteger(ILenum Mode);
|
---|
| 514 | ILAPI ILvoid ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param);
|
---|
| 515 | ILAPI ILuint ILAPIENTRY ilGetLumpPos(ILvoid);
|
---|
| 516 | ILAPI ILubyte* ILAPIENTRY ilGetPalette(ILvoid);
|
---|
| 517 | ILAPI ILstring ILAPIENTRY ilGetString(ILenum StringName);
|
---|
| 518 | ILAPI ILvoid ILAPIENTRY ilHint(ILenum Target, ILenum Mode);
|
---|
| 519 | ILAPI ILvoid ILAPIENTRY ilInit(ILvoid);
|
---|
| 520 | ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode);
|
---|
| 521 | ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode);
|
---|
| 522 | ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image);
|
---|
| 523 | ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, const ILstring FileName);
|
---|
| 524 | ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File);
|
---|
| 525 | ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, ILvoid *Lump, ILuint Size);
|
---|
| 526 | ILAPI ILvoid ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
|
---|
| 527 | ILAPI ILboolean ILAPIENTRY ilLoad(ILenum Type, const ILstring FileName);
|
---|
| 528 | ILAPI ILboolean ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File);
|
---|
| 529 | ILAPI ILboolean ILAPIENTRY ilLoadImage(const ILstring FileName);
|
---|
| 530 | ILAPI ILboolean ILAPIENTRY ilLoadL(ILenum Type, ILvoid *Lump, ILuint Size);
|
---|
| 531 | ILAPI ILboolean ILAPIENTRY ilLoadPal(const ILstring FileName);
|
---|
| 532 | ILAPI ILboolean ILAPIENTRY ilOriginFunc(ILenum Mode);
|
---|
| 533 | ILAPI ILboolean ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord);
|
---|
| 534 | ILAPI ILvoid ILAPIENTRY ilPopAttrib(ILvoid);
|
---|
| 535 | ILAPI ILvoid ILAPIENTRY ilPushAttrib(ILuint Bits);
|
---|
| 536 | ILAPI ILvoid ILAPIENTRY ilRegisterFormat(ILenum Format);
|
---|
| 537 | ILAPI ILboolean ILAPIENTRY ilRegisterLoad(const ILstring Ext, IL_LOADPROC Load);
|
---|
| 538 | ILAPI ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num);
|
---|
| 539 | ILAPI ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num);
|
---|
| 540 | ILAPI ILvoid ILAPIENTRY ilRegisterOrigin(ILenum Origin);
|
---|
| 541 | ILAPI ILvoid ILAPIENTRY ilRegisterPal(ILvoid *Pal, ILuint Size, ILenum Type);
|
---|
| 542 | ILAPI ILboolean ILAPIENTRY ilRegisterSave(const ILstring Ext, IL_SAVEPROC Save);
|
---|
| 543 | ILAPI ILvoid ILAPIENTRY ilRegisterType(ILenum Type);
|
---|
| 544 | ILAPI ILboolean ILAPIENTRY ilRemoveLoad(const ILstring Ext);
|
---|
| 545 | ILAPI ILboolean ILAPIENTRY ilRemoveSave(const ILstring Ext);
|
---|
| 546 | ILAPI ILvoid ILAPIENTRY ilResetMemory(ILvoid);
|
---|
| 547 | ILAPI ILvoid ILAPIENTRY ilResetRead(ILvoid);
|
---|
| 548 | ILAPI ILvoid ILAPIENTRY ilResetWrite(ILvoid);
|
---|
| 549 | ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, const ILstring FileName);
|
---|
| 550 | ILAPI ILuint ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File);
|
---|
| 551 | ILAPI ILboolean ILAPIENTRY ilSaveImage(const ILstring FileName);
|
---|
| 552 | ILAPI ILuint ILAPIENTRY ilSaveL(ILenum Type, ILvoid *Lump, ILuint Size);
|
---|
| 553 | ILAPI ILboolean ILAPIENTRY ilSavePal(const ILstring FileName);
|
---|
| 554 | ILAPI ILboolean ILAPIENTRY ilSetData(ILvoid *Data);
|
---|
| 555 | ILAPI ILboolean ILAPIENTRY ilSetDuration(ILuint Duration);
|
---|
| 556 | ILAPI ILvoid ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param);
|
---|
| 557 | ILAPI ILvoid ILAPIENTRY ilSetMemory(mAlloc, mFree);
|
---|
| 558 | ILAPI ILvoid ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data);
|
---|
| 559 | ILAPI ILvoid ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc);
|
---|
| 560 | ILAPI ILvoid ILAPIENTRY ilSetString(ILenum Mode, const char *String);
|
---|
| 561 | ILAPI ILvoid ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc);
|
---|
| 562 | ILAPI ILvoid ILAPIENTRY ilShutDown(ILvoid);
|
---|
| 563 | ILAPI ILboolean ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte numChannels, ILenum Format, ILenum Type, ILvoid *Data);
|
---|
| 564 | ILAPI ILboolean ILAPIENTRY ilTypeFunc(ILenum Mode);
|
---|
| 565 |
|
---|
| 566 | ILAPI ILboolean ILAPIENTRY ilLoadData(const ILstring FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
---|
| 567 | ILAPI ILboolean ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
---|
| 568 | ILAPI ILboolean ILAPIENTRY ilLoadDataL(ILvoid *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
---|
| 569 | ILAPI ILboolean ILAPIENTRY ilSaveData(const ILstring FileName);
|
---|
| 570 |
|
---|
| 571 | ILAPI ILboolean ILAPIENTRY ilLoadFromJpegStruct(ILvoid* JpegDecompressorPtr);
|
---|
| 572 | ILAPI ILboolean ILAPIENTRY ilSaveFromJpegStruct(ILvoid* JpegCompressorPtr);
|
---|
| 573 |
|
---|
| 574 | // For all those weirdos that spell "colour" without the 'u'.
|
---|
| 575 | #define ilClearColor ilClearColour
|
---|
| 576 | #define ilKeyColor ilKeyColour
|
---|
| 577 |
|
---|
| 578 |
|
---|
| 579 | #ifdef __cplusplus
|
---|
| 580 | }
|
---|
| 581 | #endif
|
---|
| 582 |
|
---|
| 583 | #endif // __IL_H__
|
---|
| 584 | #endif // __il_h__
|
---|
| 585 |
|
---|
| 586 | #define imemclear(x,y) memset(x,0,y);
|
---|