删除DevIL
This commit is contained in:
parent
bea1366a89
commit
0e6db3b1dc
@ -1,13 +0,0 @@
|
|||||||
%module DevIL
|
|
||||||
%{
|
|
||||||
#include "il.h"
|
|
||||||
#include "ilu.h"
|
|
||||||
#include "ilut.h"
|
|
||||||
//#include "ilu_region.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "il.h"
|
|
||||||
%include "ilu.h"
|
|
||||||
%include "ilut.h"
|
|
||||||
//%include "ilu_region.h"
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
IL_INCLUDE_PATH="/usr/include"
|
|
||||||
IL_LIB_PATH="/usr/lib"
|
|
||||||
LUA_INCLUDE_PATH="/usr/include/lua5.1"
|
|
||||||
LUA_LIB_PATH="/usr/lib"
|
|
||||||
OSX=no
|
|
||||||
|
|
||||||
echo "Building the lua binding!"
|
|
||||||
|
|
||||||
export SWIG_FEATURES="-I$IL_INCLUDE_PATH"
|
|
||||||
swig -lua DevIL.i
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo "swig Failed to build the lua interface"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
compile() {
|
|
||||||
gcc luadevil.c "$1" -o luadevil "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT -llua5.1 &>/dev/null
|
|
||||||
err=$?
|
|
||||||
if [ "$OSX" = "no" ] ; then
|
|
||||||
gcc -shared "$1" -o DevIL.so "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT &>/dev/null
|
|
||||||
else
|
|
||||||
gcc -bundle -undefined dynamic_lookup "$1" -o DevIL.so "-L$LUA_LIB_PATH" "-I$LUA_INCLUDE_PATH" "-I$IL_LIB_PATH" -lIL -lILU -lILUT &>/dev/null
|
|
||||||
fi
|
|
||||||
return $err
|
|
||||||
}
|
|
||||||
|
|
||||||
compile DevIL_wrap.c
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo 'Failed compilation'
|
|
||||||
echo 'On some platform the file malloc.h is not present and produces a compilation error'
|
|
||||||
echo -n 'it can be removed safely, try [y/n] ? '
|
|
||||||
while read i ; do
|
|
||||||
if [ "$i" = "y" ] ; then
|
|
||||||
sed 's/\#include\ \<malloc\.h\>//' < DevIL_wrap.c > DevIL_wrap.mod.c
|
|
||||||
compile "DevIL_wrap.mod.c"
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo 'still failing...'
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
elif [ "$i" = "n" ] ; then
|
|
||||||
echo 'ok, failing...'
|
|
||||||
exit 3
|
|
||||||
else
|
|
||||||
echo 'Unknown command [y/n] ? '
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "ok!"
|
|
||||||
exit 0
|
|
@ -1,17 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
|
|
||||||
IL_INCLUDE_PATH="/usr/local/include"
|
|
||||||
IL_LIB_PATH="/usr/local/lib"
|
|
||||||
PYTHON_INCLUDE_PATH="/usr/include/python2.5"
|
|
||||||
|
|
||||||
swig "-I$IL_INCLUDE_PATH" -python -interface DevIL DevIL.i
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo Error while building the swig interface
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
gcc -shared "-I$IL_INCLUDE_PATH" "-I$PYTHON_INCLUDE_PATH" "-L$IL_LIB_PATH" -lIL -lILU -lILUT DevIL_wrap.c -o DevIL.so
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
echo Error while compiling the python module
|
|
||||||
fi
|
|
||||||
echo "DevIL.py and DevIL.so are ready"
|
|
@ -1,79 +0,0 @@
|
|||||||
#ifndef __CONFIG_H__
|
|
||||||
#define __CONFIG_H__
|
|
||||||
|
|
||||||
#define IL_USE_PRAGMA_LIBS // Links to only the libraries that are requested.
|
|
||||||
#define IL_INLINE_ASM 1 // Define if you can support at least some ASM
|
|
||||||
|
|
||||||
// Supported images formats (IL)
|
|
||||||
|
|
||||||
// #define IL_NO_BLP
|
|
||||||
// #define IL_NO_BMP
|
|
||||||
// #define IL_NO_CUT
|
|
||||||
// #define IL_NO_CHEAD
|
|
||||||
// #define IL_NO_DCX
|
|
||||||
// #define IL_NO_DDS
|
|
||||||
// #define IL_NO_DICOM
|
|
||||||
// #define IL_NO_DOOM
|
|
||||||
// #define IL_NO_EXR
|
|
||||||
// #define IL_NO_FITS
|
|
||||||
// #define IL_NO_FTX
|
|
||||||
// #define IL_NO_GIF
|
|
||||||
// #define IL_NO_HDR
|
|
||||||
// #define IL_NO_ICO
|
|
||||||
// #define IL_NO_ICNS
|
|
||||||
// #define IL_NO_IWI
|
|
||||||
// #define IL_NO_JP2
|
|
||||||
// #define IL_NO_JPG
|
|
||||||
// #define IL_NO_LCMS
|
|
||||||
// #define IL_NO_LIF
|
|
||||||
// #define IL_NO_MDL
|
|
||||||
// #define IL_NO_MNG
|
|
||||||
// #define IL_NO_PCD
|
|
||||||
// #define IL_NO_PCX
|
|
||||||
// #define IL_NO_PIC
|
|
||||||
// #define IL_NO_PIX
|
|
||||||
// #define IL_NO_PNG
|
|
||||||
// #define IL_NO_PNM
|
|
||||||
// #define IL_NO_PSD
|
|
||||||
// #define IL_NO_PSP
|
|
||||||
// #define IL_NO_PXR
|
|
||||||
// #define IL_NO_RAW
|
|
||||||
// #define IL_NO_ROT
|
|
||||||
// #define IL_NO_SGI
|
|
||||||
// #define IL_NO_SUN
|
|
||||||
// #define IL_NO_TGA
|
|
||||||
// #define IL_NO_TIF
|
|
||||||
// #define IL_NO_TPL
|
|
||||||
// #define IL_NO_WAL
|
|
||||||
// #define IL_NO_WDP
|
|
||||||
// #define IL_NO_XPM
|
|
||||||
|
|
||||||
#define IL_USE_JPEGLIB_UNMODIFIED 1
|
|
||||||
#define IL_USE_DXTC_NVIDIA
|
|
||||||
#define IL_USE_DXTC_SQUISH
|
|
||||||
|
|
||||||
//#define IL_NO_GAMES
|
|
||||||
|
|
||||||
/* Supported api (ilut) */
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// sorry just
|
|
||||||
// cant get this one to work under windows
|
|
||||||
// have disabled for the now
|
|
||||||
//
|
|
||||||
// will look at it some more later
|
|
||||||
//
|
|
||||||
// Kriss
|
|
||||||
//
|
|
||||||
#undef ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
#undef ILUT_USE_DIRECTX8
|
|
||||||
#define ILUT_USE_DIRECTX9
|
|
||||||
#define ILUT_USE_DIRECTX10
|
|
||||||
#define ILUT_USE_OPENGL
|
|
||||||
#define ILUT_USE_SDL
|
|
||||||
#define ILUT_USE_WIN32
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CONFIG_H__ */
|
|
@ -1,952 +0,0 @@
|
|||||||
#ifndef DEVIL_CPP_WRAPPER_HPP
|
|
||||||
#define DEVIL_CPP_WRAPPER_HPP
|
|
||||||
|
|
||||||
#include <IL/ilut.h> // Probably only have to #include this one
|
|
||||||
|
|
||||||
class ilImage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ilImage();
|
|
||||||
ilImage(ILconst_string);
|
|
||||||
ilImage(const ilImage &);
|
|
||||||
virtual ~ilImage();
|
|
||||||
|
|
||||||
ILboolean Load(ILconst_string);
|
|
||||||
ILboolean Load(ILconst_string, ILenum);
|
|
||||||
ILboolean Save(ILconst_string);
|
|
||||||
ILboolean Save(ILconst_string, ILenum);
|
|
||||||
|
|
||||||
// ImageLib functions
|
|
||||||
ILboolean ActiveImage(ILuint);
|
|
||||||
ILboolean ActiveLayer(ILuint);
|
|
||||||
ILboolean ActiveMipmap(ILuint);
|
|
||||||
ILboolean Clear(void);
|
|
||||||
void ClearColour(ILclampf, ILclampf, ILclampf, ILclampf);
|
|
||||||
ILboolean Convert(ILenum);
|
|
||||||
ILboolean Copy(ILuint);
|
|
||||||
ILboolean Default(void);
|
|
||||||
ILboolean Flip(void);
|
|
||||||
ILboolean SwapColours(void);
|
|
||||||
ILboolean Resize(ILuint, ILuint, ILuint);
|
|
||||||
ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*);
|
|
||||||
|
|
||||||
// Image handling
|
|
||||||
void Bind(void) const;
|
|
||||||
void Bind(ILuint);
|
|
||||||
void Close(void) { this->Delete(); }
|
|
||||||
void Delete(void);
|
|
||||||
void iGenBind();
|
|
||||||
ILenum PaletteAlphaIndex();
|
|
||||||
|
|
||||||
// Image characteristics
|
|
||||||
ILuint Width(void);
|
|
||||||
ILuint Height(void);
|
|
||||||
ILuint Depth(void);
|
|
||||||
ILubyte Bpp(void);
|
|
||||||
ILubyte Bitpp(void);
|
|
||||||
ILenum PaletteType(void);
|
|
||||||
ILenum Format(void);
|
|
||||||
ILenum Type(void);
|
|
||||||
ILuint NumImages(void);
|
|
||||||
ILuint NumMipmaps(void);
|
|
||||||
ILuint GetId(void) const;
|
|
||||||
ILenum GetOrigin(void);
|
|
||||||
ILubyte *GetData(void);
|
|
||||||
ILubyte *GetPalette(void);
|
|
||||||
|
|
||||||
// Rendering
|
|
||||||
ILuint BindImage(void);
|
|
||||||
ILuint BindImage(ILenum);
|
|
||||||
|
|
||||||
// Operators
|
|
||||||
ilImage& operator = (ILuint);
|
|
||||||
ilImage& operator = (const ilImage &);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ILuint Id;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static int ilStartUp();
|
|
||||||
static ILboolean ilStartedUp;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ensure that init is called exactly once
|
|
||||||
int ilImage::ilStartUp()
|
|
||||||
{
|
|
||||||
ilInit();
|
|
||||||
iluInit();
|
|
||||||
//ilutInit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
ILboolean ilImage::ilStartedUp = ilStartUp();
|
|
||||||
|
|
||||||
class ilFilters
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Alienify(ilImage &);
|
|
||||||
static ILboolean BlurAvg(ilImage &, ILuint Iter);
|
|
||||||
static ILboolean BlurGaussian(ilImage &, ILuint Iter);
|
|
||||||
static ILboolean Contrast(ilImage &, ILfloat Contrast);
|
|
||||||
static ILboolean EdgeDetectE(ilImage &);
|
|
||||||
static ILboolean EdgeDetectP(ilImage &);
|
|
||||||
static ILboolean EdgeDetectS(ilImage &);
|
|
||||||
static ILboolean Emboss(ilImage &);
|
|
||||||
static ILboolean Gamma(ilImage &, ILfloat Gamma);
|
|
||||||
static ILboolean Negative(ilImage &);
|
|
||||||
static ILboolean Noisify(ilImage &, ILubyte Factor);
|
|
||||||
static ILboolean Pixelize(ilImage &, ILuint PixSize);
|
|
||||||
static ILboolean Saturate(ilImage &, ILfloat Saturation);
|
|
||||||
static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
|
|
||||||
static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b);
|
|
||||||
static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter);
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_OPENGL
|
|
||||||
class ilOgl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void Init(void);
|
|
||||||
static GLuint BindTex(ilImage &);
|
|
||||||
static ILboolean Upload(ilImage &, ILuint);
|
|
||||||
static GLuint Mipmap(ilImage &);
|
|
||||||
static ILboolean Screen(void);
|
|
||||||
static ILboolean Screenie(void);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_OPENGL
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_ALLEGRO
|
|
||||||
class ilAlleg
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void Init(void);
|
|
||||||
static BITMAP *Convert(ilImage &);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_WIN32
|
|
||||||
class ilWin32
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void Init(void);
|
|
||||||
static HBITMAP Convert(ilImage &);
|
|
||||||
static ILboolean GetClipboard(ilImage &);
|
|
||||||
static void GetInfo(ilImage &, BITMAPINFO *Info);
|
|
||||||
static ILubyte *GetPadData(ilImage &);
|
|
||||||
static HPALETTE GetPal(ilImage &);
|
|
||||||
static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType);
|
|
||||||
static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type);
|
|
||||||
static ILboolean SetClipboard(ilImage &);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_WIN32
|
|
||||||
|
|
||||||
|
|
||||||
class ilValidate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Valid(ILenum, ILconst_string);
|
|
||||||
static ILboolean Valid(ILenum, FILE *);
|
|
||||||
static ILboolean Valid(ILenum, void *, ILuint);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class ilState
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Disable(ILenum);
|
|
||||||
static ILboolean Enable(ILenum);
|
|
||||||
static void Get(ILenum, ILboolean &);
|
|
||||||
static void Get(ILenum, ILint &);
|
|
||||||
static ILboolean GetBool(ILenum);
|
|
||||||
static ILint GetInt(ILenum);
|
|
||||||
static const char *GetString(ILenum);
|
|
||||||
static ILboolean IsDisabled(ILenum);
|
|
||||||
static ILboolean IsEnabled(ILenum);
|
|
||||||
static ILboolean Origin(ILenum);
|
|
||||||
static void Pop(void);
|
|
||||||
static void Push(ILuint);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ilError
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void Check(void (*Callback)(const char*));
|
|
||||||
static void Check(void (*Callback)(ILenum));
|
|
||||||
static ILenum Get(void);
|
|
||||||
static const char *String(void);
|
|
||||||
static const char *String(ILenum);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILIMAGE
|
|
||||||
//
|
|
||||||
ilImage::ilImage()
|
|
||||||
{
|
|
||||||
this->Id = 0;
|
|
||||||
//this->iStartUp(); // This was commented out, but it needs to be somewhere...
|
|
||||||
this->iGenBind();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ilImage::ilImage(ILconst_string FileName)
|
|
||||||
{
|
|
||||||
this->Id = 0;
|
|
||||||
//this->iStartUp(); // This was commented out, but it needs to be somewhere...
|
|
||||||
this->iGenBind();
|
|
||||||
ilLoadImage(FileName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ilImage::ilImage(const ilImage &Image)
|
|
||||||
{
|
|
||||||
this->Id = 0;
|
|
||||||
// this->iStartUp();
|
|
||||||
this->iGenBind();
|
|
||||||
*this = Image;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ilImage::~ilImage()
|
|
||||||
{
|
|
||||||
if (this->Id)
|
|
||||||
ilDeleteImages(1, &this->Id);
|
|
||||||
this->Id = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Load(ILconst_string FileName)
|
|
||||||
{
|
|
||||||
this->iGenBind();
|
|
||||||
return ilLoadImage(FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Load(ILconst_string FileName, ILenum Type)
|
|
||||||
{
|
|
||||||
this->iGenBind();
|
|
||||||
return ilLoad(Type, FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Save(ILconst_string FileName)
|
|
||||||
{
|
|
||||||
this->iGenBind();
|
|
||||||
return ilSaveImage(FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Save(ILconst_string FileName, ILenum Type)
|
|
||||||
{
|
|
||||||
this->iGenBind();
|
|
||||||
return ilSave(Type, FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ImageLib functions
|
|
||||||
//
|
|
||||||
ILboolean ilImage::ActiveImage(ILuint Number)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilActiveImage(Number);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::ActiveLayer(ILuint Number)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilActiveLayer(Number);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::ActiveMipmap(ILuint Number)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilActiveMipmap(Number);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Clear()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilClearImage();
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ilImage::ClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha)
|
|
||||||
{
|
|
||||||
ilClearColour(Red, Green, Blue, Alpha);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Convert(ILenum NewFormat)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilConvertImage(NewFormat, IL_UNSIGNED_BYTE);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Copy(ILuint Src)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilCopyImage(Src);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Default()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilDefaultImage();
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Flip()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return iluFlipImage();
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::SwapColours()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return iluSwapColours();
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::Resize(ILuint Width, ILuint Height, ILuint Depth)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return iluScale(Width, Height, Depth);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilImage::TexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data)
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilTexImage(Width, Height, Depth, Bpp, Format, Type, Data);
|
|
||||||
}
|
|
||||||
return IL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Image handling
|
|
||||||
//
|
|
||||||
void ilImage::Bind() const
|
|
||||||
{
|
|
||||||
if (this->Id)
|
|
||||||
ilBindImage(this->Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Behaviour may be changed!
|
|
||||||
void ilImage::Bind(ILuint Image)
|
|
||||||
{
|
|
||||||
if (this->Id == Image)
|
|
||||||
return;
|
|
||||||
this->Delete(); // Should we delete it?
|
|
||||||
this->Id = Image;
|
|
||||||
ilBindImage(this->Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ilImage::Delete()
|
|
||||||
{
|
|
||||||
if (this->Id == 0)
|
|
||||||
return;
|
|
||||||
ilDeleteImages(1, &this->Id);
|
|
||||||
this->Id = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Image characteristics
|
|
||||||
//
|
|
||||||
ILuint ilImage::Width()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_WIDTH);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILuint ilImage::Height()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_HEIGHT);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILuint ilImage::Depth()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_DEPTH);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILubyte ilImage::Bpp()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILubyte ilImage::Bitpp()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::Format()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_FORMAT);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::PaletteType()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_PALETTE_TYPE);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::PaletteAlphaIndex()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_PNG_ALPHA_INDEX);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::Type()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_IMAGE_TYPE);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::NumImages()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_NUM_IMAGES);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::NumMipmaps()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetInteger(IL_NUM_MIPMAPS);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILuint ilImage::GetId() const
|
|
||||||
{
|
|
||||||
return this->Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilImage::GetOrigin(void)
|
|
||||||
{
|
|
||||||
ILinfo Info;
|
|
||||||
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
iluGetImageInfo(&Info);
|
|
||||||
return Info.Origin;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILubyte* ilImage::GetData()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetData();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILubyte* ilImage::GetPalette()
|
|
||||||
{
|
|
||||||
if (this->Id) {
|
|
||||||
this->Bind();
|
|
||||||
return ilGetPalette();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Private members
|
|
||||||
//
|
|
||||||
/*void ilImage::iStartUp()
|
|
||||||
{
|
|
||||||
ilInit();
|
|
||||||
iluInit();
|
|
||||||
ilutInit();
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void ilImage::iGenBind()
|
|
||||||
{
|
|
||||||
if (this->Id == 0) {
|
|
||||||
ilGenImages(1, &this->Id);
|
|
||||||
}
|
|
||||||
ilBindImage(this->Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Operators
|
|
||||||
//
|
|
||||||
ilImage& ilImage::operator = (ILuint Image)
|
|
||||||
{
|
|
||||||
if (this->Id == 0)
|
|
||||||
this->Id = Image;
|
|
||||||
else {
|
|
||||||
this->Bind();
|
|
||||||
ilCopyImage(Image);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilImage& ilImage::operator = (const ilImage &Image)
|
|
||||||
{
|
|
||||||
if (Id == 0)
|
|
||||||
Id = Image.GetId();
|
|
||||||
else {
|
|
||||||
Bind();
|
|
||||||
ilCopyImage(Image.GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILFILTERS
|
|
||||||
//
|
|
||||||
ILboolean ilFilters::Alienify(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluAlienify();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::BlurAvg(ilImage &Image, ILuint Iter)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluBlurAvg(Iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::BlurGaussian(ilImage &Image, ILuint Iter)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluBlurGaussian(Iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Contrast(ilImage &Image, ILfloat Contrast)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluContrast(Contrast);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::EdgeDetectE(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluEdgeDetectP();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::EdgeDetectP(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluEdgeDetectP();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::EdgeDetectS(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluEdgeDetectS();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Emboss(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluEmboss();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Gamma(ilImage &Image, ILfloat Gamma)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluGammaCorrect(Gamma);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Negative(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluNegative();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Noisify(ilImage &Image, ILubyte Factor)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluNoisify(Factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Pixelize(ilImage &Image, ILuint PixSize)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluPixelize(PixSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Saturate(ilImage &Image, ILfloat Saturation)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluSaturate1f(Saturation);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::Saturate(ilImage &Image, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluSaturate4f(r, g, b, Saturation);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilFilters::ScaleColours(ilImage &Image, ILfloat r, ILfloat g, ILfloat b)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluScaleColours(r, g, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilFilters::Sharpen(ilImage &Image, ILfloat Factor, ILuint Iter)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return iluSharpen(Factor, Iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILOPENGL
|
|
||||||
//
|
|
||||||
#ifdef ILUT_USE_OPENGL
|
|
||||||
void ilOgl::Init()
|
|
||||||
{
|
|
||||||
ilutRenderer(ILUT_OPENGL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GLuint ilOgl::BindTex(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGLBindTexImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilOgl::Upload(ilImage &Image, ILuint Level)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGLTexImage(Level);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GLuint ilOgl::Mipmap(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGLBuildMipmaps();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilOgl::Screen()
|
|
||||||
{
|
|
||||||
return ilutGLScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ILboolean ilOgl::Screenie()
|
|
||||||
{
|
|
||||||
return ilutGLScreenie();
|
|
||||||
}
|
|
||||||
#endif//ILUT_USE_OPENGL
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILALLEGRO
|
|
||||||
//
|
|
||||||
#ifdef ILUT_USE_ALLEGRO
|
|
||||||
void ilAlleg::Init()
|
|
||||||
{
|
|
||||||
ilutRenderer(IL_ALLEGRO);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BITMAP *ilAlleg::Convert(ilImage &Image, PALETTE Pal)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutConvertToAlleg(Pal);
|
|
||||||
}
|
|
||||||
#endif//ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILWIN32
|
|
||||||
//
|
|
||||||
#ifdef ILUT_USE_WIN32
|
|
||||||
void ilWin32::Init()
|
|
||||||
{
|
|
||||||
ilutRenderer(ILUT_WIN32);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HBITMAP ilWin32::Convert(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutConvertToHBitmap(GetDC(NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilWin32::GetClipboard(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGetWinClipboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilWin32::GetInfo(ilImage &Image, BITMAPINFO *Info)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
ilutGetBmpInfo(Info);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILubyte* ilWin32::GetPadData(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGetPaddedData();
|
|
||||||
}
|
|
||||||
|
|
||||||
HPALETTE ilWin32::GetPal(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutGetHPal();
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutLoadResource(hInst, ID, ResourceType, IL_TYPE_UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutLoadResource(hInst, ID, ResourceType, Type);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilWin32::SetClipboard(ilImage &Image)
|
|
||||||
{
|
|
||||||
Image.Bind();
|
|
||||||
return ilutSetWinClipboard();
|
|
||||||
}
|
|
||||||
#endif//ILUT_USE_WIN32
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILVALIDATE
|
|
||||||
//
|
|
||||||
ILboolean ilValidate::Valid(ILenum Type, ILconst_string FileName)
|
|
||||||
{
|
|
||||||
return ilIsValid(Type, FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilValidate::Valid(ILenum Type, FILE *File)
|
|
||||||
{
|
|
||||||
return ilIsValidF(Type, File);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilValidate::Valid(ILenum Type, void *Lump, ILuint Size)
|
|
||||||
{
|
|
||||||
return ilIsValidL(Type, Lump, Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILSTATE
|
|
||||||
//
|
|
||||||
ILboolean ilState::Disable(ILenum State)
|
|
||||||
{
|
|
||||||
return ilDisable(State);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilState::Enable(ILenum State)
|
|
||||||
{
|
|
||||||
return ilEnable(State);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilState::Get(ILenum Mode, ILboolean &Param)
|
|
||||||
{
|
|
||||||
ilGetBooleanv(Mode, &Param);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilState::Get(ILenum Mode, ILint &Param)
|
|
||||||
{
|
|
||||||
ilGetIntegerv(Mode, &Param);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilState::GetBool(ILenum Mode)
|
|
||||||
{
|
|
||||||
return ilGetBoolean(Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILint ilState::GetInt(ILenum Mode)
|
|
||||||
{
|
|
||||||
return ilGetInteger(Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ilState::GetString(ILenum StringName)
|
|
||||||
{
|
|
||||||
return ilGetString(StringName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilState::IsDisabled(ILenum Mode)
|
|
||||||
{
|
|
||||||
return ilIsDisabled(Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilState::IsEnabled(ILenum Mode)
|
|
||||||
{
|
|
||||||
return ilIsEnabled(Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILboolean ilState::Origin(ILenum Mode)
|
|
||||||
{
|
|
||||||
return ilOriginFunc(Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilState::Pop()
|
|
||||||
{
|
|
||||||
ilPopAttrib();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilState::Push(ILuint Bits = IL_ALL_ATTRIB_BITS)
|
|
||||||
{
|
|
||||||
ilPushAttrib(Bits);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// ILERROR
|
|
||||||
//
|
|
||||||
void ilError::Check(void (*Callback)(const char*))
|
|
||||||
{
|
|
||||||
static ILenum Error;
|
|
||||||
|
|
||||||
while ((Error = ilGetError()) != IL_NO_ERROR) {
|
|
||||||
Callback(iluErrorString(Error));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ilError::Check(void (*Callback)(ILenum))
|
|
||||||
{
|
|
||||||
static ILenum Error;
|
|
||||||
|
|
||||||
while ((Error = ilGetError()) != IL_NO_ERROR) {
|
|
||||||
Callback(Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ILenum ilError::Get()
|
|
||||||
{
|
|
||||||
return ilGetError();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ilError::String()
|
|
||||||
{
|
|
||||||
return iluErrorString(ilGetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ilError::String(ILenum Error)
|
|
||||||
{
|
|
||||||
return iluErrorString(Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif// DEVIL_CPP_WRAPPER_HPP
|
|
@ -1,159 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ImageLib Sources
|
|
||||||
// Copyright (C) 2000-2017 by Denton Woods
|
|
||||||
// Last modified: 01/06/2009
|
|
||||||
//
|
|
||||||
// Filename: IL/devil_internal_exports.h
|
|
||||||
//
|
|
||||||
// Description: Internal stuff for DevIL (IL, ILU and ILUT)
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef IL_EXPORTS_H
|
|
||||||
#define IL_EXPORTS_H
|
|
||||||
|
|
||||||
#include "IL/il.h"
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#include <assert.h>
|
|
||||||
#else
|
|
||||||
#define assert(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef NOINLINE
|
|
||||||
// No inlining. Treat all inline funcs as static.
|
|
||||||
// Functions will be replicated in all translation units
|
|
||||||
// use them.
|
|
||||||
#define STATIC_INLINE static
|
|
||||||
#else
|
|
||||||
#if defined(_MSC_VER) && !defined(__cplusplus)
|
|
||||||
// MSVC compiler uses __inline when compiling C (not C++)
|
|
||||||
#define STATIC_INLINE static __inline
|
|
||||||
#else
|
|
||||||
// Portable across C99, GNU89, C++...
|
|
||||||
#define STATIC_INLINE static inline
|
|
||||||
#endif
|
|
||||||
#endif // NOINLINE
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define IL_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#define IL_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
|
|
||||||
//! Basic Palette struct
|
|
||||||
typedef struct ILpal
|
|
||||||
{
|
|
||||||
ILubyte* Palette; //!< the image palette (if any)
|
|
||||||
ILuint PalSize; //!< size of the palette (in bytes)
|
|
||||||
ILenum PalType; //!< the palette types in il.h (0x0500 range)
|
|
||||||
} ILpal;
|
|
||||||
|
|
||||||
|
|
||||||
//! The Fundamental Image structure
|
|
||||||
/*! Every bit of information about an image is stored in this internal structure.*/
|
|
||||||
typedef struct ILimage
|
|
||||||
{
|
|
||||||
ILuint Width; //!< the image's width
|
|
||||||
ILuint Height; //!< the image's height
|
|
||||||
ILuint Depth; //!< the image's depth
|
|
||||||
ILubyte Bpp; //!< bytes per pixel (now number of channels)
|
|
||||||
ILubyte Bpc; //!< bytes per channel
|
|
||||||
ILuint Bps; //!< bytes per scanline (components for IL)
|
|
||||||
ILubyte* Data; //!< the image data
|
|
||||||
ILuint SizeOfData; //!< the total size of the data (in bytes)
|
|
||||||
ILuint SizeOfPlane; //!< SizeOfData in a 2d image, size of each plane slice in a 3d image (in bytes)
|
|
||||||
ILenum Format; //!< image format (in IL enum style)
|
|
||||||
ILenum Type; //!< image type (in IL enum style)
|
|
||||||
ILenum Origin; //!< origin of the image
|
|
||||||
ILpal Pal; //!< palette details
|
|
||||||
ILuint Duration; //!< length of the time to display this "frame"
|
|
||||||
ILenum CubeFlags; //!< cube map flags for sides present in chain
|
|
||||||
struct ILimage* Mipmaps; //!< mipmapped versions of this image terminated by a NULL - usu. NULL
|
|
||||||
struct ILimage* Next; //!< next image in the chain - usu. NULL
|
|
||||||
struct ILimage* Faces; //!< next cubemap face in the chain - usu. NULL
|
|
||||||
struct ILimage* Layers; //!< subsequent layers in the chain - usu. NULL
|
|
||||||
ILuint* AnimList; //!< animation list
|
|
||||||
ILuint AnimSize; //!< animation list size
|
|
||||||
void* Profile; //!< colour profile
|
|
||||||
ILuint ProfileSize; //!< colour profile size
|
|
||||||
ILuint OffX; //!< x-offset of the image
|
|
||||||
ILuint OffY; //!< y-offset of the image
|
|
||||||
ILubyte* DxtcData; //!< compressed data
|
|
||||||
ILenum DxtcFormat; //!< compressed data format
|
|
||||||
ILuint DxtcSize; //!< compressed data size
|
|
||||||
} ILimage;
|
|
||||||
|
|
||||||
|
|
||||||
// Memory functions
|
|
||||||
ILAPI void* ILAPIENTRY ialloc(const ILsizei Size);
|
|
||||||
ILAPI void ILAPIENTRY ifree(const void *Ptr);
|
|
||||||
ILAPI void* ILAPIENTRY icalloc(const ILsizei Size, const ILsizei Num);
|
|
||||||
#ifdef ALTIVEC_GCC
|
|
||||||
ILAPI void* ILAPIENTRY ivec_align_buffer(void *buffer, const ILuint size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Internal library functions in IL
|
|
||||||
ILAPI ILimage* ILAPIENTRY ilGetCurImage(void);
|
|
||||||
ILAPI void ILAPIENTRY ilSetCurImage(ILimage *Image);
|
|
||||||
ILAPI void ILAPIENTRY ilSetError(ILenum Error);
|
|
||||||
ILAPI void ILAPIENTRY ilSetPal(ILpal *Pal);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Utility functions
|
|
||||||
//
|
|
||||||
ILAPI ILubyte ILAPIENTRY ilGetBppFormat(ILenum Format);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilGetFormatBpp(ILubyte Bpp);
|
|
||||||
ILAPI ILubyte ILAPIENTRY ilGetBpcType(ILenum Type);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilGetTypeBpc(ILubyte Bpc);
|
|
||||||
ILAPI ILubyte ILAPIENTRY ilGetBppPal(ILenum PalType);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilGetPalBaseType(ILenum PalType);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilNextPower2(ILuint Num);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName);
|
|
||||||
ILAPI void ILAPIENTRY ilReplaceCurImage(ILimage *Image);
|
|
||||||
ILAPI void ILAPIENTRY iMemSwap(ILubyte *, ILubyte *, const ILuint);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Image functions
|
|
||||||
//
|
|
||||||
ILAPI void ILAPIENTRY iBindImageTemp (void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilClearImage_ (ILimage *Image);
|
|
||||||
ILAPI void ILAPIENTRY ilCloseImage (ILimage *Image);
|
|
||||||
ILAPI void ILAPIENTRY ilClosePal (ILpal *Palette);
|
|
||||||
ILAPI ILpal* ILAPIENTRY iCopyPal (void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilCopyImageAttr (ILimage *Dest, ILimage *Src);
|
|
||||||
ILAPI ILimage* ILAPIENTRY ilCopyImage_ (ILimage *Src);
|
|
||||||
ILAPI void ILAPIENTRY ilGetClear (void *Colours, ILenum Format, ILenum Type);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilGetCurName (void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsValidPal (ILpal *Palette);
|
|
||||||
ILAPI ILimage* ILAPIENTRY ilNewImage (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc);
|
|
||||||
ILAPI ILimage* ILAPIENTRY ilNewImageFull (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilInitImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilResizeImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTexImage_ (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTexImageSurface_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTexSubImage_ (ILimage *Image, void *Data);
|
|
||||||
ILAPI void* ILAPIENTRY ilConvertBuffer (ILuint SizeOfData, ILenum SrcFormat, ILenum DestFormat, ILenum SrcType, ILenum DestType, ILpal *SrcPal, void *Buffer);
|
|
||||||
ILAPI ILimage* ILAPIENTRY iConvertImage (ILimage *Image, ILenum DestFormat, ILenum DestType);
|
|
||||||
ILAPI ILpal* ILAPIENTRY iConvertPal (ILpal *Pal, ILenum DestFormat);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY iGetFlipped (ILimage *Image);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iMirror();
|
|
||||||
ILAPI void ILAPIENTRY iFlipBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num);
|
|
||||||
ILubyte* iFlipNewBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num);
|
|
||||||
ILAPI void ILAPIENTRY iGetIntegervImage(ILimage *Image, ILenum Mode, ILint *Param);
|
|
||||||
|
|
||||||
// Internal library functions in ILU
|
|
||||||
ILAPI ILimage* ILAPIENTRY iluRotate_(ILimage *Image, ILfloat Angle);
|
|
||||||
ILAPI ILimage* ILAPIENTRY iluRotate3D_(ILimage *Image, ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
|
|
||||||
ILAPI ILimage* ILAPIENTRY iluScale_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif//IL_EXPORTS_H
|
|
@ -1,645 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ImageLib Sources
|
|
||||||
// Copyright (C) 2000-2017 by Denton Woods
|
|
||||||
// Last modified: 03/07/2009
|
|
||||||
//
|
|
||||||
// Filename: IL/il.h
|
|
||||||
//
|
|
||||||
// Description: The main include file for DevIL
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Doxygen comment
|
|
||||||
/*! \file il.h
|
|
||||||
The main include file for DevIL
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __il_h_
|
|
||||||
#ifndef __IL_H__
|
|
||||||
|
|
||||||
#define __il_h_
|
|
||||||
#define __IL_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//this define controls if floats and doubles are clamped 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...
|
|
||||||
#define CLAMP_HALF 1
|
|
||||||
#define CLAMP_FLOATS 1
|
|
||||||
#define CLAMP_DOUBLES 1
|
|
||||||
|
|
||||||
/*#ifdef _WIN32_WCE
|
|
||||||
#define IL_NO_EXR
|
|
||||||
#define IL_NO_GIF
|
|
||||||
#define IL_NO_JP2
|
|
||||||
#define IL_NO_JPG
|
|
||||||
#define IL_NO_MNG
|
|
||||||
#define IL_NO_PNG
|
|
||||||
#define IL_NO_TIF
|
|
||||||
#define IL_NO_LCMS
|
|
||||||
#endif //_WIN32_WCE
|
|
||||||
|
|
||||||
#ifdef DJGPP
|
|
||||||
#define IL_NO_EXR
|
|
||||||
#define IL_NO_GIF
|
|
||||||
#define IL_NO_JP2
|
|
||||||
#define IL_NO_JPG
|
|
||||||
#define IL_NO_MNG
|
|
||||||
#define IL_NO_PNG
|
|
||||||
#define IL_NO_TIF
|
|
||||||
#define IL_NO_LCMS
|
|
||||||
#endif //DJGPP*/
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
#pragma comment(lib, "DevIL.lib")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus)
|
|
||||||
#define RESTRICT restrict
|
|
||||||
#define CONST_RESTRICT const restrict
|
|
||||||
#else
|
|
||||||
#define RESTRICT
|
|
||||||
#define CONST_RESTRICT const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef unsigned int ILenum;
|
|
||||||
typedef unsigned char ILboolean;
|
|
||||||
typedef unsigned int ILbitfield;
|
|
||||||
typedef signed char ILbyte;
|
|
||||||
typedef signed short ILshort;
|
|
||||||
typedef int ILint;
|
|
||||||
typedef size_t ILsizei;
|
|
||||||
typedef unsigned char ILubyte;
|
|
||||||
typedef unsigned short ILushort;
|
|
||||||
typedef unsigned int ILuint;
|
|
||||||
typedef float ILfloat;
|
|
||||||
typedef float ILclampf;
|
|
||||||
typedef double ILdouble;
|
|
||||||
typedef double ILclampd;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef __int64 ILint64;
|
|
||||||
typedef unsigned __int64 ILuint64;
|
|
||||||
#else
|
|
||||||
typedef long long int ILint64;
|
|
||||||
typedef long long unsigned int ILuint64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#ifdef _UNICODE
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#include <wchar.h>
|
|
||||||
#endif
|
|
||||||
//if we use a define instead of a typedef,
|
|
||||||
//ILconst_string works as intended
|
|
||||||
#define ILchar wchar_t
|
|
||||||
#define ILstring wchar_t*
|
|
||||||
#define ILconst_string wchar_t const *
|
|
||||||
#else
|
|
||||||
//if we use a define instead of a typedef,
|
|
||||||
//ILconst_string works as intended
|
|
||||||
#define ILchar char
|
|
||||||
#define ILstring char*
|
|
||||||
#define ILconst_string char const *
|
|
||||||
#endif //_UNICODE
|
|
||||||
|
|
||||||
#define IL_FALSE 0
|
|
||||||
#define IL_TRUE 1
|
|
||||||
|
|
||||||
// Matches OpenGL's right now.
|
|
||||||
//! Data formats \link Formats Formats\endlink
|
|
||||||
#define IL_COLOUR_INDEX 0x1900
|
|
||||||
#define IL_COLOR_INDEX 0x1900
|
|
||||||
#define IL_ALPHA 0x1906
|
|
||||||
#define IL_RGB 0x1907
|
|
||||||
#define IL_RGBA 0x1908
|
|
||||||
#define IL_BGR 0x80E0
|
|
||||||
#define IL_BGRA 0x80E1
|
|
||||||
#define IL_LUMINANCE 0x1909
|
|
||||||
#define IL_LUMINANCE_ALPHA 0x190A
|
|
||||||
|
|
||||||
//! Data types \link Types Types\endlink
|
|
||||||
#define IL_BYTE 0x1400
|
|
||||||
#define IL_UNSIGNED_BYTE 0x1401
|
|
||||||
#define IL_SHORT 0x1402
|
|
||||||
#define IL_UNSIGNED_SHORT 0x1403
|
|
||||||
#define IL_INT 0x1404
|
|
||||||
#define IL_UNSIGNED_INT 0x1405
|
|
||||||
#define IL_FLOAT 0x1406
|
|
||||||
#define IL_DOUBLE 0x140A
|
|
||||||
#define IL_HALF 0x140B
|
|
||||||
|
|
||||||
|
|
||||||
#define IL_MAX_BYTE SCHAR_MAX
|
|
||||||
#define IL_MAX_UNSIGNED_BYTE UCHAR_MAX
|
|
||||||
#define IL_MAX_SHORT SHRT_MAX
|
|
||||||
#define IL_MAX_UNSIGNED_SHORT USHRT_MAX
|
|
||||||
#define IL_MAX_INT INT_MAX
|
|
||||||
#define IL_MAX_UNSIGNED_INT UINT_MAX
|
|
||||||
|
|
||||||
#define IL_LIMIT(x,m,M) (x<m?m:(x>M?M:x))
|
|
||||||
#define IL_CLAMP(x) IL_LIMIT(x,0,1)
|
|
||||||
|
|
||||||
#define IL_VENDOR 0x1F00
|
|
||||||
#define IL_LOAD_EXT 0x1F01
|
|
||||||
#define IL_SAVE_EXT 0x1F02
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// IL-specific #define's
|
|
||||||
//
|
|
||||||
|
|
||||||
#define IL_VERSION_1_8_0 1
|
|
||||||
#define IL_VERSION 180
|
|
||||||
|
|
||||||
|
|
||||||
// Attribute Bits
|
|
||||||
#define IL_ORIGIN_BIT 0x00000001
|
|
||||||
#define IL_FILE_BIT 0x00000002
|
|
||||||
#define IL_PAL_BIT 0x00000004
|
|
||||||
#define IL_FORMAT_BIT 0x00000008
|
|
||||||
#define IL_TYPE_BIT 0x00000010
|
|
||||||
#define IL_COMPRESS_BIT 0x00000020
|
|
||||||
#define IL_LOADFAIL_BIT 0x00000040
|
|
||||||
#define IL_FORMAT_SPECIFIC_BIT 0x00000080
|
|
||||||
#define IL_ALL_ATTRIB_BITS 0x000FFFFF
|
|
||||||
|
|
||||||
|
|
||||||
// Palette types
|
|
||||||
#define IL_PAL_NONE 0x0400
|
|
||||||
#define IL_PAL_RGB24 0x0401
|
|
||||||
#define IL_PAL_RGB32 0x0402
|
|
||||||
#define IL_PAL_RGBA32 0x0403
|
|
||||||
#define IL_PAL_BGR24 0x0404
|
|
||||||
#define IL_PAL_BGR32 0x0405
|
|
||||||
#define IL_PAL_BGRA32 0x0406
|
|
||||||
|
|
||||||
|
|
||||||
// Image types
|
|
||||||
#define IL_TYPE_UNKNOWN 0x0000
|
|
||||||
#define IL_BMP 0x0420 //!< Microsoft Windows Bitmap - .bmp extension
|
|
||||||
#define IL_CUT 0x0421 //!< Dr. Halo - .cut extension
|
|
||||||
#define IL_DOOM 0x0422 //!< DooM walls - no specific extension
|
|
||||||
#define IL_DOOM_FLAT 0x0423 //!< DooM flats - no specific extension
|
|
||||||
#define IL_ICO 0x0424 //!< Microsoft Windows Icons and Cursors - .ico and .cur extensions
|
|
||||||
#define IL_JPG 0x0425 //!< JPEG - .jpg, .jpe and .jpeg extensions
|
|
||||||
#define IL_JFIF 0x0425 //!<
|
|
||||||
#define IL_ILBM 0x0426 //!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions
|
|
||||||
#define IL_PCD 0x0427 //!< Kodak PhotoCD - .pcd extension
|
|
||||||
#define IL_PCX 0x0428 //!< ZSoft PCX - .pcx extension
|
|
||||||
#define IL_PIC 0x0429 //!< PIC - .pic extension
|
|
||||||
#define IL_PNG 0x042A //!< Portable Network Graphics - .png extension
|
|
||||||
#define IL_PNM 0x042B //!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions
|
|
||||||
#define IL_SGI 0x042C //!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions
|
|
||||||
#define IL_TGA 0x042D //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions
|
|
||||||
#define IL_TIF 0x042E //!< Tagged Image File Format - .tif and .tiff extensions
|
|
||||||
#define IL_CHEAD 0x042F //!< C-Style Header - .h extension
|
|
||||||
#define IL_RAW 0x0430 //!< Raw Image Data - any extension
|
|
||||||
#define IL_MDL 0x0431 //!< Half-Life Model Texture - .mdl extension
|
|
||||||
#define IL_WAL 0x0432 //!< Quake 2 Texture - .wal extension
|
|
||||||
#define IL_LIF 0x0434 //!< Homeworld Texture - .lif extension
|
|
||||||
#define IL_MNG 0x0435 //!< Multiple-image Network Graphics - .mng extension
|
|
||||||
#define IL_JNG 0x0435 //!<
|
|
||||||
#define IL_GIF 0x0436 //!< Graphics Interchange Format - .gif extension
|
|
||||||
#define IL_DDS 0x0437 //!< DirectDraw Surface - .dds extension
|
|
||||||
#define IL_DCX 0x0438 //!< ZSoft Multi-PCX - .dcx extension
|
|
||||||
#define IL_PSD 0x0439 //!< Adobe PhotoShop - .psd extension
|
|
||||||
#define IL_EXIF 0x043A //!<
|
|
||||||
#define IL_PSP 0x043B //!< PaintShop Pro - .psp extension
|
|
||||||
#define IL_PIX 0x043C //!< PIX - .pix extension
|
|
||||||
#define IL_PXR 0x043D //!< Pixar - .pxr extension
|
|
||||||
#define IL_XPM 0x043E //!< X Pixel Map - .xpm extension
|
|
||||||
#define IL_HDR 0x043F //!< Radiance High Dynamic Range - .hdr extension
|
|
||||||
#define IL_ICNS 0x0440 //!< Macintosh Icon - .icns extension
|
|
||||||
#define IL_JP2 0x0441 //!< Jpeg 2000 - .jp2 extension
|
|
||||||
#define IL_EXR 0x0442 //!< OpenEXR - .exr extension
|
|
||||||
#define IL_WDP 0x0443 //!< Microsoft HD Photo - .wdp and .hdp extension
|
|
||||||
#define IL_VTF 0x0444 //!< Valve Texture Format - .vtf extension
|
|
||||||
#define IL_WBMP 0x0445 //!< Wireless Bitmap - .wbmp extension
|
|
||||||
#define IL_SUN 0x0446 //!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions
|
|
||||||
#define IL_IFF 0x0447 //!< Interchange File Format - .iff extension
|
|
||||||
#define IL_TPL 0x0448 //!< Gamecube Texture - .tpl extension
|
|
||||||
#define IL_FITS 0x0449 //!< Flexible Image Transport System - .fit and .fits extensions
|
|
||||||
#define IL_DICOM 0x044A //!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions
|
|
||||||
#define IL_IWI 0x044B //!< Call of Duty Infinity Ward Image - .iwi extension
|
|
||||||
#define IL_BLP 0x044C //!< Blizzard Texture Format - .blp extension
|
|
||||||
#define IL_FTX 0x044D //!< Heavy Metal: FAKK2 Texture - .ftx extension
|
|
||||||
#define IL_ROT 0x044E //!< Homeworld 2 - Relic Texture - .rot extension
|
|
||||||
#define IL_TEXTURE 0x044F //!< Medieval II: Total War Texture - .texture extension
|
|
||||||
#define IL_DPX 0x0450 //!< Digital Picture Exchange - .dpx extension
|
|
||||||
#define IL_UTX 0x0451 //!< Unreal (and Unreal Tournament) Texture - .utx extension
|
|
||||||
#define IL_MP3 0x0452 //!< MPEG-1 Audio Layer 3 - .mp3 extension
|
|
||||||
#define IL_KTX 0x0453 //!< Khronos Texture - .ktx extension
|
|
||||||
|
|
||||||
|
|
||||||
#define IL_JASC_PAL 0x0475 //!< PaintShop Pro Palette
|
|
||||||
|
|
||||||
|
|
||||||
// Error Types
|
|
||||||
#define IL_NO_ERROR 0x0000
|
|
||||||
#define IL_INVALID_ENUM 0x0501
|
|
||||||
#define IL_OUT_OF_MEMORY 0x0502
|
|
||||||
#define IL_FORMAT_NOT_SUPPORTED 0x0503
|
|
||||||
#define IL_INTERNAL_ERROR 0x0504
|
|
||||||
#define IL_INVALID_VALUE 0x0505
|
|
||||||
#define IL_ILLEGAL_OPERATION 0x0506
|
|
||||||
#define IL_ILLEGAL_FILE_VALUE 0x0507
|
|
||||||
#define IL_INVALID_FILE_HEADER 0x0508
|
|
||||||
#define IL_INVALID_PARAM 0x0509
|
|
||||||
#define IL_COULD_NOT_OPEN_FILE 0x050A
|
|
||||||
#define IL_INVALID_EXTENSION 0x050B
|
|
||||||
#define IL_FILE_ALREADY_EXISTS 0x050C
|
|
||||||
#define IL_OUT_FORMAT_SAME 0x050D
|
|
||||||
#define IL_STACK_OVERFLOW 0x050E
|
|
||||||
#define IL_STACK_UNDERFLOW 0x050F
|
|
||||||
#define IL_INVALID_CONVERSION 0x0510
|
|
||||||
#define IL_BAD_DIMENSIONS 0x0511
|
|
||||||
#define IL_FILE_READ_ERROR 0x0512 // 05/12/2002: Addition by Sam.
|
|
||||||
#define IL_FILE_WRITE_ERROR 0x0512
|
|
||||||
|
|
||||||
#define IL_LIB_GIF_ERROR 0x05E1
|
|
||||||
#define IL_LIB_JPEG_ERROR 0x05E2
|
|
||||||
#define IL_LIB_PNG_ERROR 0x05E3
|
|
||||||
#define IL_LIB_TIFF_ERROR 0x05E4
|
|
||||||
#define IL_LIB_MNG_ERROR 0x05E5
|
|
||||||
#define IL_LIB_JP2_ERROR 0x05E6
|
|
||||||
#define IL_LIB_EXR_ERROR 0x05E7
|
|
||||||
#define IL_UNKNOWN_ERROR 0x05FF
|
|
||||||
|
|
||||||
|
|
||||||
// Origin Definitions
|
|
||||||
#define IL_ORIGIN_SET 0x0600
|
|
||||||
#define IL_ORIGIN_LOWER_LEFT 0x0601
|
|
||||||
#define IL_ORIGIN_UPPER_LEFT 0x0602
|
|
||||||
#define IL_ORIGIN_MODE 0x0603
|
|
||||||
|
|
||||||
|
|
||||||
// Format and Type Mode Definitions
|
|
||||||
#define IL_FORMAT_SET 0x0610
|
|
||||||
#define IL_FORMAT_MODE 0x0611
|
|
||||||
#define IL_TYPE_SET 0x0612
|
|
||||||
#define IL_TYPE_MODE 0x0613
|
|
||||||
|
|
||||||
|
|
||||||
// File definitions
|
|
||||||
#define IL_FILE_OVERWRITE 0x0620
|
|
||||||
#define IL_FILE_MODE 0x0621
|
|
||||||
|
|
||||||
|
|
||||||
// Palette definitions
|
|
||||||
#define IL_CONV_PAL 0x0630
|
|
||||||
|
|
||||||
|
|
||||||
// Load fail definitions
|
|
||||||
#define IL_DEFAULT_ON_FAIL 0x0632
|
|
||||||
|
|
||||||
|
|
||||||
// Key colour and alpha definitions
|
|
||||||
#define IL_USE_KEY_COLOUR 0x0635
|
|
||||||
#define IL_USE_KEY_COLOR 0x0635
|
|
||||||
#define IL_BLIT_BLEND 0x0636
|
|
||||||
|
|
||||||
|
|
||||||
// Interlace definitions
|
|
||||||
#define IL_SAVE_INTERLACED 0x0639
|
|
||||||
#define IL_INTERLACE_MODE 0x063A
|
|
||||||
|
|
||||||
|
|
||||||
// Quantization definitions
|
|
||||||
#define IL_QUANTIZATION_MODE 0x0640
|
|
||||||
#define IL_WU_QUANT 0x0641
|
|
||||||
#define IL_NEU_QUANT 0x0642
|
|
||||||
#define IL_NEU_QUANT_SAMPLE 0x0643
|
|
||||||
#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
|
|
||||||
#define IL_MAX_QUANT_INDICES 0x0644 // Redefined, since the above #define is misspelled
|
|
||||||
|
|
||||||
|
|
||||||
// Hints
|
|
||||||
#define IL_FASTEST 0x0660
|
|
||||||
#define IL_LESS_MEM 0x0661
|
|
||||||
#define IL_DONT_CARE 0x0662
|
|
||||||
#define IL_MEM_SPEED_HINT 0x0665
|
|
||||||
#define IL_USE_COMPRESSION 0x0666
|
|
||||||
#define IL_NO_COMPRESSION 0x0667
|
|
||||||
#define IL_COMPRESSION_HINT 0x0668
|
|
||||||
|
|
||||||
|
|
||||||
// Compression
|
|
||||||
#define IL_NVIDIA_COMPRESS 0x0670
|
|
||||||
#define IL_SQUISH_COMPRESS 0x0671
|
|
||||||
|
|
||||||
|
|
||||||
// Subimage types
|
|
||||||
#define IL_SUB_NEXT 0x0680
|
|
||||||
#define IL_SUB_MIPMAP 0x0681
|
|
||||||
#define IL_SUB_LAYER 0x0682
|
|
||||||
|
|
||||||
|
|
||||||
// Compression definitions
|
|
||||||
#define IL_COMPRESS_MODE 0x0700
|
|
||||||
#define IL_COMPRESS_NONE 0x0701
|
|
||||||
#define IL_COMPRESS_RLE 0x0702
|
|
||||||
#define IL_COMPRESS_LZO 0x0703
|
|
||||||
#define IL_COMPRESS_ZLIB 0x0704
|
|
||||||
|
|
||||||
|
|
||||||
// File format-specific values
|
|
||||||
#define IL_TGA_CREATE_STAMP 0x0710
|
|
||||||
#define IL_JPG_QUALITY 0x0711
|
|
||||||
#define IL_PNG_INTERLACE 0x0712
|
|
||||||
#define IL_TGA_RLE 0x0713
|
|
||||||
#define IL_BMP_RLE 0x0714
|
|
||||||
#define IL_SGI_RLE 0x0715
|
|
||||||
#define IL_TGA_ID_STRING 0x0717
|
|
||||||
#define IL_TGA_AUTHNAME_STRING 0x0718
|
|
||||||
#define IL_TGA_AUTHCOMMENT_STRING 0x0719
|
|
||||||
#define IL_PNG_AUTHNAME_STRING 0x071A
|
|
||||||
#define IL_PNG_TITLE_STRING 0x071B
|
|
||||||
#define IL_PNG_DESCRIPTION_STRING 0x071C
|
|
||||||
#define IL_TIF_DESCRIPTION_STRING 0x071D
|
|
||||||
#define IL_TIF_HOSTCOMPUTER_STRING 0x071E
|
|
||||||
#define IL_TIF_DOCUMENTNAME_STRING 0x071F
|
|
||||||
#define IL_TIF_AUTHNAME_STRING 0x0720
|
|
||||||
#define IL_JPG_SAVE_FORMAT 0x0721
|
|
||||||
#define IL_CHEAD_HEADER_STRING 0x0722
|
|
||||||
#define IL_PCD_PICNUM 0x0723
|
|
||||||
#define IL_PNG_ALPHA_INDEX 0x0724 // currently has no effect!
|
|
||||||
#define IL_JPG_PROGRESSIVE 0x0725
|
|
||||||
#define IL_VTF_COMP 0x0726
|
|
||||||
|
|
||||||
|
|
||||||
// DXTC definitions
|
|
||||||
#define IL_DXTC_FORMAT 0x0705
|
|
||||||
#define IL_DXT1 0x0706
|
|
||||||
#define IL_DXT2 0x0707
|
|
||||||
#define IL_DXT3 0x0708
|
|
||||||
#define IL_DXT4 0x0709
|
|
||||||
#define IL_DXT5 0x070A
|
|
||||||
#define IL_DXT_NO_COMP 0x070B
|
|
||||||
#define IL_KEEP_DXTC_DATA 0x070C
|
|
||||||
#define IL_DXTC_DATA_FORMAT 0x070D
|
|
||||||
#define IL_3DC 0x070E
|
|
||||||
#define IL_RXGB 0x070F
|
|
||||||
#define IL_ATI1N 0x0710
|
|
||||||
#define IL_DXT1A 0x0711 // Normally the same as IL_DXT1, except for nVidia Texture Tools.
|
|
||||||
|
|
||||||
// Environment map definitions
|
|
||||||
#define IL_CUBEMAP_POSITIVEX 0x00000400
|
|
||||||
#define IL_CUBEMAP_NEGATIVEX 0x00000800
|
|
||||||
#define IL_CUBEMAP_POSITIVEY 0x00001000
|
|
||||||
#define IL_CUBEMAP_NEGATIVEY 0x00002000
|
|
||||||
#define IL_CUBEMAP_POSITIVEZ 0x00004000
|
|
||||||
#define IL_CUBEMAP_NEGATIVEZ 0x00008000
|
|
||||||
#define IL_SPHEREMAP 0x00010000
|
|
||||||
|
|
||||||
|
|
||||||
// Values
|
|
||||||
#define IL_VERSION_NUM 0x0DE2
|
|
||||||
#define IL_IMAGE_WIDTH 0x0DE4
|
|
||||||
#define IL_IMAGE_HEIGHT 0x0DE5
|
|
||||||
#define IL_IMAGE_DEPTH 0x0DE6
|
|
||||||
#define IL_IMAGE_SIZE_OF_DATA 0x0DE7
|
|
||||||
#define IL_IMAGE_BPP 0x0DE8
|
|
||||||
#define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8
|
|
||||||
#define IL_IMAGE_BPP 0x0DE8
|
|
||||||
#define IL_IMAGE_BITS_PER_PIXEL 0x0DE9
|
|
||||||
#define IL_IMAGE_FORMAT 0x0DEA
|
|
||||||
#define IL_IMAGE_TYPE 0x0DEB
|
|
||||||
#define IL_PALETTE_TYPE 0x0DEC
|
|
||||||
#define IL_PALETTE_SIZE 0x0DED
|
|
||||||
#define IL_PALETTE_BPP 0x0DEE
|
|
||||||
#define IL_PALETTE_NUM_COLS 0x0DEF
|
|
||||||
#define IL_PALETTE_BASE_TYPE 0x0DF0
|
|
||||||
#define IL_NUM_FACES 0x0DE1
|
|
||||||
#define IL_NUM_IMAGES 0x0DF1
|
|
||||||
#define IL_NUM_MIPMAPS 0x0DF2
|
|
||||||
#define IL_NUM_LAYERS 0x0DF3
|
|
||||||
#define IL_ACTIVE_IMAGE 0x0DF4
|
|
||||||
#define IL_ACTIVE_MIPMAP 0x0DF5
|
|
||||||
#define IL_ACTIVE_LAYER 0x0DF6
|
|
||||||
#define IL_ACTIVE_FACE 0x0E00
|
|
||||||
#define IL_CUR_IMAGE 0x0DF7
|
|
||||||
#define IL_IMAGE_DURATION 0x0DF8
|
|
||||||
#define IL_IMAGE_PLANESIZE 0x0DF9
|
|
||||||
#define IL_IMAGE_BPC 0x0DFA
|
|
||||||
#define IL_IMAGE_OFFX 0x0DFB
|
|
||||||
#define IL_IMAGE_OFFY 0x0DFC
|
|
||||||
#define IL_IMAGE_CUBEFLAGS 0x0DFD
|
|
||||||
#define IL_IMAGE_ORIGIN 0x0DFE
|
|
||||||
#define IL_IMAGE_CHANNELS 0x0DFF
|
|
||||||
|
|
||||||
# if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0))
|
|
||||||
// __attribute__((deprecated)) is supported by GCC 3.1 and later.
|
|
||||||
# define DEPRECATED(D) D __attribute__((deprecated))
|
|
||||||
# elif defined _MSC_VER && _MSC_VER >= 1300
|
|
||||||
// __declspec(deprecated) is supported by MSVC 7.0 and later.
|
|
||||||
# define DEPRECATED(D) __declspec(deprecated) D
|
|
||||||
# else
|
|
||||||
# define DEPRECATED (D) D
|
|
||||||
# endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// Section shamelessly modified from the glut header.
|
|
||||||
//
|
|
||||||
|
|
||||||
// This is from Win32's <windef.h>
|
|
||||||
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
|
|
||||||
#define ILAPIENTRY __stdcall
|
|
||||||
#define IL_PACKSTRUCT
|
|
||||||
//#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364
|
|
||||||
#elif defined( __GNUC__ )
|
|
||||||
// this should work for any of the above commented platforms
|
|
||||||
// plus any platform using GCC
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define ILAPIENTRY __stdcall
|
|
||||||
#else
|
|
||||||
#define ILAPIENTRY
|
|
||||||
#endif
|
|
||||||
#define IL_PACKSTRUCT __attribute__ ((packed))
|
|
||||||
#else
|
|
||||||
#define ILAPIENTRY
|
|
||||||
#define IL_PACKSTRUCT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is from Win32's <wingdi.h> and <winnt.h>
|
|
||||||
#if defined(__LCC__)
|
|
||||||
#define ILAPI __stdcall
|
|
||||||
#elif defined(_WIN32) //changed 20031221 to fix bug 840421
|
|
||||||
#ifdef IL_STATIC_LIB
|
|
||||||
#define ILAPI
|
|
||||||
#else
|
|
||||||
#ifdef _IL_BUILD_LIBRARY
|
|
||||||
#define ILAPI __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define ILAPI __declspec(dllimport)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#elif __APPLE__
|
|
||||||
#define ILAPI extern
|
|
||||||
#else
|
|
||||||
#define ILAPI
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define IL_SEEK_SET 0
|
|
||||||
#define IL_SEEK_CUR 1
|
|
||||||
#define IL_SEEK_END 2
|
|
||||||
#define IL_EOF -1
|
|
||||||
|
|
||||||
|
|
||||||
// Callback functions for file reading
|
|
||||||
typedef void* ILHANDLE;
|
|
||||||
typedef void (ILAPIENTRY *fCloseRProc)(ILHANDLE);
|
|
||||||
typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE);
|
|
||||||
typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE);
|
|
||||||
typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (ILconst_string);
|
|
||||||
typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE);
|
|
||||||
typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
|
|
||||||
typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE);
|
|
||||||
|
|
||||||
// Callback functions for file writing
|
|
||||||
typedef void (ILAPIENTRY *fCloseWProc)(ILHANDLE);
|
|
||||||
typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (ILconst_string);
|
|
||||||
typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE);
|
|
||||||
typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
|
|
||||||
typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE);
|
|
||||||
typedef ILint (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE);
|
|
||||||
|
|
||||||
// Callback functions for allocation and deallocation
|
|
||||||
typedef void* (ILAPIENTRY *mAlloc)(const ILsizei);
|
|
||||||
typedef void (ILAPIENTRY *mFree) (const void* CONST_RESTRICT);
|
|
||||||
|
|
||||||
// Registered format procedures
|
|
||||||
typedef ILenum (ILAPIENTRY *IL_LOADPROC)(ILconst_string);
|
|
||||||
typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(ILconst_string);
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Functions
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilActiveFace(ILuint Number);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilActiveImage(ILuint Number);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilActiveLayer(ILuint Number);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilActiveMipmap(ILuint Number);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilApplyPal(ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilApplyProfile(ILstring InProfile, ILstring OutProfile);
|
|
||||||
ILAPI void ILAPIENTRY ilBindImage(ILuint Image);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilClampNTSC(void);
|
|
||||||
ILAPI void ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilClearImage(void);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilCloneCurImage(void);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY ilCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint *DXTCSize);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilCompressFunc(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilConvertPal(ILenum DestFormat);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilCopyImage(ILuint Src);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilDefaultImage(void);
|
|
||||||
ILAPI void ILAPIENTRY ilDeleteImage(const ILuint Num);
|
|
||||||
ILAPI void ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilDetermineType(ILconst_string FileName);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilDetermineTypeF(ILHANDLE File);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilDetermineTypeL(const void *Lump, ILuint Size);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilDisable(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilDxtcDataToImage(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilDxtcDataToSurface(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilEnable(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilFlipSurfaceDxtcData(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilFormatFunc(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilGenImage(void);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY ilGetAlpha(ILenum Type);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilGetBoolean(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY ilGetData(void);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilGetDXTCData(void *Buffer, ILuint BufferSize, ILenum DXTCFormat);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilGetError(void);
|
|
||||||
ILAPI ILint ILAPIENTRY ilGetInteger(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilGetLumpPos(void);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY ilGetPalette(void);
|
|
||||||
ILAPI ILconst_string ILAPIENTRY ilGetString(ILenum StringName);
|
|
||||||
ILAPI void ILAPIENTRY ilHint(ILenum Target, ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilInvertSurfaceDxtcDataAlpha(void);
|
|
||||||
ILAPI void ILAPIENTRY ilInit(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilImageToDxtcData(ILenum Format);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsDisabled(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsEnabled(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsImage(ILuint Image);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsValid(ILenum Type, ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilIsValidL(ILenum Type, void *Lump, ILuint Size);
|
|
||||||
ILAPI void ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoad(ILenum Type, ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadImage(ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadL(ILenum Type, const void *Lump, ILuint Size);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadPal(ILconst_string FileName);
|
|
||||||
ILAPI void ILAPIENTRY ilModAlpha(ILdouble AlphaValue);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilOriginFunc(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord);
|
|
||||||
ILAPI void ILAPIENTRY ilPopAttrib(void);
|
|
||||||
ILAPI void ILAPIENTRY ilPushAttrib(ILuint Bits);
|
|
||||||
ILAPI void ILAPIENTRY ilRegisterFormat(ILenum Format);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRegisterNumFaces(ILuint Num);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num);
|
|
||||||
ILAPI void ILAPIENTRY ilRegisterOrigin(ILenum Origin);
|
|
||||||
ILAPI void ILAPIENTRY ilRegisterPal(void *Pal, ILuint Size, ILenum Type);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save);
|
|
||||||
ILAPI void ILAPIENTRY ilRegisterType(ILenum Type);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRemoveLoad(ILconst_string Ext);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilRemoveSave(ILconst_string Ext);
|
|
||||||
ILAPI void ILAPIENTRY ilResetMemory(void); // Deprecated
|
|
||||||
ILAPI void ILAPIENTRY ilResetRead(void);
|
|
||||||
ILAPI void ILAPIENTRY ilResetWrite(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSave(ILenum Type, ILconst_string FileName);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSaveImage(ILconst_string FileName);
|
|
||||||
ILAPI ILuint ILAPIENTRY ilSaveL(ILenum Type, void *Lump, ILuint Size);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSavePal(ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSetAlpha(ILdouble AlphaValue);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSetData(void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSetDuration(ILuint Duration);
|
|
||||||
ILAPI void ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param);
|
|
||||||
ILAPI void ILAPIENTRY ilSetMemory(mAlloc, mFree);
|
|
||||||
ILAPI void ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI void ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc);
|
|
||||||
ILAPI void ILAPIENTRY ilSetString(ILenum Mode, const char *String);
|
|
||||||
ILAPI void ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc);
|
|
||||||
ILAPI void ILAPIENTRY ilShutDown(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const ILubyte* data);
|
|
||||||
ILAPI ILenum ILAPIENTRY ilTypeFromExt(ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilTypeFunc(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilLoadDataL(void *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilSaveData(ILconst_string FileName);
|
|
||||||
|
|
||||||
// For all those weirdos that spell "colour" without the 'u'.
|
|
||||||
#define ilClearColor ilClearColour
|
|
||||||
#define ilKeyColor ilKeyColour
|
|
||||||
|
|
||||||
#define imemclear(x,y) memset(x,0,y);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __IL_H__
|
|
||||||
#endif // __il_h__
|
|
@ -1,205 +0,0 @@
|
|||||||
#ifndef WRAPPER_H
|
|
||||||
#define WRAPPER_H
|
|
||||||
|
|
||||||
/*#include <il/il.h>
|
|
||||||
#include <il/ilu.h>*/
|
|
||||||
#include <IL/ilut.h> // Probably only have to #include this one
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#ifndef _IL_WRAP_BUILD_LIB
|
|
||||||
#pragma comment(lib, "il_wrap.lib")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ilImage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ilImage();
|
|
||||||
ilImage(char *);
|
|
||||||
ilImage(const ilImage &);
|
|
||||||
virtual ~ilImage();
|
|
||||||
|
|
||||||
ILboolean Load(char *);
|
|
||||||
ILboolean Load(char *, ILenum);
|
|
||||||
ILboolean Save(char *);
|
|
||||||
ILboolean Save(char *, ILenum);
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib functions
|
|
||||||
ILboolean ActiveImage(ILuint);
|
|
||||||
ILboolean ActiveLayer(ILuint);
|
|
||||||
ILboolean ActiveMipmap(ILuint);
|
|
||||||
ILboolean Clear(void);
|
|
||||||
ILvoid ClearColour(ILclampf, ILclampf, ILclampf, ILclampf);
|
|
||||||
ILboolean Convert(ILenum);
|
|
||||||
ILboolean Copy(ILuint);
|
|
||||||
ILboolean Default(void);
|
|
||||||
ILboolean Flip(void);
|
|
||||||
ILboolean SwapColours(void);
|
|
||||||
ILboolean Resize(ILuint, ILuint, ILuint);
|
|
||||||
ILboolean TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, ILvoid*);
|
|
||||||
|
|
||||||
|
|
||||||
// Image handling
|
|
||||||
ILvoid Bind(void) const;
|
|
||||||
ILvoid Bind(ILuint);
|
|
||||||
ILvoid Close(void) { this->Delete(); }
|
|
||||||
ILvoid Delete(void);
|
|
||||||
ILvoid iGenBind();
|
|
||||||
ILenum PaletteAlphaIndex();
|
|
||||||
|
|
||||||
// Image characteristics
|
|
||||||
ILuint Width(void);
|
|
||||||
ILuint Height(void);
|
|
||||||
ILuint Depth(void);
|
|
||||||
ILubyte Bpp(void);
|
|
||||||
ILubyte Bitpp(void);
|
|
||||||
ILenum PaletteType(void);
|
|
||||||
ILenum Format(void);
|
|
||||||
ILenum Type(void);
|
|
||||||
ILuint NumImages(void);
|
|
||||||
ILuint NumMipmaps(void);
|
|
||||||
ILuint GetId(void) const;
|
|
||||||
ILenum GetOrigin(void);
|
|
||||||
ILubyte *GetData(void);
|
|
||||||
ILubyte *GetPalette(void);
|
|
||||||
|
|
||||||
|
|
||||||
// Rendering
|
|
||||||
ILuint BindImage(void);
|
|
||||||
ILuint BindImage(ILenum);
|
|
||||||
|
|
||||||
|
|
||||||
// Operators
|
|
||||||
ilImage& operator = (ILuint);
|
|
||||||
ilImage& operator = (const ilImage &);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ILuint Id;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ILvoid iStartUp();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ilFilters
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Alienify(ilImage &);
|
|
||||||
static ILboolean BlurAvg(ilImage &, ILuint Iter);
|
|
||||||
static ILboolean BlurGaussian(ilImage &, ILuint Iter);
|
|
||||||
static ILboolean Contrast(ilImage &, ILfloat Contrast);
|
|
||||||
static ILboolean EdgeDetectE(ilImage &);
|
|
||||||
static ILboolean EdgeDetectP(ilImage &);
|
|
||||||
static ILboolean EdgeDetectS(ilImage &);
|
|
||||||
static ILboolean Emboss(ilImage &);
|
|
||||||
static ILboolean Gamma(ilImage &, ILfloat Gamma);
|
|
||||||
static ILboolean Negative(ilImage &);
|
|
||||||
static ILboolean Noisify(ilImage &, ILubyte Factor);
|
|
||||||
static ILboolean Pixelize(ilImage &, ILuint PixSize);
|
|
||||||
static ILboolean Saturate(ilImage &, ILfloat Saturation);
|
|
||||||
static ILboolean Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
|
|
||||||
static ILboolean ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b);
|
|
||||||
static ILboolean Sharpen(ilImage &, ILfloat Factor, ILuint Iter);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_OPENGL
|
|
||||||
class ilOgl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILvoid Init(void);
|
|
||||||
static GLuint BindTex(ilImage &);
|
|
||||||
static ILboolean Upload(ilImage &, ILuint);
|
|
||||||
static GLuint Mipmap(ilImage &);
|
|
||||||
static ILboolean Screen(void);
|
|
||||||
static ILboolean Screenie(void);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_OPENGL
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_ALLEGRO
|
|
||||||
class ilAlleg
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILvoid Init(void);
|
|
||||||
static BITMAP *Convert(ilImage &);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_WIN32
|
|
||||||
class ilWin32
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILvoid Init(void);
|
|
||||||
static HBITMAP Convert(ilImage &);
|
|
||||||
static ILboolean GetClipboard(ilImage &);
|
|
||||||
static ILvoid GetInfo(ilImage &, BITMAPINFO *Info);
|
|
||||||
static ILubyte *GetPadData(ilImage &);
|
|
||||||
static HPALETTE GetPal(ilImage &);
|
|
||||||
static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType);
|
|
||||||
static ILboolean GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type);
|
|
||||||
static ILboolean SetClipboard(ilImage &);
|
|
||||||
};
|
|
||||||
#endif//ILUT_USE_WIN32
|
|
||||||
|
|
||||||
|
|
||||||
class ilValidate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Valid(ILenum, char *);
|
|
||||||
static ILboolean Valid(ILenum, FILE *);
|
|
||||||
static ILboolean Valid(ILenum, ILvoid *, ILuint);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ilState
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILboolean Disable(ILenum);
|
|
||||||
static ILboolean Enable(ILenum);
|
|
||||||
static ILvoid Get(ILenum, ILboolean &);
|
|
||||||
static ILvoid Get(ILenum, ILint &);
|
|
||||||
static ILboolean GetBool(ILenum);
|
|
||||||
static ILint GetInt(ILenum);
|
|
||||||
static const char *GetString(ILenum);
|
|
||||||
static ILboolean IsDisabled(ILenum);
|
|
||||||
static ILboolean IsEnabled(ILenum);
|
|
||||||
static ILboolean Origin(ILenum);
|
|
||||||
static ILvoid Pop(void);
|
|
||||||
static ILvoid Push(ILuint);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ilError
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static ILvoid Check(ILvoid (*Callback)(const char*));
|
|
||||||
static ILvoid Check(ILvoid (*Callback)(ILenum));
|
|
||||||
static ILenum Get(void);
|
|
||||||
static const char *String(void);
|
|
||||||
static const char *String(ILenum);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif//WRAPPER_H
|
|
@ -1,198 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ImageLib Utility Sources
|
|
||||||
// Copyright (C) 2000-2017 by Denton Woods
|
|
||||||
// Last modified: 03/07/2009
|
|
||||||
//
|
|
||||||
// Filename: IL/ilu.h
|
|
||||||
//
|
|
||||||
// Description: The main include file for ILU
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Doxygen comment
|
|
||||||
/*! \file ilu.h
|
|
||||||
The main include file for ILU
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ilu_h_
|
|
||||||
#ifndef __ILU_H__
|
|
||||||
|
|
||||||
#define __ilu_h_
|
|
||||||
#define __ILU_H__
|
|
||||||
|
|
||||||
#include <IL/il.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
#pragma comment(lib, "ILU.lib")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define ILU_VERSION_1_8_0 1
|
|
||||||
#define ILU_VERSION 180
|
|
||||||
|
|
||||||
|
|
||||||
#define ILU_FILTER 0x2600
|
|
||||||
#define ILU_NEAREST 0x2601
|
|
||||||
#define ILU_LINEAR 0x2602
|
|
||||||
#define ILU_BILINEAR 0x2603
|
|
||||||
#define ILU_SCALE_BOX 0x2604
|
|
||||||
#define ILU_SCALE_TRIANGLE 0x2605
|
|
||||||
#define ILU_SCALE_BELL 0x2606
|
|
||||||
#define ILU_SCALE_BSPLINE 0x2607
|
|
||||||
#define ILU_SCALE_LANCZOS3 0x2608
|
|
||||||
#define ILU_SCALE_MITCHELL 0x2609
|
|
||||||
|
|
||||||
|
|
||||||
// Error types
|
|
||||||
#define ILU_INVALID_ENUM 0x0501
|
|
||||||
#define ILU_OUT_OF_MEMORY 0x0502
|
|
||||||
#define ILU_INTERNAL_ERROR 0x0504
|
|
||||||
#define ILU_INVALID_VALUE 0x0505
|
|
||||||
#define ILU_ILLEGAL_OPERATION 0x0506
|
|
||||||
#define ILU_INVALID_PARAM 0x0509
|
|
||||||
|
|
||||||
|
|
||||||
// Values
|
|
||||||
#define ILU_PLACEMENT 0x0700
|
|
||||||
#define ILU_LOWER_LEFT 0x0701
|
|
||||||
#define ILU_LOWER_RIGHT 0x0702
|
|
||||||
#define ILU_UPPER_LEFT 0x0703
|
|
||||||
#define ILU_UPPER_RIGHT 0x0704
|
|
||||||
#define ILU_CENTER 0x0705
|
|
||||||
#define ILU_CONVOLUTION_MATRIX 0x0710
|
|
||||||
|
|
||||||
#define ILU_VERSION_NUM IL_VERSION_NUM
|
|
||||||
#define ILU_VENDOR IL_VENDOR
|
|
||||||
|
|
||||||
|
|
||||||
// Languages
|
|
||||||
#define ILU_ENGLISH 0x0800
|
|
||||||
#define ILU_ARABIC 0x0801
|
|
||||||
#define ILU_DUTCH 0x0802
|
|
||||||
#define ILU_JAPANESE 0x0803
|
|
||||||
#define ILU_SPANISH 0x0804
|
|
||||||
#define ILU_GERMAN 0x0805
|
|
||||||
#define ILU_FRENCH 0x0806
|
|
||||||
#define ILU_ITALIAN 0x0807
|
|
||||||
|
|
||||||
|
|
||||||
// Filters
|
|
||||||
/*
|
|
||||||
#define ILU_FILTER_BLUR 0x0803
|
|
||||||
#define ILU_FILTER_GAUSSIAN_3x3 0x0804
|
|
||||||
#define ILU_FILTER_GAUSSIAN_5X5 0x0805
|
|
||||||
#define ILU_FILTER_EMBOSS1 0x0807
|
|
||||||
#define ILU_FILTER_EMBOSS2 0x0808
|
|
||||||
#define ILU_FILTER_LAPLACIAN1 0x080A
|
|
||||||
#define ILU_FILTER_LAPLACIAN2 0x080B
|
|
||||||
#define ILU_FILTER_LAPLACIAN3 0x080C
|
|
||||||
#define ILU_FILTER_LAPLACIAN4 0x080D
|
|
||||||
#define ILU_FILTER_SHARPEN1 0x080E
|
|
||||||
#define ILU_FILTER_SHARPEN2 0x080F
|
|
||||||
#define ILU_FILTER_SHARPEN3 0x0810
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
typedef 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
|
|
||||||
} ILinfo;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct ILpointf {
|
|
||||||
ILfloat x;
|
|
||||||
ILfloat y;
|
|
||||||
} ILpointf;
|
|
||||||
|
|
||||||
typedef struct ILpointi {
|
|
||||||
ILint x;
|
|
||||||
ILint y;
|
|
||||||
} ILpointi;
|
|
||||||
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluAlienify(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluBlurAvg(ILuint Iter);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluBlurGaussian(ILuint Iter);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluBuildMipmaps(void);
|
|
||||||
ILAPI ILuint ILAPIENTRY iluColoursUsed(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluCompareImage(ILuint Comp);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluContrast(ILfloat Contrast);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluCrop(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth);
|
|
||||||
ILAPI void ILAPIENTRY iluDeleteImage(ILuint Id); // Deprecated
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEdgeDetectE(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEdgeDetectP(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEdgeDetectS(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEmboss(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEqualize(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluEqualize2(void);
|
|
||||||
ILAPI ILconst_string ILAPIENTRY iluErrorString(ILenum Error);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluConvolution(ILint *matrix, ILint scale, ILint bias);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluFlipImage(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluGammaCorrect(ILfloat Gamma);
|
|
||||||
ILAPI ILuint ILAPIENTRY iluGenImage(void); // Deprecated
|
|
||||||
ILAPI void ILAPIENTRY iluGetImageInfo(ILinfo *Info);
|
|
||||||
ILAPI ILint ILAPIENTRY iluGetInteger(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY iluGetIntegerv(ILenum Mode, ILint *Param);
|
|
||||||
ILAPI ILstring ILAPIENTRY iluGetString(ILenum StringName);
|
|
||||||
ILAPI void ILAPIENTRY iluImageParameter(ILenum PName, ILenum Param);
|
|
||||||
ILAPI void ILAPIENTRY iluInit(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluInvertAlpha(void);
|
|
||||||
ILAPI ILuint ILAPIENTRY iluLoadImage(ILconst_string FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluMirror(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluNegative(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluNoisify(ILclampf Tolerance);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluPixelize(ILuint PixSize);
|
|
||||||
ILAPI void ILAPIENTRY iluRegionfv(ILpointf *Points, ILuint n);
|
|
||||||
ILAPI void ILAPIENTRY iluRegioniv(ILpointi *Points, ILuint n);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluReplaceColour(ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluRotate(ILfloat Angle);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluRotate3D(ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSaturate1f(ILfloat Saturation);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluScale(ILuint Width, ILuint Height, ILuint Depth);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluScaleAlpha(ILfloat scale);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluScaleColours(ILfloat r, ILfloat g, ILfloat b);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSepia(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSetLanguage(ILenum Language);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSharpen(ILfloat Factor, ILuint Iter);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluSwapColours(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY iluWave(ILfloat Angle);
|
|
||||||
|
|
||||||
#define iluColorsUsed iluColoursUsed
|
|
||||||
#define iluSwapColors iluSwapColours
|
|
||||||
#define iluReplaceColor iluReplaceColour
|
|
||||||
#define iluScaleColor iluScaleColour
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __ILU_H__
|
|
||||||
#endif // __ilu_h_
|
|
@ -1,25 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ImageLib Utility Sources
|
|
||||||
// Copyright (C) 2000-2002 by Denton Woods
|
|
||||||
// Last modified: 07/09/2002 <--Y2K Compliant! =]
|
|
||||||
//
|
|
||||||
// Filename: src-ILU/src/ilu_region.h
|
|
||||||
//
|
|
||||||
// Description: Creates an image region.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef ILU_REGION_H
|
|
||||||
#define ILU_REGION_H
|
|
||||||
|
|
||||||
typedef struct Edge
|
|
||||||
{
|
|
||||||
ILint yUpper;
|
|
||||||
ILfloat xIntersect, dxPerScan;
|
|
||||||
struct Edge *next;
|
|
||||||
} Edge;
|
|
||||||
|
|
||||||
|
|
||||||
#endif//ILU_REGION_H
|
|
||||||
|
|
@ -1,354 +0,0 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ImageLib Utility Toolkit Sources
|
|
||||||
// Copyright (C) 2000-2017 by Denton Woods
|
|
||||||
// Last modified: 03/07/2009
|
|
||||||
//
|
|
||||||
// Filename: IL/ilut.h
|
|
||||||
//
|
|
||||||
// Description: The main include file for ILUT
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Doxygen comment
|
|
||||||
/*! \file ilut.h
|
|
||||||
The main include file for ILUT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ilut_h_
|
|
||||||
#ifndef __ILUT_H__
|
|
||||||
|
|
||||||
#define __ilut_h_
|
|
||||||
#define __ILUT_H__
|
|
||||||
|
|
||||||
#include <IL/il.h>
|
|
||||||
#include <IL/ilu.h>
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Defines
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#define ILUT_VERSION_1_8_0 1
|
|
||||||
#define ILUT_VERSION 180
|
|
||||||
|
|
||||||
|
|
||||||
// Attribute Bits
|
|
||||||
#define ILUT_OPENGL_BIT 0x00000001
|
|
||||||
#define ILUT_D3D_BIT 0x00000002
|
|
||||||
#define ILUT_ALL_ATTRIB_BITS 0x000FFFFF
|
|
||||||
|
|
||||||
|
|
||||||
// Error Types
|
|
||||||
#define ILUT_INVALID_ENUM 0x0501
|
|
||||||
#define ILUT_OUT_OF_MEMORY 0x0502
|
|
||||||
#define ILUT_INVALID_VALUE 0x0505
|
|
||||||
#define ILUT_ILLEGAL_OPERATION 0x0506
|
|
||||||
#define ILUT_INVALID_PARAM 0x0509
|
|
||||||
#define ILUT_COULD_NOT_OPEN_FILE 0x050A
|
|
||||||
#define ILUT_STACK_OVERFLOW 0x050E
|
|
||||||
#define ILUT_STACK_UNDERFLOW 0x050F
|
|
||||||
#define ILUT_BAD_DIMENSIONS 0x0511
|
|
||||||
#define ILUT_NOT_SUPPORTED 0x0550
|
|
||||||
|
|
||||||
|
|
||||||
// State Definitions
|
|
||||||
#define ILUT_PALETTE_MODE 0x0600
|
|
||||||
#define ILUT_OPENGL_CONV 0x0610
|
|
||||||
#define ILUT_D3D_MIPLEVELS 0x0620
|
|
||||||
#define ILUT_MAXTEX_WIDTH 0x0630
|
|
||||||
#define ILUT_MAXTEX_HEIGHT 0x0631
|
|
||||||
#define ILUT_MAXTEX_DEPTH 0x0632
|
|
||||||
#define ILUT_GL_USE_S3TC 0x0634
|
|
||||||
#define ILUT_D3D_USE_DXTC 0x0634
|
|
||||||
#define ILUT_GL_GEN_S3TC 0x0635
|
|
||||||
#define ILUT_D3D_GEN_DXTC 0x0635
|
|
||||||
#define ILUT_S3TC_FORMAT 0x0705
|
|
||||||
#define ILUT_DXTC_FORMAT 0x0705
|
|
||||||
#define ILUT_D3D_POOL 0x0706
|
|
||||||
#define ILUT_D3D_ALPHA_KEY_COLOR 0x0707
|
|
||||||
#define ILUT_D3D_ALPHA_KEY_COLOUR 0x0707
|
|
||||||
#define ILUT_FORCE_INTEGER_FORMAT 0x0636
|
|
||||||
|
|
||||||
//This new state does automatic texture target detection
|
|
||||||
//if enabled. Currently, only cubemap detection is supported.
|
|
||||||
//if the current image is no cubemap, the 2d texture is chosen.
|
|
||||||
#define ILUT_GL_AUTODETECT_TEXTURE_TARGET 0x0807
|
|
||||||
|
|
||||||
|
|
||||||
// Values
|
|
||||||
#define ILUT_VERSION_NUM IL_VERSION_NUM
|
|
||||||
#define ILUT_VENDOR IL_VENDOR
|
|
||||||
|
|
||||||
// The different rendering api's...more to be added later?
|
|
||||||
#define ILUT_OPENGL 0
|
|
||||||
#define ILUT_ALLEGRO 1
|
|
||||||
#define ILUT_WIN32 2
|
|
||||||
#define ILUT_DIRECT3D8 3
|
|
||||||
#define ILUT_DIRECT3D9 4
|
|
||||||
#define ILUT_X11 5
|
|
||||||
#define ILUT_DIRECT3D10 6
|
|
||||||
|
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(_WIN64))
|
|
||||||
#if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
||||||
#pragma comment(lib, "ILUT.lib")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <IL/ilut_config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// OpenGL
|
|
||||||
//////////////
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_OPENGL
|
|
||||||
#if defined(_MSC_VER) || defined(_WIN32)
|
|
||||||
//#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#endif//_MSC_VER
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#include <OpenGL/glu.h>
|
|
||||||
#else
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#endif//__APPLE__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_WIN32
|
|
||||||
//#define WIN32_LEAN_AND_MEAN
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define _CRTDBG_MAP_ALLOC
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
#include <crtdbg.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// If we can avoid including these in all cases thing tend to break less
|
|
||||||
// and we can keep all of them defined as available
|
|
||||||
//
|
|
||||||
// Kriss
|
|
||||||
//
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's Allegro Functions
|
|
||||||
#ifdef ILUT_USE_ALLEGRO
|
|
||||||
// #include <allegro.h>
|
|
||||||
#endif//ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_SDL
|
|
||||||
// #include <SDL.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_DIRECTX8
|
|
||||||
#include <d3d8.h>
|
|
||||||
#endif//ILUT_USE_DIRECTX9
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_DIRECTX9
|
|
||||||
#include <d3d9.h>
|
|
||||||
#endif//ILUT_USE_DIRECTX9
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_DIRECTX10
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4201) // Disables 'nonstandard extension used : nameless struct/union' warning
|
|
||||||
#include <rpcsal.h>
|
|
||||||
#include <sal.h>
|
|
||||||
#include <d3d10.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif//ILUT_USE_DIRECTX10
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_X11
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
#ifdef ILUT_USE_XSHM
|
|
||||||
#include <sys/ipc.h>
|
|
||||||
#include <sys/shm.h>
|
|
||||||
#include <X11/extensions/XShm.h>
|
|
||||||
#endif//ILUT_USE_XSHM
|
|
||||||
#endif//ILUT_USE_X11
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Functions
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit Functions
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutDisable(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutEnable(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGetBoolean(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilutGetBooleanv(ILenum Mode, ILboolean *Param);
|
|
||||||
ILAPI ILint ILAPIENTRY ilutGetInteger(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilutGetIntegerv(ILenum Mode, ILint *Param);
|
|
||||||
ILAPI ILstring ILAPIENTRY ilutGetString(ILenum StringName);
|
|
||||||
ILAPI void ILAPIENTRY ilutInit(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutIsDisabled(ILenum Mode);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutIsEnabled(ILenum Mode);
|
|
||||||
ILAPI void ILAPIENTRY ilutPopAttrib(void);
|
|
||||||
ILAPI void ILAPIENTRY ilutPushAttrib(ILuint Bits);
|
|
||||||
ILAPI void ILAPIENTRY ilutSetInteger(ILenum Mode, ILint Param);
|
|
||||||
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutRenderer(ILenum Renderer);
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's OpenGL Functions
|
|
||||||
#ifdef ILUT_USE_OPENGL
|
|
||||||
ILAPI GLuint ILAPIENTRY ilutGLBindTexImage();
|
|
||||||
ILAPI GLuint ILAPIENTRY ilutGLBindMipmaps(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLBuildMipmaps(void);
|
|
||||||
ILAPI GLuint ILAPIENTRY ilutGLLoadImage(ILstring FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLScreen(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLScreenie(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSaveImage(ILstring FileName, GLuint TexID);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSubTex2D(GLuint TexID, ILuint XOff, ILuint YOff);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSubTex3D(GLuint TexID, ILuint XOff, ILuint YOff, ILuint ZOff);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSetTex2D(GLuint TexID);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSetTex3D(GLuint TexID);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLTexImage(GLuint Level);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff);
|
|
||||||
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSetTex(GLuint TexID); // Deprecated - use ilutGLSetTex2D.
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff); // Use ilutGLSubTex2D.
|
|
||||||
#endif//ILUT_USE_OPENGL
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's Allegro Functions
|
|
||||||
#ifdef ILUT_USE_ALLEGRO
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#include <allegro.h>
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ILAPI BITMAP* ILAPIENTRY ilutAllegLoadImage(ILstring FileName);
|
|
||||||
ILAPI BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal);
|
|
||||||
#endif//ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's SDL Functions
|
|
||||||
#ifdef ILUT_USE_SDL
|
|
||||||
ILAPI struct SDL_Surface* ILAPIENTRY ilutConvertToSDLSurface(unsigned int flags);
|
|
||||||
ILAPI struct SDL_Surface* ILAPIENTRY ilutSDLSurfaceLoadImage(ILstring FileName);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutSDLSurfaceFromBitmap(struct SDL_Surface *Bitmap);
|
|
||||||
#endif//ILUT_USE_SDL
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's BeOS Functions
|
|
||||||
#ifdef ILUT_USE_BEOS
|
|
||||||
ILAPI BBitmap ILAPIENTRY ilutConvertToBBitmap(void);
|
|
||||||
#endif//ILUT_USE_BEOS
|
|
||||||
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's Win32 GDI Functions
|
|
||||||
#ifdef ILUT_USE_WIN32
|
|
||||||
ILAPI HBITMAP ILAPIENTRY ilutConvertToHBitmap(HDC hDC);
|
|
||||||
ILAPI HBITMAP ILAPIENTRY ilutConvertSliceToHBitmap(HDC hDC, ILuint slice);
|
|
||||||
ILAPI void ILAPIENTRY ilutFreePaddedData(ILubyte *Data);
|
|
||||||
ILAPI void ILAPIENTRY ilutGetBmpInfo(BITMAPINFO *Info);
|
|
||||||
ILAPI HPALETTE ILAPIENTRY ilutGetHPal(void);
|
|
||||||
ILAPI ILubyte* ILAPIENTRY ilutGetPaddedData(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutGetWinClipboard(void);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutLoadResource(HINSTANCE hInst, ILint ID, ILstring ResourceType, ILenum Type);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutSetHBitmap(HBITMAP Bitmap);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutSetHPal(HPALETTE Pal);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutSetWinClipboard(void);
|
|
||||||
ILAPI HBITMAP ILAPIENTRY ilutWinLoadImage(ILstring FileName, HDC hDC);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutWinLoadUrl(ILstring Url);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutWinPrint(ILuint XPos, ILuint YPos, ILuint Width, ILuint Height, HDC hDC);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutWinSaveImage(ILstring FileName, HBITMAP Bitmap);
|
|
||||||
#endif//ILUT_USE_WIN32
|
|
||||||
|
|
||||||
// ImageLib Utility Toolkit's DirectX 8 Functions
|
|
||||||
#ifdef ILUT_USE_DIRECTX8
|
|
||||||
// ILAPI void ILAPIENTRY ilutD3D8MipFunc(ILuint NumLevels);
|
|
||||||
ILAPI struct IDirect3DTexture8* ILAPIENTRY ilutD3D8Texture(struct IDirect3DDevice8 *Device);
|
|
||||||
ILAPI struct IDirect3DVolumeTexture8* ILAPIENTRY ilutD3D8VolumeTexture(struct IDirect3DDevice8 *Device);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DVolumeTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileInMemory(struct IDirect3DDevice8 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DVolumeTexture8 **Texture);
|
|
||||||
// These two are not tested yet.
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture8 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D8LoadSurface(struct IDirect3DDevice8 *Device, struct IDirect3DSurface8 *Surface);
|
|
||||||
#endif//ILUT_USE_DIRECTX8
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_DIRECTX9
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4115) // Disables 'named type definition in parentheses' warning
|
|
||||||
// ILAPI void ILAPIENTRY ilutD3D9MipFunc(ILuint NumLevels);
|
|
||||||
ILAPI struct IDirect3DTexture9* ILAPIENTRY ilutD3D9Texture (struct IDirect3DDevice9* Device);
|
|
||||||
ILAPI struct IDirect3DVolumeTexture9* ILAPIENTRY ilutD3D9VolumeTexture (struct IDirect3DDevice9* Device);
|
|
||||||
ILAPI struct IDirect3DCubeTexture9* ILAPIENTRY ilutD3D9CubeTexture (struct IDirect3DDevice9* Device);
|
|
||||||
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DCubeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DCubeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DCubeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9CubeTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DCubeTexture9 **Texture);
|
|
||||||
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFile(struct IDirect3DDevice9 *Device, ILconst_string FileName, struct IDirect3DVolumeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileInMemory(struct IDirect3DDevice9 *Device, void *Lump, ILuint Size, struct IDirect3DVolumeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DVolumeTexture9 **Texture);
|
|
||||||
|
|
||||||
// These three are not tested yet.
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, ILconst_string SrcResource, struct IDirect3DVolumeTexture9 **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D9LoadSurface(struct IDirect3DDevice9 *Device, struct IDirect3DSurface9 *Surface);
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif//ILUT_USE_DIRECTX9
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_DIRECTX10
|
|
||||||
ILAPI ID3D10Texture2D* ILAPIENTRY ilutD3D10Texture(ID3D10Device *Device);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFile(ID3D10Device *Device, ILconst_string FileName, ID3D10Texture2D **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileInMemory(ID3D10Device *Device, void *Lump, ILuint Size, ID3D10Texture2D **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromResource(ID3D10Device *Device, HMODULE SrcModule, ILconst_string SrcResource, ID3D10Texture2D **Texture);
|
|
||||||
ILAPI ILboolean ILAPIENTRY ilutD3D10TexFromFileHandle(ID3D10Device *Device, ILHANDLE File, ID3D10Texture2D **Texture);
|
|
||||||
#endif//ILUT_USE_DIRECTX10
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ILUT_USE_X11
|
|
||||||
ILAPI XImage * ILAPIENTRY ilutXCreateImage( Display* );
|
|
||||||
ILAPI Pixmap ILAPIENTRY ilutXCreatePixmap( Display*,Drawable );
|
|
||||||
ILAPI XImage * ILAPIENTRY ilutXLoadImage( Display*,char* );
|
|
||||||
ILAPI Pixmap ILAPIENTRY ilutXLoadPixmap( Display*,Drawable,char* );
|
|
||||||
#ifdef ILUT_USE_XSHM
|
|
||||||
ILAPI XImage * ILAPIENTRY ilutXShmCreateImage( Display*,XShmSegmentInfo* );
|
|
||||||
ILAPI void ILAPIENTRY ilutXShmDestroyImage( Display*,XImage*,XShmSegmentInfo* );
|
|
||||||
ILAPI Pixmap ILAPIENTRY ilutXShmCreatePixmap( Display*,Drawable,XShmSegmentInfo* );
|
|
||||||
ILAPI void ILAPIENTRY ilutXShmFreePixmap( Display*,Pixmap,XShmSegmentInfo* );
|
|
||||||
ILAPI XImage * ILAPIENTRY ilutXShmLoadImage( Display*,char*,XShmSegmentInfo* );
|
|
||||||
ILAPI Pixmap ILAPIENTRY ilutXShmLoadPixmap( Display*,Drawable,char*,XShmSegmentInfo* );
|
|
||||||
#endif//ILUT_USE_XSHM
|
|
||||||
#endif//ILUT_USE_X11
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __ILUT_H__
|
|
||||||
#endif // __ilut_h_
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef __ILUT_CONFIG_H__
|
|
||||||
#define __ILUT_CONFIG_H__
|
|
||||||
|
|
||||||
//#define IL_USE_PRAGMA_LIBS
|
|
||||||
|
|
||||||
// Supported APIs (ILUT)
|
|
||||||
|
|
||||||
//
|
|
||||||
// sorry just
|
|
||||||
// cant get this one to work under windows
|
|
||||||
// have disabled for the now
|
|
||||||
//
|
|
||||||
// will look at it some more later
|
|
||||||
//
|
|
||||||
// Kriss
|
|
||||||
//
|
|
||||||
#undef ILUT_USE_ALLEGRO
|
|
||||||
|
|
||||||
#undef ILUT_USE_DIRECTX8
|
|
||||||
//#define ILUT_USE_DIRECTX9
|
|
||||||
//#define ILUT_USE_DIRECTX10
|
|
||||||
#define ILUT_USE_OPENGL
|
|
||||||
//#define ILUT_USE_SDL
|
|
||||||
#define ILUT_USE_WIN32
|
|
||||||
|
|
||||||
#endif//__ILUT_CONFIG_H__
|
|
@ -1,393 +0,0 @@
|
|||||||
/*
|
|
||||||
** $Id: luadevil.c,v 1.1 2007-02-12 21:03:04 darkyojimbo Exp $
|
|
||||||
** Lua stand-alone interpreter
|
|
||||||
** See Copyright Notice in lua.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define lua_c
|
|
||||||
|
|
||||||
#include "lua.h"
|
|
||||||
|
|
||||||
#include "lauxlib.h"
|
|
||||||
#include "lualib.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static lua_State *globalL = NULL;
|
|
||||||
|
|
||||||
static const char *progname = LUA_PROGNAME;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void lstop (lua_State *L, lua_Debug *ar) {
|
|
||||||
(void)ar; /* unused arg. */
|
|
||||||
lua_sethook(L, NULL, 0, 0);
|
|
||||||
luaL_error(L, "interrupted!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void laction (int i) {
|
|
||||||
signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
|
|
||||||
terminate process (default action) */
|
|
||||||
lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void print_usage (void) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"usage: %s [options] [script [args]].\n"
|
|
||||||
"Available options are:\n"
|
|
||||||
" -e stat execute string " LUA_QL("stat") "\n"
|
|
||||||
" -l name require library " LUA_QL("name") "\n"
|
|
||||||
" -i enter interactive mode after executing " LUA_QL("script") "\n"
|
|
||||||
" -v show version information\n"
|
|
||||||
" -- stop handling options\n"
|
|
||||||
" - execute stdin and stop handling options\n"
|
|
||||||
,
|
|
||||||
progname);
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void l_message (const char *pname, const char *msg) {
|
|
||||||
if (pname) fprintf(stderr, "%s: ", pname);
|
|
||||||
fprintf(stderr, "%s\n", msg);
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int report (lua_State *L, int status) {
|
|
||||||
if (status && !lua_isnil(L, -1)) {
|
|
||||||
const char *msg = lua_tostring(L, -1);
|
|
||||||
if (msg == NULL) msg = "(error object is not a string)";
|
|
||||||
l_message(progname, msg);
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int traceback (lua_State *L) {
|
|
||||||
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
|
|
||||||
if (!lua_istable(L, -1)) {
|
|
||||||
lua_pop(L, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
lua_getfield(L, -1, "traceback");
|
|
||||||
if (!lua_isfunction(L, -1)) {
|
|
||||||
lua_pop(L, 2);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
lua_pushvalue(L, 1); /* pass error message */
|
|
||||||
lua_pushinteger(L, 2); /* skip this function and traceback */
|
|
||||||
lua_call(L, 2, 1); /* call debug.traceback */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int docall (lua_State *L, int narg, int clear) {
|
|
||||||
int status;
|
|
||||||
int base = lua_gettop(L) - narg; /* function index */
|
|
||||||
lua_pushcfunction(L, traceback); /* push traceback function */
|
|
||||||
lua_insert(L, base); /* put it under chunk and args */
|
|
||||||
signal(SIGINT, laction);
|
|
||||||
status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
lua_remove(L, base); /* remove traceback function */
|
|
||||||
/* force a complete garbage collection in case of errors */
|
|
||||||
if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void print_version (void) {
|
|
||||||
l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int getargs (lua_State *L, char **argv, int n) {
|
|
||||||
int narg;
|
|
||||||
int i;
|
|
||||||
int argc = 0;
|
|
||||||
while (argv[argc]) argc++; /* count total number of arguments */
|
|
||||||
narg = argc - (n + 1); /* number of arguments to the script */
|
|
||||||
luaL_checkstack(L, narg + 3, "too many arguments to script");
|
|
||||||
for (i=n+1; i < argc; i++)
|
|
||||||
lua_pushstring(L, argv[i]);
|
|
||||||
lua_createtable(L, narg, n + 1);
|
|
||||||
for (i=0; i < argc; i++) {
|
|
||||||
lua_pushstring(L, argv[i]);
|
|
||||||
lua_rawseti(L, -2, i - n);
|
|
||||||
}
|
|
||||||
return narg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int dofile (lua_State *L, const char *name) {
|
|
||||||
int status = luaL_loadfile(L, name) || docall(L, 0, 1);
|
|
||||||
return report(L, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int dostring (lua_State *L, const char *s, const char *name) {
|
|
||||||
int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1);
|
|
||||||
return report(L, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int dolibrary (lua_State *L, const char *name) {
|
|
||||||
lua_getglobal(L, "require");
|
|
||||||
lua_pushstring(L, name);
|
|
||||||
return report(L, lua_pcall(L, 1, 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char *get_prompt (lua_State *L, int firstline) {
|
|
||||||
const char *p;
|
|
||||||
lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2");
|
|
||||||
p = lua_tostring(L, -1);
|
|
||||||
if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
|
|
||||||
lua_pop(L, 1); /* remove global */
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int incomplete (lua_State *L, int status) {
|
|
||||||
if (status == LUA_ERRSYNTAX) {
|
|
||||||
size_t lmsg;
|
|
||||||
const char *msg = lua_tolstring(L, -1, &lmsg);
|
|
||||||
const char *tp = msg + lmsg - (sizeof(LUA_QL("<eof>")) - 1);
|
|
||||||
if (strstr(msg, LUA_QL("<eof>")) == tp) {
|
|
||||||
lua_pop(L, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0; /* else... */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int pushline (lua_State *L, int firstline) {
|
|
||||||
char buffer[LUA_MAXINPUT];
|
|
||||||
char *b = buffer;
|
|
||||||
size_t l;
|
|
||||||
const char *prmt = get_prompt(L, firstline);
|
|
||||||
if (lua_readline(L, b, prmt) == 0)
|
|
||||||
return 0; /* no input */
|
|
||||||
l = strlen(b);
|
|
||||||
if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
|
|
||||||
b[l-1] = '\0'; /* remove it */
|
|
||||||
if (firstline && b[0] == '=') /* first line starts with `=' ? */
|
|
||||||
lua_pushfstring(L, "return %s", b+1); /* change it to `return' */
|
|
||||||
else
|
|
||||||
lua_pushstring(L, b);
|
|
||||||
lua_freeline(L, b);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int loadline (lua_State *L) {
|
|
||||||
int status;
|
|
||||||
lua_settop(L, 0);
|
|
||||||
if (!pushline(L, 1))
|
|
||||||
return -1; /* no input */
|
|
||||||
for (;;) { /* repeat until gets a complete line */
|
|
||||||
status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
|
|
||||||
if (!incomplete(L, status)) break; /* cannot try to add lines? */
|
|
||||||
if (!pushline(L, 0)) /* no more input? */
|
|
||||||
return -1;
|
|
||||||
lua_pushliteral(L, "\n"); /* add a new line... */
|
|
||||||
lua_insert(L, -2); /* ...between the two lines */
|
|
||||||
lua_concat(L, 3); /* join them */
|
|
||||||
}
|
|
||||||
lua_saveline(L, 1);
|
|
||||||
lua_remove(L, 1); /* remove line */
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void dotty (lua_State *L) {
|
|
||||||
int status;
|
|
||||||
const char *oldprogname = progname;
|
|
||||||
progname = NULL;
|
|
||||||
while ((status = loadline(L)) != -1) {
|
|
||||||
if (status == 0) status = docall(L, 0, 0);
|
|
||||||
report(L, status);
|
|
||||||
if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */
|
|
||||||
lua_getglobal(L, "print");
|
|
||||||
lua_insert(L, 1);
|
|
||||||
if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0)
|
|
||||||
l_message(progname, lua_pushfstring(L,
|
|
||||||
"error calling " LUA_QL("print") " (%s)",
|
|
||||||
lua_tostring(L, -1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lua_settop(L, 0); /* clear stack */
|
|
||||||
fputs("\n", stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
progname = oldprogname;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int handle_script (lua_State *L, char **argv, int n) {
|
|
||||||
int status;
|
|
||||||
const char *fname;
|
|
||||||
int narg = getargs(L, argv, n); /* collect arguments */
|
|
||||||
lua_setglobal(L, "arg");
|
|
||||||
fname = argv[n];
|
|
||||||
if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
|
|
||||||
fname = NULL; /* stdin */
|
|
||||||
status = luaL_loadfile(L, fname);
|
|
||||||
lua_insert(L, -(narg+1));
|
|
||||||
if (status == 0)
|
|
||||||
status = docall(L, narg, 0);
|
|
||||||
else
|
|
||||||
lua_pop(L, narg);
|
|
||||||
return report(L, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* check that argument has no extra characters at the end */
|
|
||||||
#define notail(x) {if ((x)[2] != '\0') return -1;}
|
|
||||||
|
|
||||||
|
|
||||||
static int collectargs (char **argv, int *pi, int *pv, int *pe) {
|
|
||||||
int i;
|
|
||||||
for (i = 1; argv[i] != NULL; i++) {
|
|
||||||
if (argv[i][0] != '-') /* not an option? */
|
|
||||||
return i;
|
|
||||||
switch (argv[i][1]) { /* option */
|
|
||||||
case '-':
|
|
||||||
notail(argv[i]);
|
|
||||||
return (argv[i+1] != NULL ? i+1 : 0);
|
|
||||||
case '\0':
|
|
||||||
return i;
|
|
||||||
case 'i':
|
|
||||||
notail(argv[i]);
|
|
||||||
*pi = 1; /* go through */
|
|
||||||
case 'v':
|
|
||||||
notail(argv[i]);
|
|
||||||
*pv = 1;
|
|
||||||
break;
|
|
||||||
case 'e':
|
|
||||||
*pe = 1; /* go through */
|
|
||||||
case 'l':
|
|
||||||
if (argv[i][2] == '\0') {
|
|
||||||
i++;
|
|
||||||
if (argv[i] == NULL) return -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: return -1; /* invalid option */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int runargs (lua_State *L, char **argv, int n) {
|
|
||||||
int i;
|
|
||||||
for (i = 1; i < n; i++) {
|
|
||||||
if (argv[i] == NULL) continue;
|
|
||||||
lua_assert(argv[i][0] == '-');
|
|
||||||
switch (argv[i][1]) { /* option */
|
|
||||||
case 'e': {
|
|
||||||
const char *chunk = argv[i] + 2;
|
|
||||||
if (*chunk == '\0') chunk = argv[++i];
|
|
||||||
lua_assert(chunk != NULL);
|
|
||||||
if (dostring(L, chunk, "=(command line)") != 0)
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'l': {
|
|
||||||
const char *filename = argv[i] + 2;
|
|
||||||
if (*filename == '\0') filename = argv[++i];
|
|
||||||
lua_assert(filename != NULL);
|
|
||||||
if (dolibrary(L, filename))
|
|
||||||
return 1; /* stop if file fails */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int handle_luainit (lua_State *L) {
|
|
||||||
const char *init = getenv(LUA_INIT);
|
|
||||||
if (init == NULL) return 0; /* status OK */
|
|
||||||
else if (init[0] == '@')
|
|
||||||
return dofile(L, init+1);
|
|
||||||
else
|
|
||||||
return dostring(L, init, "=" LUA_INIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct Smain {
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
int status;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static int pmain (lua_State *L) {
|
|
||||||
struct Smain *s = (struct Smain *)lua_touserdata(L, 1);
|
|
||||||
char **argv = s->argv;
|
|
||||||
int script;
|
|
||||||
int has_i = 0, has_v = 0, has_e = 0;
|
|
||||||
globalL = L;
|
|
||||||
if (argv[0] && argv[0][0]) progname = argv[0];
|
|
||||||
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
|
|
||||||
luaL_openlibs(L); /* open libraries */
|
|
||||||
lua_gc(L, LUA_GCRESTART, 0);
|
|
||||||
s->status = handle_luainit(L);
|
|
||||||
if (s->status != 0) return 0;
|
|
||||||
script = collectargs(argv, &has_i, &has_v, &has_e);
|
|
||||||
if (script < 0) { /* invalid args? */
|
|
||||||
print_usage();
|
|
||||||
s->status = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (has_v) print_version();
|
|
||||||
s->status = runargs(L, argv, (script > 0) ? script : s->argc);
|
|
||||||
if (s->status != 0) return 0;
|
|
||||||
if (script)
|
|
||||||
s->status = handle_script(L, argv, script);
|
|
||||||
if (s->status != 0) return 0;
|
|
||||||
if (has_i)
|
|
||||||
dotty(L);
|
|
||||||
else if (script == 0 && !has_e && !has_v) {
|
|
||||||
if (lua_stdin_is_tty()) {
|
|
||||||
print_version();
|
|
||||||
dotty(L);
|
|
||||||
}
|
|
||||||
else dofile(L, NULL); /* executes stdin as a file */
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char **argv) {
|
|
||||||
int status;
|
|
||||||
struct Smain s;
|
|
||||||
lua_State *L = lua_open(); /* create state */
|
|
||||||
printf("DevIL embedded lua interpreter\n");
|
|
||||||
//@TODO: Where the heck is this defined?
|
|
||||||
//Devil_Init(L);
|
|
||||||
if (L == NULL) {
|
|
||||||
l_message(argv[0], "cannot create state: not enough memory");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
s.argc = argc;
|
|
||||||
s.argv = argv;
|
|
||||||
status = lua_cpcall(L, &pmain, &s);
|
|
||||||
report(L, status);
|
|
||||||
lua_close(L);
|
|
||||||
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
timestamp
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,17 +6,19 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMCMakeModule)
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMCMakeModule)
|
||||||
|
|
||||||
|
set(ULRE_3RDPTY_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdpty)
|
||||||
|
|
||||||
include(vulkan)
|
include(vulkan)
|
||||||
|
|
||||||
include(math)
|
include(math)
|
||||||
use_mgl(${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/MathGeoLib)
|
use_mgl(${ULRE_3RDPTY_ROOT_PATH}/MathGeoLib)
|
||||||
|
|
||||||
include(use_cm_module)
|
include(use_cm_module)
|
||||||
use_cm_module(Core)
|
use_cm_module(Core)
|
||||||
use_cm_module(Platform)
|
use_cm_module(Platform)
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/jsoncpp/include)
|
include_directories(${ULRE_3RDPTY_ROOT_PATH}/jsoncpp/include)
|
||||||
add_subdirectory(3rdpty/jsoncpp)
|
add_subdirectory(3rdpty/jsoncpp)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -34,12 +36,12 @@ SET(ULRE CMCore
|
|||||||
${RENDER_LIBRARY}
|
${RENDER_LIBRARY}
|
||||||
${Vulkan_LIBRARIES})
|
${Vulkan_LIBRARIES})
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/assimp/include)
|
include_directories(${ULRE_3RDPTY_ROOT_PATH}/assimp/include)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/NvTriStrip)
|
include_directories(${ULRE_3RDPTY_ROOT_PATH}/NvTriStrip)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
||||||
|
|
||||||
SET(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
SET(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
||||||
SET(SPIRV_CROSS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/SPIRV-Cross)
|
SET(SPIRV_CROSS_PATH ${ULRE_3RDPTY_ROOT_PATH}/SPIRV-Cross)
|
||||||
|
|
||||||
include_directories(${SPIRV_CROSS_PATH})
|
include_directories(${SPIRV_CROSS_PATH})
|
||||||
add_subdirectory(${SPIRV_CROSS_PATH})
|
add_subdirectory(${SPIRV_CROSS_PATH})
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
add_executable(TexConv MainUnit.cpp ${HGL_GRAPHICS_MAIN_SOURCE})
|
|
||||||
|
|
||||||
target_compile_definitions(TexConv PRIVATE "-DIL_STATIC_LIB")
|
|
||||||
target_include_directories(TexConv PRIVATE ${CMGDK_PATH}/src/PlugIn/Image.Monolayer/DevIL/include)
|
|
||||||
target_link_libraries(TexConv ${HGL_GRAPHICS_LIB} DevIL)
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(TexConv PROPERTIES WIN32_EXECUTABLE "true")
|
|
@ -1,708 +0,0 @@
|
|||||||
#include<hgl/Graphics.h>
|
|
||||||
|
|
||||||
#include<hgl/graph/Render.h> //SetClearColor
|
|
||||||
#include<hgl/graph/Shader.h> //GLSL
|
|
||||||
#include<hgl/graph/Texture.h> //Texture
|
|
||||||
#include<hgl/graph/Material.h> //Material
|
|
||||||
#include<hgl/graph/VertexBuffer.h> //VB3f/VB4f
|
|
||||||
#include<hgl/graph/Renderable.h> //Renderable
|
|
||||||
#include<hgl/Time.h> //GetMicroTime
|
|
||||||
|
|
||||||
#include<hgl/io/FileOutputStream.h>
|
|
||||||
#include<hgl/ut/CmdParse.h>
|
|
||||||
#include<hgl/graph/Bitmap.h>
|
|
||||||
#include<hgl/Str.h>
|
|
||||||
#include<hgl/Info.h> //GetString
|
|
||||||
|
|
||||||
#include<IL/il.h>
|
|
||||||
#include<IL/ilu.h>
|
|
||||||
|
|
||||||
#include<string.h>
|
|
||||||
|
|
||||||
using namespace hgl;
|
|
||||||
using namespace hgl::io;
|
|
||||||
using namespace hgl::util;
|
|
||||||
using namespace hgl::graph;
|
|
||||||
using namespace hgl::filesystem;
|
|
||||||
|
|
||||||
const TextureFormat *default_r8 =&TextureFormatInfoList[HGL_SF_R8];
|
|
||||||
const TextureFormat *default_rg8 =&TextureFormatInfoList[HGL_SF_RG8];
|
|
||||||
const TextureFormat *default_rgb8 =&TextureFormatInfoList[HGL_SF_RGB8];
|
|
||||||
const TextureFormat *default_rgba8 =&TextureFormatInfoList[HGL_SF_RGBA8];
|
|
||||||
|
|
||||||
const TextureFormat *default_r16 =&TextureFormatInfoList[HGL_SF_R16];
|
|
||||||
const TextureFormat *default_r32f =&TextureFormatInfoList[HGL_SF_R32F];
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
const TextureFormat * glfmt[4] ={NULL,NULL,NULL,NULL}; //选中格式
|
|
||||||
bool gen_mipmaps =false; //是否产生mipmaps
|
|
||||||
|
|
||||||
bool only_view =false; //仅显示
|
|
||||||
|
|
||||||
bool use_color_key=false; //是否使用ColorKey
|
|
||||||
uint8 color_key[3]; //ColorKey颜色
|
|
||||||
|
|
||||||
const float texcoord[] ={0.0f,0.0f, 1.0f,0.0f, 1.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f, 0.0f,1.0f};
|
|
||||||
|
|
||||||
VertexArray * va =NULL;
|
|
||||||
Renderable * render_obj =NULL;
|
|
||||||
Material * mtl =NULL;
|
|
||||||
Texture2D * tex =NULL;
|
|
||||||
VB2f * vertex =NULL;
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
//OpenIL数据
|
|
||||||
|
|
||||||
uint il_index=0; //图片索引
|
|
||||||
int il_width,il_height,il_bit;
|
|
||||||
uint il_format=0;
|
|
||||||
uint il_type=0;
|
|
||||||
uint il_pal_type=0;
|
|
||||||
uint il_pal_color_num=0;
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
//统计数据
|
|
||||||
|
|
||||||
int max_pixels=0; //最大像素数
|
|
||||||
uint8 *image_data=NULL; //图像数据
|
|
||||||
|
|
||||||
int max_bytes=0; //最大字节数
|
|
||||||
uint8 *texture_data=NULL; //贴图数据
|
|
||||||
|
|
||||||
int convert_count=0; //转换总数
|
|
||||||
int bytes_count=0; //总字节数
|
|
||||||
int cbytes_count=0; //转换后总字节数
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
const TextureFormat *CheckOpenGLCoreFormat(const CmdParse &cmd,const os_char *flag,const TextureFormat *default_tf)
|
|
||||||
{
|
|
||||||
OSString fmtstr;
|
|
||||||
|
|
||||||
if(!cmd.GetString(flag,fmtstr))return(nullptr);
|
|
||||||
|
|
||||||
#if HGL_OS==HGL_OS_Windows
|
|
||||||
UTF8String str=to_u8(fmtstr);
|
|
||||||
|
|
||||||
const TextureFormat *result=GetTextureFormat(str.c_str());
|
|
||||||
#else
|
|
||||||
const TextureFormat *result=GetTextureFormat(fmtstr.c_str());
|
|
||||||
#endif//HGL_OS==HGL_OS_Windows
|
|
||||||
|
|
||||||
if(result)return(result);
|
|
||||||
|
|
||||||
return default_tf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckOpenGLCoreFormat(const CmdParse &cmd)
|
|
||||||
{
|
|
||||||
//指定格式
|
|
||||||
glfmt[0]=CheckOpenGLCoreFormat(cmd,OS_TEXT("/R:"), &TextureFormatInfoList[HGL_SF_R8]);
|
|
||||||
glfmt[1]=CheckOpenGLCoreFormat(cmd,OS_TEXT("/RG:"), &TextureFormatInfoList[HGL_SF_RG8]);
|
|
||||||
glfmt[2]=CheckOpenGLCoreFormat(cmd,OS_TEXT("/RGB:"), &TextureFormatInfoList[HGL_SF_RGB8]);
|
|
||||||
glfmt[3]=CheckOpenGLCoreFormat(cmd,OS_TEXT("/RGBA:"), &TextureFormatInfoList[HGL_SF_RGBA8]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckColorKey(const CmdParse &cmd)
|
|
||||||
{
|
|
||||||
OSString ckstr;
|
|
||||||
|
|
||||||
if(!cmd.GetString(OS_TEXT("/ColorKey:"),ckstr))return;
|
|
||||||
|
|
||||||
os_char rgbstr[6];
|
|
||||||
|
|
||||||
hgl_cpy(rgbstr,ckstr.c_str(),6); //注意:hgl_cpy是跨类型复制的,不要替换成strcpy或memcpy
|
|
||||||
|
|
||||||
ParseHexStr(color_key[0],rgbstr+0);
|
|
||||||
ParseHexStr(color_key[1],rgbstr+2);
|
|
||||||
ParseHexStr(color_key[2],rgbstr+4);
|
|
||||||
|
|
||||||
use_color_key=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckSameAlpha(uint8 *data,uint count)
|
|
||||||
{
|
|
||||||
uint8 *p=data;
|
|
||||||
|
|
||||||
while(count--)
|
|
||||||
{
|
|
||||||
if(*p!=*data)return(false);
|
|
||||||
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测RGB数据是否一致
|
|
||||||
*/
|
|
||||||
bool CheckSameRGB(uint8 *data,int color,uint count)
|
|
||||||
{
|
|
||||||
uint8 *p=data;
|
|
||||||
|
|
||||||
while(count--)
|
|
||||||
{
|
|
||||||
if(memcmp(data,p,color-1))
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
p+=color;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixLA(uint8 *lum,uint8 *alpha,int size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<size;i++)
|
|
||||||
{
|
|
||||||
lum++;
|
|
||||||
*lum++=*alpha++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixRGBA(uint8 *rgba,uint8 *alpha,int size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<size;i++)
|
|
||||||
{
|
|
||||||
rgba+=3;
|
|
||||||
*rgba++=*alpha++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlipData(uint8 *data,int line_bytes,int row_number)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uint8 *temp=new uint8[line_bytes];
|
|
||||||
uint8 *end=data+line_bytes*(row_number-1);
|
|
||||||
|
|
||||||
for(i=0;i<row_number/2;i++)
|
|
||||||
{
|
|
||||||
memcpy(temp,data,line_bytes);
|
|
||||||
memcpy(data,end,line_bytes);
|
|
||||||
memcpy(end,temp,line_bytes);
|
|
||||||
|
|
||||||
data+=line_bytes;
|
|
||||||
end-=line_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertPixelFormat()
|
|
||||||
{
|
|
||||||
uint fmt=il_format;
|
|
||||||
|
|
||||||
if(il_format==IL_BGR)
|
|
||||||
fmt=IL_RGB;
|
|
||||||
else
|
|
||||||
if(il_format==IL_BGRA)
|
|
||||||
fmt=IL_RGBA;
|
|
||||||
|
|
||||||
if(il_format==IL_RGBA||il_format==IL_BGRA||il_format==IL_LUMINANCE_ALPHA)
|
|
||||||
{
|
|
||||||
uint8 *alpha=ilGetAlpha(IL_UNSIGNED_BYTE);
|
|
||||||
uint count=il_width*il_height;
|
|
||||||
uint color=(il_format==IL_LUMINANCE_ALPHA?2:3);
|
|
||||||
|
|
||||||
if(CheckSameAlpha(alpha,count)) //检测ALPHA全部一样的,将RGBA转为RGB,将LA转为L
|
|
||||||
{
|
|
||||||
if(il_format==IL_RGBA||il_format==IL_BGRA)
|
|
||||||
{
|
|
||||||
fmt=IL_RGB;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(il_format==IL_LUMINANCE_ALPHA)
|
|
||||||
{
|
|
||||||
fmt=IL_LUMINANCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //如果ALPHA不同,检测颜色是否相同,如果相同只留ALPHA
|
|
||||||
{
|
|
||||||
uint8 *data=ilGetData();
|
|
||||||
uint count=il_width*il_height;
|
|
||||||
|
|
||||||
if(CheckSameRGB(data,color,count))
|
|
||||||
fmt=IL_ALPHA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(alpha)free(alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(il_format==IL_RGB||il_format==IL_BGR)
|
|
||||||
{
|
|
||||||
if(CheckMono(ilGetData(),3,il_width,il_height))
|
|
||||||
fmt=IL_LUMINANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fmt!=IL_ALPHA //只有ALPHA就不检测
|
|
||||||
&&(il_format==IL_RGBA||il_format==IL_BGRA))
|
|
||||||
{
|
|
||||||
if(CheckMono(ilGetData(),4,il_width,il_height))
|
|
||||||
{
|
|
||||||
if(fmt==IL_RGB) //前面一段代码已经将alpha砍掉了
|
|
||||||
fmt=IL_LUMINANCE;
|
|
||||||
else
|
|
||||||
fmt=IL_LUMINANCE_ALPHA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fmt!=il_format)
|
|
||||||
{
|
|
||||||
ilConvertImage(fmt,il_type);
|
|
||||||
|
|
||||||
il_format=fmt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckPalette()
|
|
||||||
{
|
|
||||||
uint pal=il_pal_type;
|
|
||||||
|
|
||||||
if(il_pal_type==IL_PAL_BGR24||il_pal_type==IL_PAL_BGR32||il_pal_type==IL_PAL_RGB32)
|
|
||||||
pal=IL_PAL_RGB24;
|
|
||||||
else
|
|
||||||
if(il_pal_type==IL_PAL_BGRA32)
|
|
||||||
pal=IL_PAL_RGBA32;
|
|
||||||
|
|
||||||
if(pal!=il_pal_type)
|
|
||||||
{
|
|
||||||
ilConvertPal(pal);
|
|
||||||
|
|
||||||
il_pal_type=pal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveTexture2DToFile(const os_char *filename,void *texture_data,uint width,uint height,const char *format,uint bytes,bool include_color_key)
|
|
||||||
{
|
|
||||||
os_char tex_fn[HGL_MAX_PATH];
|
|
||||||
char fmt_str[17];
|
|
||||||
|
|
||||||
replace_extname(tex_fn,filename,HGL_MAX_PATH,OS_TEXT("Tex2D"));
|
|
||||||
|
|
||||||
FileOutputStream fs;
|
|
||||||
DataOutputStream *dos;
|
|
||||||
|
|
||||||
if(!fs.CreateTrunc(tex_fn))
|
|
||||||
{
|
|
||||||
LOG_INFO(OS_TEXT("\tCreateFile(")+OSString(tex_fn)+OS_TEXT(") error!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dos=new LEDataOutputStream(&fs);
|
|
||||||
|
|
||||||
memset(fmt_str,0,17);
|
|
||||||
hgl::strcpy(fmt_str,16,format);
|
|
||||||
|
|
||||||
dos->Write("Tex\x1A",4);
|
|
||||||
dos->WriteUint8(1); //版本号
|
|
||||||
dos->WriteBool(false); //是否有mipmaps
|
|
||||||
dos->Write(fmt_str,16); //格式
|
|
||||||
dos->WriteUint32(bytes); //字节数
|
|
||||||
|
|
||||||
if(include_color_key)
|
|
||||||
{
|
|
||||||
dos->WriteBool(true);
|
|
||||||
dos->WriteUint8(color_key,3);
|
|
||||||
|
|
||||||
LOG_INFO(OS_TEXT("\tColor Key: true"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dos->Write("\0\0\0\0",4);
|
|
||||||
}
|
|
||||||
|
|
||||||
dos->WriteUint32(width); //宽
|
|
||||||
dos->WriteUint32(height); //高
|
|
||||||
|
|
||||||
dos->Write(texture_data,bytes);
|
|
||||||
delete dos;
|
|
||||||
|
|
||||||
LOG_INFO(OS_TEXT("\tSave to ")+OSString(tex_fn));
|
|
||||||
}
|
|
||||||
|
|
||||||
int ConvertImage(const os_char *filename)
|
|
||||||
{
|
|
||||||
bool confirm_color_key=false;
|
|
||||||
|
|
||||||
uint pixels=0;
|
|
||||||
const TextureFormat *curfmt=nullptr;
|
|
||||||
const TextureFormat *tarfmt=nullptr;
|
|
||||||
|
|
||||||
LOG_INFO(OS_TEXT("File: ")+OSString(filename));
|
|
||||||
|
|
||||||
ilGenImages(1,&il_index);
|
|
||||||
ilBindImage(il_index);
|
|
||||||
|
|
||||||
if(ilLoadImage(filename))
|
|
||||||
{
|
|
||||||
il_width =ilGetInteger(IL_IMAGE_WIDTH);
|
|
||||||
il_height =ilGetInteger(IL_IMAGE_HEIGHT);
|
|
||||||
il_bit =ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
|
|
||||||
il_format =ilGetInteger(IL_IMAGE_FORMAT);
|
|
||||||
il_type =ilGetInteger(IL_IMAGE_TYPE);
|
|
||||||
|
|
||||||
if(ilGetInteger(IL_IMAGE_ORIGIN)==IL_ORIGIN_LOWER_LEFT)
|
|
||||||
iluFlipImage();
|
|
||||||
|
|
||||||
LOG_INFO(OS_TEXT("\twidth: ")+OSString(il_width));
|
|
||||||
LOG_INFO(OS_TEXT("\theight: ")+OSString(il_height));
|
|
||||||
|
|
||||||
pixels=il_width*il_height;
|
|
||||||
|
|
||||||
if(pixels>max_pixels)
|
|
||||||
SAFE_CLEAR_ARRAY(image_data);
|
|
||||||
|
|
||||||
if(!image_data)
|
|
||||||
{
|
|
||||||
image_data=new uint8[pixels*4*4];
|
|
||||||
max_pixels=pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(il_format!=IL_COLOR_INDEX)
|
|
||||||
{
|
|
||||||
if(il_format==IL_LUMINANCE )
|
|
||||||
{
|
|
||||||
if(il_type==IL_UNSIGNED_BYTE)
|
|
||||||
curfmt=default_r8;
|
|
||||||
else
|
|
||||||
if(il_type==IL_UNSIGNED_SHORT)
|
|
||||||
curfmt=default_r16;
|
|
||||||
else
|
|
||||||
if(il_type==IL_FLOAT)
|
|
||||||
curfmt=default_r32f;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ilConvertImage(IL_LUMINANCE,IL_UNSIGNED_BYTE);
|
|
||||||
il_type=IL_UNSIGNED_BYTE;
|
|
||||||
|
|
||||||
curfmt=default_r8;
|
|
||||||
}
|
|
||||||
|
|
||||||
tarfmt=(glfmt[0]?glfmt[0]:curfmt);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetData(),pixels*curfmt->source_bytes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(il_type!=IL_UNSIGNED_BYTE)
|
|
||||||
{
|
|
||||||
ilConvertImage(il_format,IL_UNSIGNED_BYTE);
|
|
||||||
il_type=IL_UNSIGNED_BYTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConvertPixelFormat();
|
|
||||||
|
|
||||||
if(il_format==IL_LUMINANCE )
|
|
||||||
{
|
|
||||||
curfmt=default_r8;
|
|
||||||
tarfmt=(glfmt[0]?glfmt[0]:curfmt);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetData(),pixels);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(il_format==IL_ALPHA )
|
|
||||||
{
|
|
||||||
curfmt=default_r8;
|
|
||||||
tarfmt=(glfmt[0]?glfmt[0]:curfmt);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetAlpha(GL_UNSIGNED_BYTE),pixels);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(il_format==IL_LUMINANCE_ALPHA)
|
|
||||||
{
|
|
||||||
curfmt=default_rg8;
|
|
||||||
tarfmt=(glfmt[1]?glfmt[1]:curfmt);
|
|
||||||
|
|
||||||
uint8 *alpha=ilGetAlpha(GL_UNSIGNED_BYTE);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetData(),pixels*2);
|
|
||||||
|
|
||||||
MixLA(image_data,alpha,pixels);
|
|
||||||
|
|
||||||
free(alpha);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(il_format==IL_RGB )
|
|
||||||
{
|
|
||||||
curfmt=default_rgb8;
|
|
||||||
tarfmt=(glfmt[2]?glfmt[2]:curfmt);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetData(),pixels*3);
|
|
||||||
|
|
||||||
if(use_color_key) //检测ColorKey是否存在
|
|
||||||
{
|
|
||||||
unsigned char *p=image_data;
|
|
||||||
|
|
||||||
for(int i=0;i<pixels;i++)
|
|
||||||
{
|
|
||||||
if((image_data[0]==color_key[0])
|
|
||||||
&&(image_data[1]==color_key[1])
|
|
||||||
&&(image_data[2]==color_key[2]))
|
|
||||||
{
|
|
||||||
confirm_color_key=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
p+=3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(il_format==IL_RGBA )
|
|
||||||
{
|
|
||||||
curfmt=default_rgba8;
|
|
||||||
tarfmt=(glfmt[3]?glfmt[3]:curfmt);
|
|
||||||
|
|
||||||
uint8 *alpha=ilGetAlpha(GL_UNSIGNED_BYTE);
|
|
||||||
|
|
||||||
memcpy(image_data,ilGetData(),pixels*4);
|
|
||||||
|
|
||||||
MixRGBA(image_data,alpha,pixels);
|
|
||||||
|
|
||||||
free(alpha);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curfmt=NULL;
|
|
||||||
tarfmt=NULL;
|
|
||||||
|
|
||||||
LOG_INFO("\tsource format error");
|
|
||||||
|
|
||||||
ilDeleteImages(1,&il_index);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}//LUMINANCE
|
|
||||||
|
|
||||||
tex->SetImage(il_width,il_height,image_data,pixels*curfmt->source_bytes,curfmt->tsf,tarfmt->video_format);
|
|
||||||
|
|
||||||
#if HGL_OS == HGL_OS_Windows
|
|
||||||
LOG_INFO(OS_TEXT("\tcolor format = ")+to_u16(curfmt->name)+OS_TEXT(" bytes = ")+OSString(curfmt->source_bytes*il_width*il_height));
|
|
||||||
LOG_INFO(OS_TEXT("\ttarget format = ")+to_u16(tarfmt->name));
|
|
||||||
#else
|
|
||||||
LOG_INFO(OS_TEXT("\tcolor format = ")+OSString(curfmt->name)+OS_TEXT(" bytes = ")+OSString(curfmt->source_bytes*il_width*il_height));
|
|
||||||
LOG_INFO(OS_TEXT("\ttarget format = ")+OSString(tarfmt->name));
|
|
||||||
#endif//HGL_OS == HGL_OS_Windows
|
|
||||||
|
|
||||||
int bytes=tex->GetImage(NULL,tarfmt->tsf);
|
|
||||||
|
|
||||||
if(bytes>0)
|
|
||||||
{
|
|
||||||
LOG_INFO(OS_TEXT("\toutput bytes = ")+OSString(bytes));
|
|
||||||
|
|
||||||
if(bytes>max_bytes)
|
|
||||||
SAFE_CLEAR_ARRAY(texture_data);
|
|
||||||
|
|
||||||
if(!texture_data)
|
|
||||||
{
|
|
||||||
texture_data=new uint8[bytes];
|
|
||||||
max_bytes=bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
tex->GetImage(texture_data,tarfmt->tsf);
|
|
||||||
|
|
||||||
SaveTexture2DToFile(filename,texture_data,il_width,il_height,tarfmt->name,bytes,confirm_color_key);
|
|
||||||
|
|
||||||
convert_count++;
|
|
||||||
bytes_count+=il_width*il_height*curfmt->source_bytes;
|
|
||||||
cbytes_count+=bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else //索引色贴图
|
|
||||||
// {
|
|
||||||
// il_pal_type =ilGetInteger(IL_PALETTE_TYPE); //调色板类型
|
|
||||||
// il_pal_color_num=ilGetInteger(IL_PALETTE_NUM_COLS); //颜色数量
|
|
||||||
//
|
|
||||||
// LOG_INFO(OS_TEXT("\tpal color number = ")+OSString(il_pal_color_num));
|
|
||||||
//
|
|
||||||
// if(il_pal_color_num==16||il_pal_color_num==256)
|
|
||||||
// {
|
|
||||||
// CheckPalette();
|
|
||||||
//
|
|
||||||
// if(il_pal_type==IL_PAL_RGB24 &&il_pal_color_num== 16)curfmt=GetFormat("16RGB");else
|
|
||||||
//
|
|
||||||
// if(il_pal_type==IL_PAL_RGBA32&&il_pal_color_num== 16)curfmt=GetFormat("16RGBA");else
|
|
||||||
// if(il_pal_type==IL_PAL_RGB24 &&il_pal_color_num==256)curfmt=GetFormat("256RGB");else
|
|
||||||
// if(il_pal_type==IL_PAL_RGBA32&&il_pal_color_num==256)curfmt=GetFormat("256RGBA");else
|
|
||||||
// curfmt=NULL;
|
|
||||||
//
|
|
||||||
// if(curfmt)
|
|
||||||
// LOG_INFO(OS_TEXT("\tcolor format = ")+OSString(curfmt->name));
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// curfmt=NULL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(!curfmt)
|
|
||||||
LOG_INFO("\tformat error!\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_INFO("\tLoad File error!");
|
|
||||||
}
|
|
||||||
|
|
||||||
ilDeleteImages(1,&il_index);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
class EnumFileConfigApp:public EnumFileConfig
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
GraphicsApplication *app;
|
|
||||||
|
|
||||||
using EnumFileConfig::EnumFileConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
void EnumConvertImage(EnumFileConfig *efc,FileInfo &fi)
|
|
||||||
{
|
|
||||||
EnumFileConfigApp *efca=(EnumFileConfigApp *)efc;
|
|
||||||
|
|
||||||
GraphicsApplication *gapp=efca->app;
|
|
||||||
|
|
||||||
ConvertImage(fi.fullname);
|
|
||||||
|
|
||||||
render_obj->AutoCreateShader();
|
|
||||||
|
|
||||||
ClearColorDepthBuffer();
|
|
||||||
|
|
||||||
const int l=(GetScreenWidth()-il_width)/2;
|
|
||||||
const int t=(GetScreenHeight()-il_height)/2;
|
|
||||||
|
|
||||||
vertex->Begin();
|
|
||||||
vertex->WriteRect(l,t,il_width,il_height);
|
|
||||||
vertex->End();
|
|
||||||
|
|
||||||
DirectRender2D(render_obj);
|
|
||||||
|
|
||||||
gapp->SwapBuffer();
|
|
||||||
gapp->WaitActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
HGL_GRAPHICS_MAIN(sii,app,args)
|
|
||||||
{
|
|
||||||
CmdParse cmd(args);
|
|
||||||
|
|
||||||
bool sub=false;
|
|
||||||
|
|
||||||
sii.info.ProjectName=U8_TEXT("贴图转换");
|
|
||||||
sii.info.ProjectCode=OS_TEXT("Texture Converter");
|
|
||||||
sii.info.ProjectVersion=U8_TEXT("1.01");
|
|
||||||
|
|
||||||
if(!app.Init(&sii))return(-1);
|
|
||||||
|
|
||||||
LOG_INFO("argc="+UTF8String(args.GetCount()));
|
|
||||||
for(int i=0;i<args.GetCount();i++)
|
|
||||||
LOG_INFO(OS_TEXT("argv[")+OSString(i)+OS_TEXT("] ")+args[i]);
|
|
||||||
|
|
||||||
if(args.GetCount()<1)
|
|
||||||
{
|
|
||||||
char space[33];
|
|
||||||
constexpr uint STR_HINT_MAX=128+(32*HGL_SF_END);
|
|
||||||
char *hint=new char[STR_HINT_MAX];
|
|
||||||
|
|
||||||
hgl::strcpy(hint,STR_HINT_MAX,
|
|
||||||
"Command format:\n"
|
|
||||||
"\tTexConv <filename or pathname> [/s] [/view] [/R:?] [/RG:?] [/RGB:?] [/RGBA:?]\n"
|
|
||||||
"\n"
|
|
||||||
"Params:\n"
|
|
||||||
"\t/s : proc sub-directory\n"
|
|
||||||
"\n"
|
|
||||||
"support format:\n\n");
|
|
||||||
|
|
||||||
int count=0;
|
|
||||||
int len;
|
|
||||||
memset(space,' ',32);
|
|
||||||
space[32]=0;
|
|
||||||
|
|
||||||
for(int i=HGL_SF_NONE+1;i<HGL_SF_END;i++)
|
|
||||||
{
|
|
||||||
if(TextureFormatInfoList[i].name[0]==0)
|
|
||||||
{
|
|
||||||
if(count==0)
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,'\n');
|
|
||||||
else
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,"\n\n",2);
|
|
||||||
count=0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
len=hgl::strlen(TextureFormatInfoList[i].name);
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,TextureFormatInfoList[i].name,len);
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,space,16-len);
|
|
||||||
|
|
||||||
++count;
|
|
||||||
if(count==4)
|
|
||||||
{
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,'\n');
|
|
||||||
count=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
hgl::strcat(hint,STR_HINT_MAX,'\t');
|
|
||||||
}
|
|
||||||
|
|
||||||
//MessageBoxA(nullptr,hint,"TexConv",MB_OK|MB_ICONINFORMATION);
|
|
||||||
LOG_ERROR(hint);
|
|
||||||
|
|
||||||
delete[] hint;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cmd.Find(OS_TEXT("/s"))!=-1)sub=true; //检测是否处理子目录
|
|
||||||
|
|
||||||
if(cmd.Find(OS_TEXT("/view"))!=-1)only_view=true; //检测是否仅显示
|
|
||||||
if(cmd.Find(OS_TEXT("/mip"))!=-1)gen_mipmaps=true; //检测是否生成mipmaps
|
|
||||||
|
|
||||||
CheckColorKey(cmd);
|
|
||||||
CheckOpenGLCoreFormat(cmd); //检测推荐格式
|
|
||||||
|
|
||||||
ilInit();
|
|
||||||
|
|
||||||
OSString cur_path=info::GetString(info::hfsStartPath);
|
|
||||||
|
|
||||||
va=new VertexArray(HGL_PRIM_TRIANGLES);
|
|
||||||
va->SetVertexBuffer(vbtVertex,vertex=new VB2f(6,0,HGL_DYNAMIC_DRAW));
|
|
||||||
va->SetVertexBuffer(vbtDiffuseTexCoord,new VB2f(6,texcoord));
|
|
||||||
|
|
||||||
tex=CreateTexture2D();
|
|
||||||
|
|
||||||
mtl=new Material;
|
|
||||||
|
|
||||||
mtl->SetColorMaterial(false);
|
|
||||||
mtl->SetTexture(mtcDiffuse,tex);
|
|
||||||
|
|
||||||
render_obj=new Renderable(va,mtl);
|
|
||||||
|
|
||||||
render_obj->SetMaterial(mtl);
|
|
||||||
render_obj->SetTexCoord(mtcDiffuse,vbtDiffuseTexCoord);
|
|
||||||
|
|
||||||
double start_time=GetMicroTime();
|
|
||||||
double end_time;
|
|
||||||
|
|
||||||
EnumFileConfigApp efc;
|
|
||||||
|
|
||||||
efc.app =&app;
|
|
||||||
|
|
||||||
efc.folder_name =cur_path;
|
|
||||||
efc.find_name =args[0];
|
|
||||||
efc.proc_file =true;
|
|
||||||
efc.sub_folder =sub;
|
|
||||||
efc.cb_file =EnumConvertImage;
|
|
||||||
|
|
||||||
EnumFile(&efc);
|
|
||||||
|
|
||||||
end_time=GetTime();
|
|
||||||
|
|
||||||
LOG_INFO(OS_TEXT("总计转换图片")+OSString(convert_count)
|
|
||||||
+OS_TEXT("张,总计处理原始数据")+OSString(bytes_count)
|
|
||||||
+OS_TEXT("字节,转换后")+OSString(cbytes_count)
|
|
||||||
+OS_TEXT("字节,总计耗时")+OSString(end_time-start_time)+OS_TEXT("秒"));
|
|
||||||
|
|
||||||
delete[] image_data;
|
|
||||||
delete[] texture_data;
|
|
||||||
delete tex;
|
|
||||||
delete render_obj;
|
|
||||||
|
|
||||||
ilShutDown();
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user