Skip to content

Instantly share code, notes, and snippets.

@xentec
Last active December 22, 2015 08:09
Show Gist options
  • Save xentec/6443122 to your computer and use it in GitHub Desktop.
Save xentec/6443122 to your computer and use it in GitHub Desktop.
devIL 1.7.8 D Interface
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 03/07/2009
//
// Filename: il/il.d
//
// Description: The main include file for DevIL
//
//-----------------------------------------------------------------------------
// Doxygen comment
/*! \file il.d
The main include file for DevIL
*/
module il.il;
//this define controls if floats and doubles are clampled to [0..1]
//during conversion. It takes a little more time, but it is the correct
//way of doing this. If you are sure your floats are always valid,
//you can undefine this value...
enum {
CLAMP_HALF = 1,
CLAMP_FLOATS = 1,
CLAMP_DOUBLES = 1,
}
alias uint ILenum;
alias ubyte ILboolean;
alias uint ILbitfield;
alias char ILbyte;
alias short ILshort;
alias int ILint;
alias size_t ILsizei;
alias ubyte ILubyte;
alias ushort ILushort;
alias uint ILuint;
alias float ILfloat;
alias float ILclampf;
alias double ILdouble;
alias double ILclampd;
alias long ILint64;
alias ulong ILuint64;
version (Unicode) {
alias wchar ILchar;
alias wchar* ILstring;
alias const(wchar)* ILconst_string;
} else {
alias char ILchar;
alias char* ILstring;
alias const(char)* ILconst_string;
}
enum {
IL_FALSE = 0,
IL_TRUE = 1
}
// Matches OpenGL's right now.
//! Data formats \link Formats Formats\endlink
enum {
IL_COLOUR_INDEX = 0x1900,
IL_COLOR_INDEX = 0x1900,
IL_ALPHA = 0x1906,
IL_RGB = 0x1907,
IL_RGBA = 0x1908,
IL_BGR = 0x80E0,
IL_BGRA = 0x80E1,
IL_LUMINANCE = 0x1909,
IL_LUMINANCE_ALPHA = 0x190A
}
//! Data types \link Types Types\endlink
enum {
IL_BYTE = 0x1400,
IL_UNSIGNED_BYTE = 0x1401,
IL_SHORT = 0x1402,
IL_UNSIGNED_SHORT = 0x1403,
IL_INT = 0x1404,
IL_UNSIGNED_INT = 0x1405,
IL_FLOAT = 0x1406,
IL_DOUBLE = 0x140A,
IL_HALF = 0x140B
}
enum {
IL_MAX_BYTE = byte.max,
IL_MAX_UNSIGNED_BYTE = ubyte.max,
IL_MAX_SHORT = short.max,
IL_MAX_UNSIGNED_SHORT = ushort.max,
IL_MAX_INT = int.max,
IL_MAX_UNSIGNED_INT = uint.max
}
/*
bool IL_LIMIT(in int x, in int m, in int M) pure @safe { return (x<m) ? m : ((x>M) ? M : x); }
bool IL_CLAMP(in int x) pure @safe { return IL_LIMIT(x,0,1); }
*/
enum {
IL_VENDOR = 0x1F00,
IL_LOAD_EXT = 0x1F01,
IL_SAVE_EXT = 0x1F02
}
//
// IL-specific #define's
//
enum {
IL_VERSION_1_7_8 = 1,
IL_VERSION = 178
}
// Attribute Bits
enum {
IL_ORIGIN_BIT = 0x00000001,
IL_FILE_BIT = 0x00000002,
IL_PAL_BIT = 0x00000004,
IL_FORMAT_BIT = 0x00000008,
IL_TYPE_BIT = 0x00000010,
IL_COMPRESS_BIT = 0x00000020,
IL_LOADFAIL_BIT = 0x00000040,
IL_FORMAT_SPECIFIC_BIT = 0x00000080,
IL_ALL_ATTRIB_BITS = 0x000FFFFF
}
// Palette types
enum {
IL_PAL_NONE = 0x0400,
IL_PAL_RGB24 = 0x0401,
IL_PAL_RGB32 = 0x0402,
IL_PAL_RGBA32 = 0x0403,
IL_PAL_BGR24 = 0x0404,
IL_PAL_BGR32 = 0x0405,
IL_PAL_BGRA32 = 0x0406
}
// Image types
enum {
IL_TYPE_UNKNOWN = 0x0000,
IL_BMP = 0x0420,//!< Microsoft Windows Bitmap - .bmp extension
IL_CUT = 0x0421,//!< Dr. Halo - .cut extension
IL_DOOM = 0x0422,//!< DooM walls - no specific extension
IL_DOOM_FLAT = 0x0423,//!< DooM flats - no specific extension
IL_ICO = 0x0424,//!< Microsoft Windows Icons and Cursors - .ico and .cur extensions
IL_JPG = 0x0425,//!< JPEG - .jpg, .jpe and .jpeg extensions
IL_JFIF = 0x0425,//!<
IL_ILBM = 0x0426,//!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions
IL_PCD = 0x0427,//!< Kodak PhotoCD - .pcd extension
IL_PCX = 0x0428,//!< ZSoft PCX - .pcx extension
IL_PIC = 0x0429,//!< PIC - .pic extension
IL_PNG = 0x042A,//!< Portable Network Graphics - .png extension
IL_PNM = 0x042B,//!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions
IL_SGI = 0x042C,//!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions
IL_TGA = 0x042D,//!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions
IL_TIF = 0x042E,//!< Tagged Image File Format - .tif and .tiff extensions
IL_CHEAD = 0x042F,//!< C-Style Header - .h extension
IL_RAW = 0x0430,//!< Raw Image Data - any extension
IL_MDL = 0x0431,//!< Half-Life Model Texture - .mdl extension
IL_WAL = 0x0432,//!< Quake 2 Texture - .wal extension
IL_LIF = 0x0434,//!< Homeworld Texture - .lif extension
IL_MNG = 0x0435,//!< Multiple-image Network Graphics - .mng extension
IL_JNG = 0x0435,//!<
IL_GIF = 0x0436,//!< Graphics Interchange Format - .gif extension
IL_DDS = 0x0437,//!< DirectDraw Surface - .dds extension
IL_DCX = 0x0438,//!< ZSoft Multi-PCX - .dcx extension
IL_PSD = 0x0439,//!< Adobe PhotoShop - .psd extension
IL_EXIF = 0x043A,//!<
IL_PSP = 0x043B,//!< PaintShop Pro - .psp extension
IL_PIX = 0x043C,//!< PIX - .pix extension
IL_PXR = 0x043D,//!< Pixar - .pxr extension
IL_XPM = 0x043E,//!< X Pixel Map - .xpm extension
IL_HDR = 0x043F,//!< Radiance High Dynamic Range - .hdr extension
IL_ICNS = 0x0440,//!< Macintosh Icon - .icns extension
IL_JP2 = 0x0441,//!< Jpeg 2000 - .jp2 extension
IL_EXR = 0x0442,//!< OpenEXR - .exr extension
IL_WDP = 0x0443,//!< Microsoft HD Photo - .wdp and .hdp extension
IL_VTF = 0x0444,//!< Valve Texture Format - .vtf extension
IL_WBMP = 0x0445,//!< Wireless Bitmap - .wbmp extension
IL_SUN = 0x0446,//!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions
IL_IFF = 0x0447,//!< Interchange File Format - .iff extension
IL_TPL = 0x0448,//!< Gamecube Texture - .tpl extension
IL_FITS = 0x0449,//!< Flexible Image Transport System - .fit and .fits extensions
IL_DICOM = 0x044A,//!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions
IL_IWI = 0x044B,//!< Call of Duty Infinity Ward Image - .iwi extension
IL_BLP = 0x044C,//!< Blizzard Texture Format - .blp extension
IL_FTX = 0x044D,//!< Heavy Metal: FAKK2 Texture - .ftx extension
IL_ROT = 0x044E,//!< Homeworld 2 - Relic Texture - .rot extension
IL_TEXTURE = 0x044F,//!< Medieval II: Total War Texture - .texture extension
IL_DPX = 0x0450,//!< Digital Picture Exchange - .dpx extension
IL_UTX = 0x0451,//!< Unreal (and Unreal Tournament) Texture - .utx extension
IL_MP3 = 0x0452,//!< MPEG-1 Audio Layer 3 - .mp3 extension
IL_JASC_PAL = 0x0475//!< PaintShop Pro Palette
}
// Error Types
enum {
IL_NO_ERROR = 0x0000,
IL_INVALID_ENUM = 0x0501,
IL_OUT_OF_MEMORY = 0x0502,
IL_FORMAT_NOT_SUPPORTED = 0x0503,
IL_INTERNAL_ERROR = 0x0504,
IL_INVALID_VALUE = 0x0505,
IL_ILLEGAL_OPERATION = 0x0506,
IL_ILLEGAL_FILE_VALUE = 0x0507,
IL_INVALID_FILE_HEADER = 0x0508,
IL_INVALID_PARAM = 0x0509,
IL_COULD_NOT_OPEN_FILE = 0x050A,
IL_INVALID_EXTENSION = 0x050B,
IL_FILE_ALREADY_EXISTS = 0x050C,
IL_OUT_FORMAT_SAME = 0x050D,
IL_STACK_OVERFLOW = 0x050E,
IL_STACK_UNDERFLOW = 0x050F,
IL_INVALID_CONVERSION = 0x0510,
IL_BAD_DIMENSIONS = 0x0511,
IL_FILE_READ_ERROR = 0x0512,// 05/12/2002: Addition by Sam.
IL_FILE_WRITE_ERROR = 0x0512,
IL_LIB_GIF_ERROR = 0x05E1,
IL_LIB_JPEG_ERROR = 0x05E2,
IL_LIB_PNG_ERROR = 0x05E3,
IL_LIB_TIFF_ERROR = 0x05E4,
IL_LIB_MNG_ERROR = 0x05E5,
IL_LIB_JP2_ERROR = 0x05E6,
IL_LIB_EXR_ERROR = 0x05E7,
IL_UNKNOWN_ERROR = 0x05FF
}
// Origin Definitions
enum {
IL_ORIGIN_SET = 0x0600,
IL_ORIGIN_LOWER_LEFT = 0x0601,
IL_ORIGIN_UPPER_LEFT = 0x0602,
IL_ORIGIN_MODE = 0x0603
}
// Format and Type Mode Definitions
enum {
IL_FORMAT_SET = 0x0610,
IL_FORMAT_MODE = 0x0611,
IL_TYPE_SET = 0x0612,
IL_TYPE_MODE = 0x0613,
// File definitions
IL_FILE_OVERWRITE = 0x0620,
IL_FILE_MODE = 0x0621,
// Palette definitions
IL_CONV_PAL = 0x0630,
// Load fail definitions
IL_DEFAULT_ON_FAIL = 0x0632,
// Key colour and alpha definitions
IL_USE_KEY_COLOUR = 0x0635,
IL_USE_KEY_COLOR = 0x0635,
IL_BLIT_BLEND = 0x0636,
// Interlace definitions
IL_SAVE_INTERLACED = 0x0639,
IL_INTERLACE_MODE = 0x063A,
// Quantization definitions
IL_QUANTIZATION_MODE = 0x0640,
IL_WU_QUANT = 0x0641,
IL_NEU_QUANT = 0x0642,
IL_NEU_QUANT_SAMPLE = 0x0643,
IL_MAX_QUANT_INDEXS = 0x0644 ,//XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256
IL_MAX_QUANT_INDICES = 0x0644 ,// Redefined, since the above is = misspelled,
}
// Hints
enum {
IL_FASTEST = 0x0660,
IL_LESS_MEM = 0x0661,
IL_DONT_CARE = 0x0662,
IL_MEM_SPEED_HINT = 0x0665,
IL_USE_COMPRESSION = 0x0666,
IL_NO_COMPRESSION = 0x0667,
IL_COMPRESSION_HINT = 0x0668,
}
// Compression
enum {
IL_NVIDIA_COMPRESS = 0x0670,
IL_SQUISH_COMPRESS = 0x0671,
}
// Subimage types
enum {
IL_SUB_NEXT = 0x0680,
IL_SUB_MIPMAP = 0x0681,
IL_SUB_LAYER = 0x0682,
}
// Compression definitions
enum {
IL_COMPRESS_MODE = 0x0700,
IL_COMPRESS_NONE = 0x0701,
IL_COMPRESS_RLE = 0x0702,
IL_COMPRESS_LZO = 0x0703,
IL_COMPRESS_ZLIB = 0x0704
}
// File format-specific values
enum {
IL_TGA_CREATE_STAMP = 0x0710,
IL_JPG_QUALITY = 0x0711,
IL_PNG_INTERLACE = 0x0712,
IL_TGA_RLE = 0x0713,
IL_BMP_RLE = 0x0714,
IL_SGI_RLE = 0x0715,
IL_TGA_ID_STRING = 0x0717,
IL_TGA_AUTHNAME_STRING = 0x0718,
IL_TGA_AUTHCOMMENT_STRING = 0x0719,
IL_PNG_AUTHNAME_STRING = 0x071A,
IL_PNG_TITLE_STRING = 0x071B,
IL_PNG_DESCRIPTION_STRING = 0x071C,
IL_TIF_DESCRIPTION_STRING = 0x071D,
IL_TIF_HOSTCOMPUTER_STRING = 0x071E,
IL_TIF_DOCUMENTNAME_STRING = 0x071F,
IL_TIF_AUTHNAME_STRING = 0x0720,
IL_JPG_SAVE_FORMAT = 0x0721,
IL_CHEAD_HEADER_STRING = 0x0722,
IL_PCD_PICNUM = 0x0723,
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
IL_JPG_PROGRESSIVE = 0x0725,
IL_VTF_COMP = 0x0726
}
// DXTC definitions
enum {
IL_DXTC_FORMAT = 0x0705,
IL_DXT1 = 0x0706,
IL_DXT2 = 0x0707,
IL_DXT3 = 0x0708,
IL_DXT4 = 0x0709,
IL_DXT5 = 0x070A,
IL_DXT_NO_COMP = 0x070B,
IL_KEEP_DXTC_DATA = 0x070C,
IL_DXTC_DATA_FORMAT = 0x070D,
IL_3DC = 0x070E,
IL_RXGB = 0x070F,
IL_ATI1N = 0x0710,
IL_DXT1A = 0x0711 // Normally the same as IL_DXT1, except for nVidia Texture Tools.
}
// Environment map definitions
enum {
IL_CUBEMAP_POSITIVEX = 0x00000400,
IL_CUBEMAP_NEGATIVEX = 0x00000800,
IL_CUBEMAP_POSITIVEY = 0x00001000,
IL_CUBEMAP_NEGATIVEY = 0x00002000,
IL_CUBEMAP_POSITIVEZ = 0x00004000,
IL_CUBEMAP_NEGATIVEZ = 0x00008000,
IL_SPHEREMAP = 0x00010000
}
// Values
enum {
IL_VERSION_NUM = 0x0DE2,
IL_IMAGE_WIDTH = 0x0DE4,
IL_IMAGE_HEIGHT = 0x0DE5,
IL_IMAGE_DEPTH = 0x0DE6,
IL_IMAGE_SIZE_OF_DATA = 0x0DE7,
IL_IMAGE_BPP = 0x0DE8,
IL_IMAGE_BYTES_PER_PIXEL = 0x0DE8,
IL_IMAGE_BITS_PER_PIXEL = 0x0DE9,
IL_IMAGE_FORMAT = 0x0DEA,
IL_IMAGE_TYPE = 0x0DEB,
IL_PALETTE_TYPE = 0x0DEC,
IL_PALETTE_SIZE = 0x0DED,
IL_PALETTE_BPP = 0x0DEE,
IL_PALETTE_NUM_COLS = 0x0DEF,
IL_PALETTE_BASE_TYPE = 0x0DF0,
IL_NUM_FACES = 0x0DE1,
IL_NUM_IMAGES = 0x0DF1,
IL_NUM_MIPMAPS = 0x0DF2,
IL_NUM_LAYERS = 0x0DF3,
IL_ACTIVE_IMAGE = 0x0DF4,
IL_ACTIVE_MIPMAP = 0x0DF5,
IL_ACTIVE_LAYER = 0x0DF6,
IL_ACTIVE_FACE = 0x0E00,
IL_CUR_IMAGE = 0x0DF7,
IL_IMAGE_DURATION = 0x0DF8,
IL_IMAGE_PLANESIZE = 0x0DF9,
IL_IMAGE_BPC = 0x0DFA,
IL_IMAGE_OFFX = 0x0DFB,
IL_IMAGE_OFFY = 0x0DFC,
IL_IMAGE_CUBEFLAGS = 0x0DFD,
IL_IMAGE_ORIGIN = 0x0DFE,
IL_IMAGE_CHANNELS = 0x0DFF
}
enum {
IL_SEEK_SET = 0,
IL_SEEK_CUR = 1,
IL_SEEK_END = 2,
IL_EOF = -1
}
// Callback functions for file reading
extern (C) {
alias void* ILHANDLE;
alias void function(ILHANDLE) fCloseRProc;
alias ILboolean function(ILHANDLE) fEofProc;
alias ILint function(ILHANDLE) fGetcProc;
alias ILHANDLE function(ILconst_string) fOpenRProc;
alias ILint function(void*, ILuint, ILuint, ILHANDLE) fReadProc;
alias ILint function(ILHANDLE, ILint, ILint) fSeekRProc;
alias ILint function(ILHANDLE) fTellRProc;
// Callback functions for file writing
alias void function(ILHANDLE) fCloseWProc;
alias ILHANDLE function(ILconst_string) fOpenWProc;
alias ILint function(ILubyte, ILHANDLE) fPutcProc;
alias ILint function(ILHANDLE, ILint, ILint) fSeekWProc;
alias ILint function(ILHANDLE) fTellWProc;
alias ILint function(const(void)*, ILuint, ILuint, ILHANDLE) fWriteProc;
// Callback functions for allocation and deallocation
alias void* function(const ILsizei) mAlloc;
alias void function(const(void)*) mFree;
// Registered format procedures
alias ILenum function(ILconst_string) IL_LOADPROC;
alias ILenum function(ILconst_string) IL_SAVEPROC;
}
// ImageLib Functions
extern (System) {
ILboolean ilActiveFace(ILuint Number);
ILboolean ilActiveImage(ILuint Number);
ILboolean ilActiveLayer(ILuint Number);
ILboolean ilActiveMipmap(ILuint Number);
ILboolean ilApplyPal(ILconst_string FileName);
ILboolean ilApplyProfile(ILstring InProfile, ILstring OutProfile);
void ilBindImage(ILuint Image);
ILboolean ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth);
ILboolean ilClampNTSC();
void ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
ILboolean ilClearImage();
ILuint ilCloneCurImage();
ILubyte* ilCompressDXT(ILubyte* Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint* DXTCSize);
ILboolean ilCompressFunc(ILenum Mode);
ILboolean ilConvertImage(ILenum DestFormat, ILenum DestType);
ILboolean ilConvertPal(ILenum DestFormat);
ILboolean ilCopyImage(ILuint Src);
ILuint ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void* Data);
ILuint ilCreateSubImage(ILenum Type, ILuint Num);
ILboolean ilDefaultImage();
void ilDeleteImage(const ILuint Num);
void ilDeleteImages(ILsizei Num, const(ILuint)* Images);
ILenum ilDetermineType(ILconst_string FileName);
ILenum ilDetermineTypeF(ILHANDLE File);
ILenum ilDetermineTypeL(const(void)* Lump, ILuint Size);
ILboolean ilDisable(ILenum Mode);
ILboolean ilDxtcDataToImage();
ILboolean ilDxtcDataToSurface();
ILboolean ilEnable(ILenum Mode);
void ilFlipSurfaceDxtcData();
ILboolean ilFormatFunc(ILenum Mode);
void ilGenImages(ILsizei Num, ILuint* Images);
ILuint ilGenImage();
ILubyte* ilGetAlpha(ILenum Type);
ILboolean ilGetBoolean(ILenum Mode);
void ilGetBooleanv(ILenum Mode, ILboolean* Param);
ILubyte* ilGetData();
ILuint ilGetDXTCData(void* Buffer, ILuint BufferSize, ILenum DXTCFormat);
ILenum ilGetError();
ILint ilGetInteger(ILenum Mode);
void ilGetIntegerv(ILenum Mode, ILint* Param);
ILuint ilGetLumpPos();
ILubyte* ilGetPalette();
ILconst_string ilGetString(ILenum StringName);
void ilHint(ILenum Target, ILenum Mode);
ILboolean ilInvertSurfaceDxtcDataAlpha();
void ilInit();
ILboolean ilImageToDxtcData(ILenum Format);
ILboolean ilIsDisabled(ILenum Mode);
ILboolean ilIsEnabled(ILenum Mode);
ILboolean ilIsImage(ILuint Image);
ILboolean ilIsValid(ILenum Type, ILconst_string FileName);
ILboolean ilIsValidF(ILenum Type, ILHANDLE File);
ILboolean ilIsValidL(ILenum Type, void* Lump, ILuint Size);
void ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
ILboolean ilLoad(ILenum Type, ILconst_string FileName);
ILboolean ilLoadF(ILenum Type, ILHANDLE File);
ILboolean ilLoadImage(ILconst_string FileName);
ILboolean ilLoadL(ILenum Type, const(void)* Lump, ILuint Size);
ILboolean ilLoadPal(ILconst_string FileName);
void ilModAlpha(ILdouble AlphaValue);
ILboolean ilOriginFunc(ILenum Mode);
ILboolean ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord);
void ilPopAttrib();
void ilPushAttrib(ILuint Bits);
void ilRegisterFormat(ILenum Format);
ILboolean ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load);
ILboolean ilRegisterMipNum(ILuint Num);
ILboolean ilRegisterNumFaces(ILuint Num);
ILboolean ilRegisterNumImages(ILuint Num);
void ilRegisterOrigin(ILenum Origin);
void ilRegisterPal(void* Pal, ILuint Size, ILenum Type);
ILboolean ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save);
void ilRegisterType(ILenum Type);
ILboolean ilRemoveLoad(ILconst_string Ext);
ILboolean ilRemoveSave(ILconst_string Ext);
void ilResetMemory(); // Deprecated
void ilResetRead();
void ilResetWrite();
ILboolean ilSave(ILenum Type, ILconst_string FileName);
ILuint ilSaveF(ILenum Type, ILHANDLE File);
ILboolean ilSaveImage(ILconst_string FileName);
ILuint ilSaveL(ILenum Type, void* Lump, ILuint Size);
ILboolean ilSavePal(ILconst_string FileName);
ILboolean ilSetAlpha(ILdouble AlphaValue);
ILboolean ilSetData(void* Data);
ILboolean ilSetDuration(ILuint Duration);
void ilSetInteger(ILenum Mode, ILint Param);
void ilSetMemory(mAlloc, mFree);
void ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void* Data);
void ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc);
void ilSetString(ILenum Mode, const(char)* String);
void ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc);
void ilShutDown();
ILboolean ilSurfaceToDxtcData(ILenum Format);
ILboolean ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void* Data);
ILboolean ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const(ILubyte)* data);
ILenum ilTypeFromExt(ILconst_string FileName);
ILboolean ilTypeFunc(ILenum Mode);
ILboolean ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
ILboolean ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
ILboolean ilLoadDataL(void* Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
ILboolean ilSaveData(ILconst_string FileName);
}
// For all those weirdos that spell "colour" without the 'u'.
alias ilClearColour ilClearColor;
alias ilKeyColour ilKeyColor;
//-----------------------------------------------------------------------------
//
// ImageLib Utility Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 03/07/2009
//
// Filename: il/ilu.d
//
// Description: The main include file for ILU
//
//-----------------------------------------------------------------------------
// Doxygen comment
/*! \file ilu.d
The main include file for ILU
*/
module il.ilu;
import il.il;
enum {
ILU_VERSION_1_7_8 = 1,
ILU_VERSION = 178
}
enum {
ILU_FILTER = 0x2600,
ILU_NEAREST = 0x2601,
ILU_LINEAR = 0x2602,
ILU_BILINEAR = 0x2603,
ILU_SCALE_BOX = 0x2604,
ILU_SCALE_TRIANGLE = 0x2605,
ILU_SCALE_BELL = 0x2606,
ILU_SCALE_BSPLINE = 0x2607,
ILU_SCALE_LANCZOS3 = 0x2608,
ILU_SCALE_MITCHELL = 0x2609
}
// Error types
enum {
ILU_INVALID_ENUM = 0x0501,
ILU_OUT_OF_MEMORY = 0x0502,
ILU_INTERNAL_ERROR = 0x0504,
ILU_INVALID_VALUE = 0x0505,
ILU_ILLEGAL_OPERATION = 0x0506,
ILU_INVALID_PARAM = 0x0509
}
// Values
enum {
ILU_PLACEMENT = 0x0700,
ILU_LOWER_LEFT = 0x0701,
ILU_LOWER_RIGHT = 0x0702,
ILU_UPPER_LEFT = 0x0703,
ILU_UPPER_RIGHT = 0x0704,
ILU_CENTER = 0x0705,
ILU_CONVOLUTION_MATRIX = 0x0710
}
enum {
ILU_VERSION_NUM = IL_VERSION_NUM,
ILU_VENDOR = IL_VENDOR
}
// Languages
enum {
ILU_ENGLISH = 0x0800,
ILU_ARABIC = 0x0801,
ILU_DUTCH = 0x0802,
ILU_JAPANESE = 0x0803,
ILU_SPANISH = 0x0804,
ILU_GERMAN = 0x0805,
ILU_FRENCH = 0x0806
}
// Filters
/*
ILU_FILTER_BLUR = 0x0803,
ILU_FILTER_GAUSSIAN_3x3 = 0x0804,
ILU_FILTER_GAUSSIAN_5X5 = 0x0805,
ILU_FILTER_EMBOSS1 = 0x0807,
ILU_FILTER_EMBOSS2 = 0x0808,
ILU_FILTER_LAPLACIAN1 = 0x080A,
ILU_FILTER_LAPLACIAN2 = 0x080B,
ILU_FILTER_LAPLACIAN3 = 0x080C,
ILU_FILTER_LAPLACIAN4 = 0x080D,
ILU_FILTER_SHARPEN1 = 0x080E,
ILU_FILTER_SHARPEN2 = 0x080F,
ILU_FILTER_SHARPEN3 = 0x0810,
*/
struct ILinfo
{
ILuint Id; // the image's id
ILubyte *Data; // the image's data
ILuint Width; // the image's width
ILuint Height; // the image's height
ILuint Depth; // the image's depth
ILubyte Bpp; // bytes per pixel (not bits) of the image
ILuint SizeOfData; // the total size of the data (in bytes)
ILenum Format; // image format (in IL enum style)
ILenum Type; // image type (in IL enum style)
ILenum Origin; // origin of the image
ILubyte *Palette; // the image's palette
ILenum PalType; // palette type
ILuint PalSize; // palette size
ILenum CubeFlags; // flags for what cube map sides are present
ILuint NumNext; // number of images following
ILuint NumMips; // number of mipmaps
ILuint NumLayers; // number of layers
}
struct ILpointf {
ILfloat x;
ILfloat y;
}
struct ILpointi {
ILint x;
ILint y;
}
extern (System) {
ILboolean iluAlienify();
ILboolean iluBlurAvg(ILuint Iter);
ILboolean iluBlurGaussian(ILuint Iter);
ILboolean iluBuildMipmaps();
ILuint iluColoursUsed();
ILboolean iluCompareImage(ILuint Comp);
ILboolean iluContrast(ILfloat Contrast);
ILboolean iluCrop(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth);
void iluDeleteImage(ILuint Id); // Deprecated
ILboolean iluEdgeDetectE();
ILboolean iluEdgeDetectP();
ILboolean iluEdgeDetectS();
ILboolean iluEmboss();
ILboolean iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth);
ILboolean iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim);
ILboolean iluEqualize();
ILconst_string iluErrorString(ILenum Error);
ILboolean iluConvolution(ILint *matrix, ILint scale, ILint bias);
ILboolean iluFlipImage();
ILboolean iluGammaCorrect(ILfloat Gamma);
ILuint iluGenImage(); // Deprecated
void iluGetImageInfo(ILinfo *Info);
ILint iluGetInteger(ILenum Mode);
void iluGetIntegerv(ILenum Mode, ILint *Param);
ILstring iluGetString(ILenum StringName);
void iluImageParameter(ILenum PName, ILenum Param);
void iluInit();
ILboolean iluInvertAlpha();
ILuint iluLoadImage(ILconst_string FileName);
ILboolean iluMirror();
ILboolean iluNegative();
ILboolean iluNoisify(ILclampf Tolerance);
ILboolean iluPixelize(ILuint PixSize);
void iluRegionfv(ILpointf *Points, ILuint n);
void iluRegioniv(ILpointi *Points, ILuint n);
ILboolean iluReplaceColour(ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance);
ILboolean iluRotate(ILfloat Angle);
ILboolean iluRotate3D(ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
ILboolean iluSaturate1f(ILfloat Saturation);
ILboolean iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
ILboolean iluScale(ILuint Width, ILuint Height, ILuint Depth);
ILboolean iluScaleAlpha(ILfloat scale);
ILboolean iluScaleColours(ILfloat r, ILfloat g, ILfloat b);
ILboolean iluSetLanguage(ILenum Language);
ILboolean iluSharpen(ILfloat Factor, ILuint Iter);
ILboolean iluSwapColours();
ILboolean iluWave(ILfloat Angle);
}
alias iluColoursUsed iluColorsUsed;
alias iluSwapColours iluSwapColors;
alias iluReplaceColour iluReplaceColor;
alias iluScaleColours iluScaleColors;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment