Add DevIL 1.7.8.

This commit is contained in:
rude
2013-09-26 00:20:08 +02:00
parent 6e493fb605
commit c065120c58
487 changed files with 219483 additions and 0 deletions
@@ -0,0 +1,34 @@
/*
* altivec_typeconversion.h
* DevIL
*
* Created by Meloni Dario on 17/04/05.
*
*/
#include "il_internal.h"
#ifdef ALTIVEC_GCC
#ifndef ALTIVEC_COMMON
#define ALTIVEC_COMMON
typedef union {
vector unsigned int vuint;
unsigned int suint[4];
vector unsigned char vuchar;
unsigned char suchar[4];
vector float vf;
float sf[4];
} vector_t;
// Loads 16 byte from the specified address, aligned or not
//vector unsigned char load_unaligned( unsigned char *buffer );
// Fills a vector with the specified value
vector float fill_vector_f( float value );
#define eround(v,x) (((int)((v/x)*10)%10) > 0 ? (v/x) : (v/x)+1)
#define eround16(v) eround(v,16)
#endif
#endif
@@ -0,0 +1,28 @@
/*
* altivec_typeconversion.h
* DevIL
*
* Created by Meloni Dario on 24/04/05.
*
*/
#include "altivec_common.h"
#ifdef ALTIVEC_GCC
// data and newdata may be the same buffer
// Used to convert RGB <-> BGR in various data types
void abc2cba_byte( ILubyte *data, ILuint length, ILubyte *newdata );
void abc2cba_short( ILushort *data, ILuint length, ILushort *newdata );
void abc2cba_int( ILuint *data, ILuint length, ILuint *newdata );
#define abc2cba_float(x,y,z) abc2cba_int(((ILuint*)(x)),y,((ILuint*)(z)))
void abc2cba_double( ILdouble *data, ILuint length, ILdouble *newdata );
// Used to convert RGBA <-> BGRA in various data types
void abcd2cbad_byte( ILubyte *data, ILuint length, ILubyte *newdata );
void abcd2cbad_short( ILushort *data, ILuint length, ILushort *newdata );
void abcd2cbad_int( ILuint *data, ILuint length, ILuint *newdata );
#define abcd2cbad_float(x,y,z) abcd2cbad_int(((ILuint*)(x)),y,((ILuint*)(z)))
void abcd2cbad_double( ILdouble *data, ILuint length, ILdouble *newdata );
#endif
@@ -0,0 +1,41 @@
#ifndef ALLOC_H
#define ALLOC_H
/*#if defined(_WIN32) && defined(_MEM_DEBUG)
void *c_alloc(unsigned long size, unsigned long num, const char *file, unsigned long line);
void *m_alloc(unsigned long size, const char *file, unsigned long line);
void f_ree(void *ptr);
#ifdef malloc
#undef malloc
#endif
#ifdef calloc
#undef calloc
#endif
#ifdef free
#undef free
#endif
#define malloc(size) m_alloc(size, __FILE__, __LINE__)
#define calloc(size, num) c_alloc(size, num, __FILE__, __LINE__)
#define free(addr) f_ree(addr)
#endif//defined(_WIN32) && defined(_MEM_DEBUG)*/
#if defined (__ALLOC_C)
#define __ALLOC_EXTERN
#else
#define __ALLOC_EXTERN extern
#endif
#include <IL/il.h>
__ALLOC_EXTERN mAlloc ialloc_ptr;
__ALLOC_EXTERN mFree ifree_ptr;
#endif//ALLOC_H
+43
View File
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_bits.h
//
// Description: Implements a file class that reads/writes bits directly.
//
//-----------------------------------------------------------------------------
#ifndef BITS_H
#define BITS_H
#include "il_internal.h"
// Struct for dealing with reading bits from a file
typedef struct BITFILE
{
ILHANDLE File;
ILuint BitPos;
ILint ByteBitOff;
ILubyte Buff;
} BITFILE;
// Functions for reading bits from a file
//BITFILE* bopen(const char *FileName, const char *Mode);
ILint bclose(BITFILE *BitFile);
BITFILE* bfile(ILHANDLE File);
ILint btell(BITFILE *BitFile);
ILint bseek(BITFILE *BitFile, ILuint Offset, ILuint Mode);
ILint bread(void *Buffer, ILuint Size, ILuint Number, BITFILE *BitFile);
//ILint bwrite(void *Buffer, ILuint Size, ILuint Number, BITFILE *BitFile);
// Useful macros for manipulating bits
#define SetBits(var, bits) (var |= bits)
#define ClearBits(var, bits) (var &= ~(bits))
#endif//BITS_H
+107
View File
@@ -0,0 +1,107 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 09/01/2003 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_bmp.h
//
// Description: Reads and writes to a bitmap (.bmp) file.
//
//-----------------------------------------------------------------------------
#ifndef BMP_H
#define BMP_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, bmp_struct, 1)
#endif
typedef struct BMPHEAD {
ILushort bfType;
ILint bfSize;
ILuint bfReserved;
ILint bfDataOff;
ILint biSize;
ILint biWidth;
ILint biHeight;
ILshort biPlanes;
ILshort biBitCount;
ILint biCompression;
ILint biSizeImage;
ILint biXPelsPerMeter;
ILint biYPelsPerMeter;
ILint biClrUsed;
ILint biClrImportant;
} IL_PACKSTRUCT BMPHEAD;
typedef struct OS2_HEAD
{
// Bitmap file header.
ILushort bfType;
ILuint biSize;
ILshort xHotspot;
ILshort yHotspot;
ILuint DataOff;
// Bitmap core header.
ILuint cbFix;
//2003-09-01: changed cx, cy to ushort according to MSDN
ILushort cx;
ILushort cy;
ILushort cPlanes;
ILushort cBitCount;
} IL_PACKSTRUCT OS2_HEAD;
#ifdef _WIN32
#pragma pack(pop, bmp_struct)
#endif
// Internal functions
ILboolean iGetBmpHead(BMPHEAD * const Header);
ILboolean iGetOS2Head(OS2_HEAD * const Header);
ILboolean iIsValidBmp();
ILboolean iCheckBmp(const BMPHEAD *CONST_RESTRICT Header);
ILboolean iCheckOS2(const OS2_HEAD *CONST_RESTRICT Header);
ILboolean iLoadBitmapInternal();
ILboolean iSaveBitmapInternal();
ILboolean ilReadUncompBmp(BMPHEAD *Info);
ILboolean ilReadRLE8Bmp(BMPHEAD *Info);
ILboolean ilReadRLE4Bmp(BMPHEAD *Info);
ILboolean iGetOS2Bmp(OS2_HEAD *Header);
#ifdef IL_BMP_C
#undef NOINLINE
#undef INLINE
#define INLINE
#endif
#ifndef NOINLINE
INLINE void GetShiftFromMask(const ILuint Mask, ILuint * CONST_RESTRICT ShiftLeft, ILuint * CONST_RESTRICT ShiftRight) {
ILuint Temp, i;
if( Mask == 0 ) {
*ShiftLeft = *ShiftRight = 0;
return;
}
Temp = Mask;
for( i = 0; i < 32; i++, Temp >>= 1 ) {
if( Temp & 1 )
break;
}
*ShiftRight = i;
// Temp is preserved, so use it again:
for( i = 0; i < 8; i++, Temp >>= 1 ) {
if( !(Temp & 1) )
break;
}
*ShiftLeft = 8 - i;
return;
}
#endif
#endif//BMP_H
+52
View File
@@ -0,0 +1,52 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 02/26/2009
//
// Filename: src-IL/include/il_dcx.h
//
// Description: Reads from a .dcx file.
//
//-----------------------------------------------------------------------------
#ifndef DCX_H
#define DCX_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, packed_struct, 1)
#endif
typedef struct DCXHEAD
{
ILubyte Manufacturer;
ILubyte Version;
ILubyte Encoding;
ILubyte Bpp;
ILushort Xmin, Ymin, Xmax, Ymax;
ILushort HDpi;
ILushort VDpi;
ILubyte ColMap[48];
ILubyte Reserved;
ILubyte NumPlanes;
ILushort Bps;
ILushort PaletteInfo;
ILushort HScreenSize;
ILushort VScreenSize;
ILubyte Filler[54];
} IL_PACKSTRUCT DCXHEAD;
#ifdef _WIN32
#pragma pack(pop, packed_struct)
#endif
// For checking and reading
ILboolean iIsValidDcx(void);
ILboolean iCheckDcx(DCXHEAD *Header);
ILboolean iLoadDcxInternal(void);
ILimage* iUncompressDcx(DCXHEAD *Header);
ILimage* iUncompressDcxSmall(DCXHEAD *Header);
#endif//PCX_H
+221
View File
@@ -0,0 +1,221 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 12/27/2008
//
// Filename: src-IL/include/il_dds.h
//
// Description: Reads from a DirectDraw Surface (.dds) file.
//
//-----------------------------------------------------------------------------
#ifndef DDS_H
#define DDS_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, dds_struct, 1)
#endif
typedef struct DDSHEAD
{
ILbyte Signature[4];
ILuint Size1; // size of the structure (minus MagicNum)
ILuint Flags1; // determines what fields are valid
ILuint Height; // height of surface to be created
ILuint Width; // width of input surface
ILuint LinearSize; // Formless late-allocated optimized surface size
ILuint Depth; // Depth if a volume texture
ILuint MipMapCount; // number of mip-map levels requested
ILuint AlphaBitDepth; // depth of alpha buffer requested
ILuint NotUsed[10];
ILuint Size2; // size of structure
ILuint Flags2; // pixel format flags
ILuint FourCC; // (FOURCC code)
ILuint RGBBitCount; // how many bits per pixel
ILuint RBitMask; // mask for red bit
ILuint GBitMask; // mask for green bits
ILuint BBitMask; // mask for blue bits
ILuint RGBAlphaBitMask; // mask for alpha channel
ILuint ddsCaps1, ddsCaps2, ddsCaps3, ddsCaps4; // direct draw surface capabilities
ILuint TextureStage;
} IL_PACKSTRUCT DDSHEAD;
#ifdef _WIN32
#pragma pack(pop, dds_struct)
#endif
// use cast to struct instead of RGBA_MAKE as struct is
// much
typedef struct Color8888
{
ILubyte r; // change the order of names to change the
ILubyte g; // order of the output ARGB or BGRA, etc...
ILubyte b; // Last one is MSB, 1st is LSB.
ILubyte a;
} Color8888;
typedef struct Color888
{
ILubyte r; // change the order of names to change the
ILubyte g; // order of the output ARGB or BGRA, etc...
ILubyte b; // Last one is MSB, 1st is LSB.
} Color888;
typedef struct Color565
{
unsigned nBlue : 5; // order of names changes
unsigned nGreen : 6; // byte order of output to 32 bit
unsigned nRed : 5;
} Color565;
typedef struct DXTColBlock
{
ILshort col0;
ILshort col1;
// no bit fields - use bytes
ILbyte row[4];
} DXTColBlock;
typedef struct DXTAlphaBlockExplicit
{
ILshort row[4];
} DXTAlphaBlockExplicit;
typedef struct DXTAlphaBlock3BitLinear
{
ILbyte alpha0;
ILbyte alpha1;
ILbyte stuff[6];
} DXTAlphaBlock3BitLinear;
// Defines
//Those 4 were added on 20040516 to make
//the written dds files more standard compliant
#define DDS_CAPS 0x00000001L
#define DDS_HEIGHT 0x00000002L
#define DDS_WIDTH 0x00000004L
#define DDS_RGB 0x00000040L
#define DDS_PIXELFORMAT 0x00001000L
#define DDS_LUMINANCE 0x00020000L
#define DDS_ALPHAPIXELS 0x00000001L
#define DDS_ALPHA 0x00000002L
#define DDS_FOURCC 0x00000004L
#define DDS_PITCH 0x00000008L
#define DDS_COMPLEX 0x00000008L
#define DDS_TEXTURE 0x00001000L
#define DDS_MIPMAPCOUNT 0x00020000L
#define DDS_LINEARSIZE 0x00080000L
#define DDS_VOLUME 0x00200000L
#define DDS_MIPMAP 0x00400000L
#define DDS_DEPTH 0x00800000L
#define DDS_CUBEMAP 0x00000200L
#define DDS_CUBEMAP_POSITIVEX 0x00000400L
#define DDS_CUBEMAP_NEGATIVEX 0x00000800L
#define DDS_CUBEMAP_POSITIVEY 0x00001000L
#define DDS_CUBEMAP_NEGATIVEY 0x00002000L
#define DDS_CUBEMAP_POSITIVEZ 0x00004000L
#define DDS_CUBEMAP_NEGATIVEZ 0x00008000L
#define IL_MAKEFOURCC(ch0, ch1, ch2, ch3) \
((ILint)(ILbyte)(ch0) | ((ILint)(ILbyte)(ch1) << 8) | \
((ILint)(ILbyte)(ch2) << 16) | ((ILint)(ILbyte)(ch3) << 24 ))
enum PixFormat
{
PF_ARGB,
PF_RGB,
PF_DXT1,
PF_DXT2,
PF_DXT3,
PF_DXT4,
PF_DXT5,
PF_3DC,
PF_ATI1N,
PF_LUMINANCE,
PF_LUMINANCE_ALPHA,
PF_RXGB, //Doom3 normal maps
PF_A16B16G16R16,
PF_R16F,
PF_G16R16F,
PF_A16B16G16R16F,
PF_R32F,
PF_G32R32F,
PF_A32B32G32R32F,
PF_UNKNOWN = 0xFF
};
#define CUBEMAP_SIDES 6
// Internal functions
ILboolean iLoadDdsInternal(void);
ILboolean iIsValidDds(void);
ILboolean iCheckDds(DDSHEAD *Head);
void AdjustVolumeTexture(DDSHEAD *Head, ILuint CompFormat);
ILboolean ReadData();
ILboolean AllocImage(ILuint CompFormat);
ILboolean DdsDecompress(ILuint CompFormat);
ILboolean ReadMipmaps(ILuint CompFormat);
ILuint DecodePixelFormat();
void DxtcReadColor(ILushort Data, Color8888* Out);
void DxtcReadColors(const ILubyte* Data, Color8888* Out);
ILboolean DecompressARGB(ILuint CompFormat);
ILboolean DecompressARGB16(ILuint CompFormat);
ILboolean DecompressDXT1(ILimage *lImage, ILubyte *lCompData);
ILboolean DecompressDXT2(ILimage *lImage, ILubyte *lCompData);
ILboolean DecompressDXT3(ILimage *lImage, ILubyte *lCompData);
ILboolean DecompressDXT4(ILimage *lImage, ILubyte *lCompData);
ILboolean DecompressDXT5(ILimage *lImage, ILubyte *lCompData);
ILboolean Decompress3Dc();
ILboolean DecompressAti1n();
ILboolean DecompressRXGB();
ILboolean iConvFloat16ToFloat32(ILuint* dest, ILushort* src, ILuint size);
ILboolean DecompressFloat(ILuint lCompFormat);
void CorrectPreMult();
void GetBitsFromMask(ILuint Mask, ILuint *ShiftLeft, ILuint *ShiftRight);
ILboolean iSaveDdsInternal(void);
ILboolean WriteHeader(ILimage *Image, ILenum DXTCFormat, ILuint CubeFlags);
ILushort *CompressTo565(ILimage *Image);
ILubyte *CompressTo88(ILimage *Image);
ILuint Compress(ILimage *Image, ILenum DXTCFormat);
ILboolean GetBlock(ILushort *Block, ILushort *Data, ILimage *Image, ILuint XPos, ILuint YPos);
ILboolean GetAlphaBlock(ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos);
ILboolean Get3DcBlock(ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos, int channel);
void ShortToColor565(ILushort Pixel, Color565 *Colour);
void ShortToColor888(ILushort Pixel, Color888 *Colour);
ILushort Color565ToShort(Color565 *Colour);
ILushort Color888ToShort(Color888 *Colour);
ILuint GenBitMask(ILushort ex0, ILushort ex1, ILuint NumCols, ILushort *In, ILubyte *Alpha, Color888 *OutCol);
void GenAlphaBitMask(ILubyte a0, ILubyte a1, ILubyte *In, ILubyte *Mask, ILubyte *Out);
ILuint RMSAlpha(ILubyte *Orig, ILubyte *Test);
ILuint Distance(Color888 *c1, Color888 *c2);
void ChooseEndpoints(ILushort *Block, ILushort *ex0, ILushort *ex1);
void ChooseAlphaEndpoints(ILubyte *Block, ILubyte *a0, ILubyte *a1);
void CorrectEndDXT1(ILushort *ex0, ILushort *ex1, ILboolean HasAlpha);
void PreMult(ILushort *Data, ILubyte *Alpha);
extern ILuint CubemapDirections[CUBEMAP_SIDES];
#endif//DDS_H
@@ -0,0 +1,276 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_doompal.h
//
// Description: The default Doom palette
//
//-----------------------------------------------------------------------------
#ifndef DOOMPAL_H
#define DOOMPAL_H
#define IL_DOOMPAL_SIZE 768
ILubyte ilDefaultDoomPal[IL_DOOMPAL_SIZE] = {
0, 0, 0,
31, 23, 11,
23, 15, 7,
75, 75, 75,
255, 255, 255,
27, 27, 27,
19, 19, 19,
11, 11, 11,
7, 7, 7,
47, 55, 31,
35, 43, 15,
23, 31, 7,
15, 23, 0,
79, 59, 43,
71, 51, 35,
63, 43, 27,
255, 183, 183,
247, 171, 171,
243, 163, 163,
235, 151, 151,
231, 143, 143,
223, 135, 135,
219, 123, 123,
211, 115, 115,
203, 107, 107,
199, 99, 99,
191, 91, 91,
187, 87, 87,
179, 79, 79,
175, 71, 71,
167, 63, 63,
163, 59, 59,
155, 51, 51,
151, 47, 47,
143, 43, 43,
139, 35, 35,
131, 31, 31,
127, 27, 27,
119, 23, 23,
115, 19, 19,
107, 15, 15,
103, 11, 11,
95, 7, 7,
91, 7, 7,
83, 7, 7,
79, 0, 0,
71, 0, 0,
67, 0, 0,
255, 235, 223,
255, 227, 211,
255, 219, 199,
255, 211, 187,
255, 207, 179,
255, 199, 167,
255, 191, 155,
255, 187, 147,
255, 179, 131,
247, 171, 123,
239, 163, 115,
231, 155, 107,
223, 147, 99,
215, 139, 91,
207, 131, 83,
203, 127, 79,
191, 123, 75,
179, 115, 71,
171, 111, 67,
163, 107, 63,
155, 99, 59,
143, 95, 55,
135, 87, 51,
127, 83, 47,
119, 79, 43,
107, 71, 39,
95, 67, 35,
83, 63, 31,
75, 55, 27,
63, 47, 23,
51, 43, 19,
43, 35, 15,
239, 239, 239,
231, 231, 231,
223, 223, 223,
219, 219, 219,
211, 211, 211,
203, 203, 203,
199, 199, 199,
191, 191, 191,
183, 183, 183,
179, 179, 179,
171, 171, 171,
167, 167, 167,
159, 159, 159,
151, 151, 151,
147, 147, 147,
139, 139, 139,
131, 131, 131,
127, 127, 127,
119, 119, 119,
111, 111, 111,
107, 107, 107,
99, 99, 99,
91, 91, 91,
87, 87, 87,
79, 79, 79,
71, 71, 71,
67, 67, 67,
59, 59, 59,
55, 55, 55,
47, 47, 47,
39, 39, 39,
35, 35, 35,
119, 255, 111,
111, 239, 103,
103, 223, 95,
95, 207, 87,
91, 191, 79,
83, 175, 71,
75, 159, 63,
67, 147, 55,
63, 131, 47,
55, 115, 43,
47, 99, 35,
39, 83, 27,
31, 67, 23,
23, 51, 15,
19, 35, 11,
11, 23, 7,
191, 167, 143,
183, 159, 135,
175, 151, 127,
167, 143, 119,
159, 135, 111,
155, 127, 107,
147, 123, 99,
139, 115, 91,
131, 107, 87,
123, 99, 79,
119, 95, 75,
111, 87, 67,
103, 83, 63,
95, 75, 55,
87, 67, 51,
83, 63, 47,
159, 131, 99,
143, 119, 83,
131, 107, 75,
119, 95, 63,
103, 83, 51,
91, 71, 43,
79, 59, 35,
67, 51, 27,
123, 127, 99,
111, 115, 87,
103, 107, 79,
91, 99, 71,
83, 87, 59,
71, 79, 51,
63, 71, 43,
55, 63, 39,
255, 255, 115,
235, 219, 87,
215, 187, 67,
195, 155, 47,
175, 123, 31,
155, 91, 19,
135, 67, 7,
115, 43, 0,
255, 255, 255,
255, 219, 219,
255, 187, 187,
255, 155, 155,
255, 123, 123,
255, 95, 95,
255, 63, 63,
255, 31, 31,
255, 0, 0,
239, 0, 0,
227, 0, 0,
215, 0, 0,
203, 0, 0,
191, 0, 0,
179, 0, 0,
167, 0, 0,
155, 0, 0,
139, 0, 0,
127, 0, 0,
115, 0, 0,
103, 0, 0,
91, 0, 0,
79, 0, 0,
67, 0, 0,
231, 231, 255,
199, 199, 255,
171, 171, 255,
143, 143, 255,
115, 115, 255,
83, 83, 255,
55, 55, 255,
27, 27, 255,
0, 0, 255,
0, 0, 227,
0, 0, 203,
0, 0, 179,
0, 0, 155,
0, 0, 131,
0, 0, 107,
0, 0, 83,
255, 255, 255,
255, 235, 219,
255, 215, 187,
255, 199, 155,
255, 179, 123,
255, 163, 91,
255, 143, 59,
255, 127, 27,
243, 115, 23,
235, 111, 15,
223, 103, 15,
215, 95, 11,
203, 87, 7,
195, 79, 0,
183, 71, 0,
175, 67, 0,
255, 255, 255,
255, 255, 215,
255, 255, 179,
255, 255, 143,
255, 255, 107,
255, 255, 71,
255, 255, 35,
255, 255, 0,
167, 63, 0,
159, 55, 0,
147, 47, 0,
135, 35, 0,
79, 59, 39,
67, 47, 27,
55, 35, 19,
47, 27, 11,
0, 0, 83,
0, 0, 71,
0, 0, 59,
0, 0, 47,
0, 0, 35,
0, 0, 23,
0, 0, 11,
0, 255, 255,
255, 159, 67,
255, 231, 75,
255, 123, 255,
255, 0, 255,
207, 0, 207,
159, 0, 155,
111, 0, 107,
167, 107, 107
};
#endif//DOOMPAL_H
+150
View File
@@ -0,0 +1,150 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 02/26/2009
//
// Filename: src-IL/include/il_dpx.h
//
// Description: Reads from a Digital Picture Exchange (.dpx) file.
// Specifications for this format were found at
// http://www.cineon.com/ff_draft.php and
// http://www.fileformat.info/format/dpx/.
//
//-----------------------------------------------------------------------------
#ifndef DPX_H
#define DPX_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, packed_struct, 1)
#endif
typedef struct R32
{
ILubyte r, g, b, a;
} IL_PACKSTRUCT R32;
#ifdef _WIN32
#pragma pack(pop, packed_struct)
#endif
typedef struct DPX_FILE_INFO
{
ILuint MagicNum; /* magic number 0x53445058 (SDPX) or 0x58504453 (XPDS) */
ILuint Offset; /* offset to image data in bytes */
ILbyte Vers[8]; /* which header format version is being used (v1.0)*/
ILuint FileSize; /* file size in bytes */
ILuint DittoKey; /* read time short cut - 0 = same, 1 = new */
ILuint GenHdrSize; /* generic header length in bytes */
ILuint IndHdrSize; /* industry header length in bytes */
ILuint UserDataSize; /* user-defined data length in bytes */
ILbyte FileName[100]; /* image file name */
ILbyte CreateTime[24]; /* file creation date "yyyy:mm:dd:hh:mm:ss:LTZ" */
ILbyte Creator[100]; /* file creator's name */
ILbyte Project[200]; /* project name */
ILbyte Copyright[200]; /* right to use or copyright info */
ILuint Key; /* encryption ( FFFFFFFF = unencrypted ) */
ILbyte Reserved[104]; /* reserved field TBD (need to pad) */
} DPX_FILE_INFO;
typedef struct DPX_IMAGE_ELEMENT
{
ILuint DataSign; /* data sign (0 = unsigned, 1 = signed ) */
/* "Core set images are unsigned" */
ILuint RefLowData; /* reference low data code value */
R32 RefLowQuantity; /* reference low quantity represented */
ILuint RefHighData; /* reference high data code value */
R32 RefHighQuantity;/* reference high quantity represented */
ILubyte Descriptor; /* descriptor for image element */
ILubyte Transfer; /* transfer characteristics for element */
ILubyte Colorimetric; /* colormetric specification for element */
ILubyte BitSize; /* bit size for element */
ILushort Packing; /* packing for element */
ILushort Encoding; /* encoding for element */
ILuint DataOffset; /* offset to data of element */
ILuint EolPadding; /* end of line padding used in element */
ILuint EoImagePadding; /* end of image padding used in element */
ILbyte Description[32];/* description of element */
} DPX_IMAGE_ELEMENT; /* NOTE THERE ARE EIGHT OF THESE */
typedef struct DPX_IMAGE_INFO
{
ILushort Orientation; /* image orientation */
ILushort NumElements; /* number of image elements */
ILuint Width; /* or x value */
ILuint Height; /* or y value, per element */
DPX_IMAGE_ELEMENT ImageElement[8];
ILubyte reserved[52]; /* reserved for future use (padding) */
} DPX_IMAGE_INFO;
typedef struct DPX_IMAGE_ORIENT
{
ILuint XOffset; /* X offset */
ILuint YOffset; /* Y offset */
R32 XCenter; /* X center */
R32 YCenter; /* Y center */
ILuint XOrigSize; /* X original size */
ILuint YOrigSize; /* Y original size */
ILbyte FileName[100]; /* source image file name */
ILbyte CreationTime[24]; /* source image creation date and time */
ILbyte InputDev[32]; /* input device name */
ILbyte InputSerial[32]; /* input device serial number */
ILushort Border[4]; /* border validity (XL, XR, YT, YB) */
ILuint PixelAspect[2]; /* pixel aspect ratio (H:V) */
ILubyte Reserved[28]; /* reserved for future use (padding) */
} DPX_IMAGE_ORIENT;
typedef struct DPX_MOTION_PICTURE_HEAD
{
ILbyte film_mfg_id[2]; /* film manufacturer ID code (2 digits from film edge code) */
ILbyte film_type[2]; /* file type (2 digits from film edge code) */
ILbyte offset[2]; /* offset in perfs (2 digits from film edge code)*/
ILbyte prefix[6]; /* prefix (6 digits from film edge code) */
ILbyte count[4]; /* count (4 digits from film edge code)*/
ILbyte format[32]; /* format (i.e. academy) */
ILuint frame_position; /* frame position in sequence */
ILuint sequence_len; /* sequence length in frames */
ILuint held_count; /* held count (1 = default) */
R32 frame_rate; /* frame rate of original in frames/sec */
R32 shutter_angle; /* shutter angle of camera in degrees */
ILbyte frame_id[32]; /* frame identification (i.e. keyframe) */
ILbyte slate_info[100]; /* slate information */
ILubyte reserved[56]; /* reserved for future use (padding) */
} DPX_MOTION_PICTURE_HEAD;
typedef struct DPX_TELEVISION_HEAD
{
ILuint tim_code; /* SMPTE time code */
ILuint userBits; /* SMPTE user bits */
ILubyte interlace; /* interlace ( 0 = noninterlaced, 1 = 2:1 interlace*/
ILubyte field_num; /* field number */
ILubyte video_signal; /* video signal standard (table 4)*/
ILubyte unused; /* used for byte alignment only */
R32 hor_sample_rate; /* horizontal sampling rate in Hz */
R32 ver_sample_rate; /* vertical sampling rate in Hz */
R32 frame_rate; /* temporal sampling rate or frame rate in Hz */
R32 time_offset; /* time offset from sync to first pixel */
R32 gamma; /* gamma value */
R32 black_level; /* black level code value */
R32 black_gain; /* black gain */
R32 break_point; /* breakpoint */
R32 white_level; /* reference white level code value */
R32 integration_times; /* integration time(s) */
ILubyte reserved[76]; /* reserved for future use (padding) */
} DPX_TELEVISION_HEAD;
// For checking and reading
ILboolean iIsValidDpx(void);
//ILboolean iCheckDpx(DPXHEAD *Header);
ILboolean iLoadDpxInternal(void);
#endif//PCX_H
+377
View File
@@ -0,0 +1,377 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 01/29/2009
//
// Filename: src-IL/include/il_endian.h
//
// Description: Handles Endian-ness
//
//-----------------------------------------------------------------------------
#ifndef IL_ENDIAN_H
#define IL_ENDIAN_H
#include "il_internal.h"
#ifdef WORDS_BIGENDIAN // This is defined by ./configure.
#ifndef __BIG_ENDIAN__
#define __BIG_ENDIAN__ 1
#endif
#endif
#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
|| (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
#undef __LITTLE_ENDIAN__
#define Short(s) iSwapShort(s)
#define UShort(s) iSwapUShort(s)
#define Int(i) iSwapInt(i)
#define UInt(i) iSwapUInt(i)
#define Float(f) iSwapFloat(f)
#define Double(d) iSwapDouble(d)
#define BigShort(s)
#define BigUShort(s)
#define BigInt(i)
#define BigUInt(i)
#define BigFloat(f)
#define BigDouble(d)
#else
#undef __BIG_ENDIAN__
#undef __LITTLE_ENDIAN__ // Not sure if it's defined by any compiler...
#define __LITTLE_ENDIAN__
#define Short(s)
#define UShort(s)
#define Int(i)
#define UInt(i)
#define Float(f)
#define Double(d)
#define BigShort(s) iSwapShort(s)
#define BigUShort(s) iSwapUShort(s)
#define BigInt(i) iSwapInt(i)
#define BigUInt(i) iSwapUInt(i)
#define BigFloat(f) iSwapFloat(f)
#define BigDouble(d) iSwapDouble(d)
#endif
void iSwapUShort(ILushort *s);
void iSwapShort(ILshort *s);
void iSwapUInt(ILuint *i);
void iSwapInt(ILint *i);
void iSwapFloat(ILfloat *f);
void iSwapDouble(ILdouble *d);
ILushort GetLittleUShort();
ILshort GetLittleShort();
ILuint GetLittleUInt();
ILint GetLittleInt();
ILfloat GetLittleFloat();
ILdouble GetLittleDouble();
ILushort GetBigUShort();
ILshort GetBigShort();
ILuint GetBigUInt();
ILint GetBigInt();
ILfloat GetBigFloat();
ILdouble GetBigDouble();
ILubyte SaveLittleUShort(ILushort s);
ILubyte SaveLittleShort(ILshort s);
ILubyte SaveLittleUInt(ILuint i);
ILubyte SaveLittleInt(ILint i);
ILubyte SaveLittleFloat(ILfloat f);
ILubyte SaveLittleDouble(ILdouble d);
ILubyte SaveBigUShort(ILushort s);
ILubyte SaveBigShort(ILshort s);
ILubyte SaveBigUInt(ILuint i);
ILubyte SaveBigInt(ILint i);
ILubyte SaveBigFloat(ILfloat f);
ILubyte SaveBigDouble(ILdouble d);
#ifdef IL_ENDIAN_C
#undef NOINLINE
#undef INLINE
#define INLINE
#endif
#ifndef NOINLINE
INLINE void iSwapUShort(ILushort *s) {
#ifdef USE_WIN32_ASM
__asm {
mov ebx, s
mov al, [ebx+1]
mov ah, [ebx ]
mov [ebx], ax
}
#else
#ifdef GCC_X86_ASM
asm("ror $8,%0"
: "=r" (*s)
: "0" (*s));
#else
*s = ((*s)>>8) | ((*s)<<8);
#endif //GCC_X86_ASM
#endif //USE_WIN32_ASM
}
INLINE void iSwapShort(ILshort *s) {
iSwapUShort((ILushort*)s);
}
INLINE void iSwapUInt(ILuint *i) {
#ifdef USE_WIN32_ASM
__asm {
mov ebx, i
mov eax, [ebx]
bswap eax
mov [ebx], eax
}
#else
#ifdef GCC_X86_ASM
asm("bswap %0;"
: "+r" (*i));
#else
*i = ((*i)>>24) | (((*i)>>8) & 0xff00) | (((*i)<<8) & 0xff0000) | ((*i)<<24);
#endif //GCC_X86_ASM
#endif //USE_WIN32_ASM
}
INLINE void iSwapInt(ILint *i) {
iSwapUInt((ILuint*)i);
}
INLINE void iSwapFloat(ILfloat *f) {
iSwapUInt((ILuint*)f);
}
INLINE void iSwapDouble(ILdouble *d) {
#ifdef GCC_X86_ASM
int *t = (int*)d;
asm("bswap %2 \n"
"bswap %3 \n"
"movl %2,%1 \n"
"movl %3,%0 \n"
: "=g" (t[0]), "=g" (t[1])
: "r" (t[0]), "r" (t[1]));
#else
ILubyte t,*b = (ILubyte*)d;
#define dswap(x,y) t=b[x];b[x]=b[y];b[y]=b[x];
dswap(0,7);
dswap(1,6);
dswap(2,5);
dswap(3,4);
#undef dswap
#endif
}
INLINE ILushort GetLittleUShort() {
ILushort s;
iread(&s, sizeof(ILushort), 1);
#ifdef __BIG_ENDIAN__
iSwapUShort(&s);
#endif
return s;
}
INLINE ILshort GetLittleShort() {
ILshort s;
iread(&s, sizeof(ILshort), 1);
#ifdef __BIG_ENDIAN__
iSwapShort(&s);
#endif
return s;
}
INLINE ILuint GetLittleUInt() {
ILuint i;
iread(&i, sizeof(ILuint), 1);
#ifdef __BIG_ENDIAN__
iSwapUInt(&i);
#endif
return i;
}
INLINE ILint GetLittleInt() {
ILint i;
iread(&i, sizeof(ILint), 1);
#ifdef __BIG_ENDIAN__
iSwapInt(&i);
#endif
return i;
}
INLINE ILfloat GetLittleFloat() {
ILfloat f;
iread(&f, sizeof(ILfloat), 1);
#ifdef __BIG_ENDIAN__
iSwapFloat(&f);
#endif
return f;
}
INLINE ILdouble GetLittleDouble() {
ILdouble d;
iread(&d, sizeof(ILdouble), 1);
#ifdef __BIG_ENDIAN__
iSwapDouble(&d);
#endif
return d;
}
INLINE ILushort GetBigUShort() {
ILushort s;
iread(&s, sizeof(ILushort), 1);
#ifdef __LITTLE_ENDIAN__
iSwapUShort(&s);
#endif
return s;
}
INLINE ILshort GetBigShort() {
ILshort s;
iread(&s, sizeof(ILshort), 1);
#ifdef __LITTLE_ENDIAN__
iSwapShort(&s);
#endif
return s;
}
INLINE ILuint GetBigUInt() {
ILuint i;
iread(&i, sizeof(ILuint), 1);
#ifdef __LITTLE_ENDIAN__
iSwapUInt(&i);
#endif
return i;
}
INLINE ILint GetBigInt() {
ILint i;
iread(&i, sizeof(ILint), 1);
#ifdef __LITTLE_ENDIAN__
iSwapInt(&i);
#endif
return i;
}
INLINE ILfloat GetBigFloat() {
ILfloat f;
iread(&f, sizeof(ILfloat), 1);
#ifdef __LITTLE_ENDIAN__
iSwapFloat(&f);
#endif
return f;
}
INLINE ILdouble GetBigDouble() {
ILdouble d;
iread(&d, sizeof(ILdouble), 1);
#ifdef __LITTLE_ENDIAN__
iSwapDouble(&d);
#endif
return d;
}
INLINE ILubyte SaveLittleUShort(ILushort s) {
#ifdef __BIG_ENDIAN__
iSwapUShort(&s);
#endif
return iwrite(&s, sizeof(ILushort), 1);
}
INLINE ILubyte SaveLittleShort(ILshort s) {
#ifdef __BIG_ENDIAN__
iSwapShort(&s);
#endif
return iwrite(&s, sizeof(ILshort), 1);
}
INLINE ILubyte SaveLittleUInt(ILuint i) {
#ifdef __BIG_ENDIAN__
iSwapUInt(&i);
#endif
return iwrite(&i, sizeof(ILuint), 1);
}
INLINE ILubyte SaveLittleInt(ILint i) {
#ifdef __BIG_ENDIAN__
iSwapInt(&i);
#endif
return iwrite(&i, sizeof(ILint), 1);
}
INLINE ILubyte SaveLittleFloat(ILfloat f) {
#ifdef __BIG_ENDIAN__
iSwapFloat(&f);
#endif
return iwrite(&f, sizeof(ILfloat), 1);
}
INLINE ILubyte SaveLittleDouble(ILdouble d) {
#ifdef __BIG_ENDIAN__
iSwapDouble(&d);
#endif
return iwrite(&d, sizeof(ILdouble), 1);
}
INLINE ILubyte SaveBigUShort(ILushort s) {
#ifdef __LITTLE_ENDIAN__
iSwapUShort(&s);
#endif
return iwrite(&s, sizeof(ILushort), 1);
}
INLINE ILubyte SaveBigShort(ILshort s) {
#ifdef __LITTLE_ENDIAN__
iSwapShort(&s);
#endif
return iwrite(&s, sizeof(ILshort), 1);
}
INLINE ILubyte SaveBigUInt(ILuint i) {
#ifdef __LITTLE_ENDIAN__
iSwapUInt(&i);
#endif
return iwrite(&i, sizeof(ILuint), 1);
}
INLINE ILubyte SaveBigInt(ILint i) {
#ifdef __LITTLE_ENDIAN__
iSwapInt(&i);
#endif
return iwrite(&i, sizeof(ILint), 1);
}
INLINE ILubyte SaveBigFloat(ILfloat f) {
#ifdef __LITTLE_ENDIAN__
iSwapFloat(&f);
#endif
return iwrite(&f, sizeof(ILfloat), 1);
}
INLINE ILubyte SaveBigDouble(ILdouble d) {
#ifdef __LITTLE_ENDIAN__
iSwapDouble(&d);
#endif
return iwrite(&d, sizeof(ILdouble), 1);
}
#endif//NOINLINE
void EndianSwapData(void *_Image);
#endif//ENDIAN_H
+90
View File
@@ -0,0 +1,90 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 08/29/2008
//
// Filename: src-IL/include/il_exr.h
//
// Description: Reads from an OpenEXR (.exr) file.
//
//-----------------------------------------------------------------------------
#ifndef EXR_H
#define EXR_H
#include "il_internal.h"
#include <ImfIO.h>
//using namespace Imf; // Using this leads to errors with Microsoft's IStream.
// So it is better to just specify the namespace explicitly.
typedef struct EXRHEAD
{
ILuint MagicNumber; // File signature (0x76, 0x2f, 0x31, 0x01)
ILuint Version; // Treated as two bitfields
} IL_PACKSTRUCT EXRHEAD;
//@TODO: Should I just do these as enums?
#define EXR_UINT 0
#define EXR_HALF 1
#define EXR_FLOAT 2
#define EXR_NO_COMPRESSION 0
#define EXR_RLE_COMPRESSION 1
#define EXR_ZIPS_COMPRESSION 2
#define EXR_ZIP_COMPRESSION 3
#define EXR_PIZ_COMPRESSION 4
#define EXR_PXR24_COMPRESSION 5
#define EXR_B44_COMPRESSION 6
#define EXR_B44A_COMPRESSION 7
#ifdef __cplusplus
extern "C" {
#endif
ILboolean iIsValidExr();
ILboolean iCheckExr(EXRHEAD *Header);
ILboolean iLoadExrInternal();
ILboolean iSaveExrInternal();
#ifdef __cplusplus
}
#endif
class ilIStream : public Imf::IStream
{
public:
ilIStream(/*ILHANDLE Handle*/);
virtual bool read (char c[/*n*/], int n);
// I don't think I need this one, since we are taking care of the file handles ourselves.
//virtual char * readMemoryMapped (int n);
virtual Imf::Int64 tellg ();
virtual void seekg (Imf::Int64 Pos);
virtual void clear ();
protected:
private:
};
class ilOStream : public Imf::OStream
{
public:
ilOStream(/*ILHANDLE Handle*/);
virtual void write (const char c[/*n*/], int n);
// I don't think I need this one, since we are taking care of the file handles ourselves.
//virtual char * readMemoryMapped (int n);
virtual Imf::Int64 tellp ();
virtual void seekp (Imf::Int64 Pos);
protected:
private:
};
#endif//EXR_H
@@ -0,0 +1,79 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 01/04/2009
//
// Filename: src-IL/include/il_files.h
//
// Description: File handling for DevIL
//
//-----------------------------------------------------------------------------
#ifndef FILES_H
#define FILES_H
#if defined (__FILES_C)
#define __FILES_EXTERN
#else
#define __FILES_EXTERN extern
#endif
#include <IL/il.h>
__FILES_EXTERN void ILAPIENTRY iPreserveReadFuncs(void);
__FILES_EXTERN void ILAPIENTRY iRestoreReadFuncs(void);
__FILES_EXTERN void ILAPIENTRY iPreserveWriteFuncs(void);
__FILES_EXTERN void ILAPIENTRY iRestoreWriteFuncs(void);
__FILES_EXTERN fEofProc EofProc;
__FILES_EXTERN fGetcProc GetcProc;
__FILES_EXTERN fReadProc ReadProc;
__FILES_EXTERN fSeekRProc SeekRProc;
__FILES_EXTERN fSeekWProc SeekWProc;
__FILES_EXTERN fTellRProc TellRProc;
__FILES_EXTERN fTellWProc TellWProc;
__FILES_EXTERN fPutcProc PutcProc;
__FILES_EXTERN fWriteProc WriteProc;
__FILES_EXTERN ILHANDLE ILAPIENTRY iDefaultOpen(ILconst_string FileName);
__FILES_EXTERN void ILAPIENTRY iDefaultClose(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultGetc(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultRead(void *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultSeekR(ILHANDLE Handle, ILint Offset, ILint Mode);
__FILES_EXTERN ILint ILAPIENTRY iDefaultSeekW(ILHANDLE Handle, ILint Offset, ILint Mode);
__FILES_EXTERN ILint ILAPIENTRY iDefaultTellR(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultTellW(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultPutc(ILubyte Char, ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultWrite(const void *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle);
__FILES_EXTERN void iSetInputFile(ILHANDLE File);
__FILES_EXTERN void iSetInputLump(const void *Lump, ILuint Size);
__FILES_EXTERN ILboolean (ILAPIENTRY *ieof)(void);
__FILES_EXTERN ILHANDLE (ILAPIENTRY *iopenr)(ILconst_string);
__FILES_EXTERN void (ILAPIENTRY *icloser)(ILHANDLE);
__FILES_EXTERN ILint (ILAPIENTRY *igetc)(void);
__FILES_EXTERN ILuint (ILAPIENTRY *iread)(void *Buffer, ILuint Size, ILuint Number);
__FILES_EXTERN ILint (ILAPIENTRY *iseek)(ILint Offset, ILuint Mode);
__FILES_EXTERN ILuint (ILAPIENTRY *itell)(void);
__FILES_EXTERN void iSetOutputFile(ILHANDLE File);
__FILES_EXTERN void iSetOutputLump(void *Lump, ILuint Size);
__FILES_EXTERN void iSetOutputFake(void);
__FILES_EXTERN void (ILAPIENTRY *iclosew)(ILHANDLE);
__FILES_EXTERN ILHANDLE (ILAPIENTRY *iopenw)(ILconst_string);
__FILES_EXTERN ILint (ILAPIENTRY *iputc)(ILubyte Char);
__FILES_EXTERN ILint (ILAPIENTRY *iseekw)(ILint Offset, ILuint Mode);
__FILES_EXTERN ILuint (ILAPIENTRY *itellw)(void);
__FILES_EXTERN ILint (ILAPIENTRY *iwrite)(const void *Buffer, ILuint Size, ILuint Number);
__FILES_EXTERN ILHANDLE ILAPIENTRY iGetFile(void);
__FILES_EXTERN const ILubyte* ILAPIENTRY iGetLump(void);
__FILES_EXTERN ILuint ILAPIENTRY ilprintf(const char *, ...);
__FILES_EXTERN void ipad(ILuint NumZeros);
__FILES_EXTERN ILboolean iPreCache(ILuint Size);
__FILES_EXTERN void iUnCache(void);
#endif//FILES_H
+71
View File
@@ -0,0 +1,71 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 02/14/2009
//
// Filename: src-IL/include/il_gif.h
//
// Description: Reads from a Graphics Interchange Format (.gif) file.
//
//-----------------------------------------------------------------------------
#ifndef GIF_H
#define GIF_H
#include "il_internal.h"
#define GIF87A 87
#define GIF89A 89
#ifdef _WIN32
#pragma pack(push, gif_struct, 1)
#endif
typedef struct GIFHEAD
{
char Sig[6];
ILushort Width;
ILushort Height;
ILubyte ColourInfo;
ILubyte Background;
ILubyte Aspect;
} IL_PACKSTRUCT GIFHEAD;
typedef struct IMAGEDESC
{
ILubyte Separator;
ILushort OffX;
ILushort OffY;
ILushort Width;
ILushort Height;
ILubyte ImageInfo;
} IL_PACKSTRUCT IMAGEDESC;
typedef struct GFXCONTROL
{
ILubyte Size;
ILubyte Packed;
ILushort Delay;
ILubyte Transparent;
ILubyte Terminator;
ILboolean Used; //this stores if a gfxcontrol was read - it is IL_FALSE (!)
//if a gfxcontrol was read from the file, IL_TRUE otherwise
} IL_PACKSTRUCT GFXCONTROL;
#ifdef _WIN32
#pragma pack(pop, gif_struct)
#endif
// Internal functions
ILboolean iLoadGifInternal(void);
ILboolean ilLoadGifF(ILHANDLE File);
ILboolean iIsValidGif(void);
ILboolean iGetPalette(ILubyte Info, ILpal *Pal, ILboolean UsePrevPal, ILimage *PrevImage);
ILboolean GetImages(ILpal *GlobalPal, GIFHEAD *GifHead);
ILboolean SkipExtensions(GFXCONTROL *Gfx);
ILboolean GifGetData(ILimage *Image, ILubyte *Data, ILuint ImageSize, ILuint Width, ILuint Height, ILuint Stride, ILuint PalOffset, GFXCONTROL *Gfx);
ILboolean RemoveInterlace(ILimage *image);
ILboolean ConvertTransparent(ILimage *Image, ILubyte TransColour);
#endif//GIF_H
+43
View File
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2004 by Denton Woods (this file by thakis)
// Last modified: 06/09/2004
//
// Filename: src-IL/include/il_hdr.h
//
// Description: Reads a RADIANCE High Dynamic Range Image
//
//-----------------------------------------------------------------------------
#ifndef HDR_H
#define HDR_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, gif_struct, 1)
#endif
typedef struct HDRHEADER
{
char Signature[10]; //must be "#?RADIANCE"
ILuint Width, Height;
} IL_PACKSTRUCT HDRHEADER;
#ifdef _WIN32
#pragma pack(pop, gif_struct)
#endif
// Internal functions
ILboolean ilIsValidHdrF(ILHANDLE file);
ILboolean iIsValidHdr();
ILboolean iCheckHdr(HDRHEADER *Header);
ILboolean ilLoadHdrF(ILHANDLE file);
ILboolean iLoadHdrInternal();
ILboolean iSaveHdrInternal();
void ReadScanline(ILubyte *scanline, ILuint w);
#endif//HDR_H
+42
View File
@@ -0,0 +1,42 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 08/23/2008
//
// Filename: src-IL/include/il_icns.h
//
// Description: Reads from a Mac OS X icon (.icns) file.
//
//-----------------------------------------------------------------------------
#ifndef ICNS_H
#define ICNS_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, icns_struct, 1)
#endif
typedef struct ICNSHEAD
{
char Head[4]; // Must be 'ICNS'
ILint Size; // Total size of the file (including header)
} IL_PACKSTRUCT ICNSHEAD;
typedef struct ICNSDATA
{
char ID[4]; // Identifier ('it32', 'il32', etc.)
ILint Size; // Total size of the entry (including identifier)
} IL_PACKSTRUCT ICNSDATA;
#ifdef _WIN32
#pragma pack(pop, icns_struct)
#endif
ILboolean iIsValidIcns();
ILboolean iLoadIcnsInternal();
ILboolean iIcnsReadData(ILboolean *BaseCreated, ILboolean IsAlpha, ILint Width, ICNSDATA *Entry, ILimage **Image);
#endif//ICNS_H
+70
View File
@@ -0,0 +1,70 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_icon.h
//
// Description: Reads from a Windows icon (.ico) file.
//
//-----------------------------------------------------------------------------
#ifndef ICON_H
#define ICON_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, ico_struct, 1)
#endif
typedef struct ICODIR
{
ILshort Reserved; // Reserved (must be 0)
ILshort Type; // Type (1 for icons, 2 for cursors)
ILshort Count; // How many different images?
} IL_PACKSTRUCT ICODIR;
typedef struct ICODIRENTRY
{
ILubyte Width; // Width, in pixels
ILubyte Height; // Height, in pixels
ILubyte NumColours; // Number of colors in image (0 if >=8bpp)
ILubyte Reserved; // Reserved (must be 0)
ILshort Planes; // Colour planes
ILshort Bpp; // Bits per pixel
ILuint SizeOfData; // How many bytes in this resource?
ILuint Offset; // Offset from beginning of the file
} IL_PACKSTRUCT ICODIRENTRY;
typedef struct INFOHEAD
{
ILint Size;
ILint Width;
ILint Height;
ILshort Planes;
ILshort BitCount;
ILint Compression;
ILint SizeImage;
ILint XPixPerMeter;
ILint YPixPerMeter;
ILint ColourUsed;
ILint ColourImportant;
} IL_PACKSTRUCT INFOHEAD;
typedef struct ICOIMAGE
{
INFOHEAD Head;
ILubyte *Pal; // Palette
ILubyte *Data; // XOR mask
ILubyte *AND; // AND mask
} ICOIMAGE;
#ifdef _WIN32
#pragma pack(pop, ico_struct)
#endif
ILboolean iLoadIconInternal();
ILboolean iLoadIconPNG(ICOIMAGE *Icon);
#endif//ICON_H
@@ -0,0 +1,539 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 03/01/2009
//
// Filename: src-IL/include/il_internal.h
//
// Description: Internal stuff for DevIL
//
//-----------------------------------------------------------------------------
#ifndef INTERNAL_H
#define INTERNAL_H
#define _IL_BUILD_LIBRARY
// Local headers
/*#if (defined(_WIN32) || defined(_WIN64)) && !defined(HAVE_CONFIG_H)
#define HAVE_CONFIG_H
#endif*/
#ifdef HAVE_CONFIG_H //if we use autotools, we have HAVE_CONFIG_H defined and we have to look for it like that
#include <config.h>
#else // If we do not use autotools, we have to point to (possibly different) config.h than in the opposite case
#include <IL/config.h>
#endif
// Standard headers
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <IL/il.h>
#include <IL/devil_internal_exports.h>
#include "il_files.h"
#include "il_endian.h"
#ifndef _WIN32
// The Microsoft HD Photo Device Porting Kit has not been ported to anything other
// than Windows yet, so we disable this if Windows is not the current platform.
#define IL_NO_WDP
#endif//_WIN32
// If we do not want support for game image formats, this define removes them all.
#ifdef IL_NO_GAMES
#define IL_NO_BLP
#define IL_NO_DOOM
#define IL_NO_FTX
#define IL_NO_IWI
#define IL_NO_LIF
#define IL_NO_MDL
#define IL_NO_ROT
#define IL_NO_TPL
#define IL_NO_UTX
#define IL_NO_WAL
#endif//IL_NO_GAMES
// If we want to compile without support for formats supported by external libraries,
// this define will remove them all.
#ifdef IL_NO_EXTLIBS
#define IL_NO_EXR
#define IL_NO_JP2
#define IL_NO_JPG
#define IL_NO_LCMS
#define IL_NO_MNG
#define IL_NO_PNG
#define IL_NO_TIF
#define IL_NO_WDP
#undef IL_USE_DXTC_NVIDIA
#undef IL_USE_DXTC_SQUISH
#endif//IL_NO_EXTLIBS
// Windows-specific
#ifdef _WIN32
#ifdef _MSC_VER
#if _MSC_VER > 1000
#pragma once
#pragma intrinsic(memcpy)
#pragma intrinsic(memset)
#pragma intrinsic(strcmp)
#pragma intrinsic(strlen)
#pragma intrinsic(strcpy)
#if _MSC_VER >= 1300
#pragma warning(disable : 4996) // MSVC++ 8/9 deprecation warnings
#endif
#endif // _MSC_VER > 1000
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#endif//_WIN32
#ifdef _UNICODE
#define IL_TEXT(s) L##s
#ifndef _WIN32 // At least in Linux, fopen works fine, and wcsicmp is not defined.
#define wcsicmp wcsncasecmp
#define _wcsicmp wcsncasecmp
#define _wfopen fopen
#endif
#define iStrCpy wcscpy
#else
#define IL_TEXT(s) (s)
#define iStrCpy strcpy
#endif
#ifdef IL_INLINE_ASM
#if (defined (_MSC_VER) && defined(_WIN32)) // MSVC++ only
#define USE_WIN32_ASM
#endif
#ifdef _WIN64
#undef USE_WIN32_ASM
//@TODO: Windows 64 compiler cannot use inline ASM, so we need to
// generate some MASM code at some point.
#endif
#ifdef _WIN32_WCE // Cannot use our inline ASM in Windows Mobile.
#undef USE_WIN32_ASM
#endif
#endif
extern ILimage *iCurImage;
#define BIT_0 0x00000001
#define BIT_1 0x00000002
#define BIT_2 0x00000004
#define BIT_3 0x00000008
#define BIT_4 0x00000010
#define BIT_5 0x00000020
#define BIT_6 0x00000040
#define BIT_7 0x00000080
#define BIT_8 0x00000100
#define BIT_9 0x00000200
#define BIT_10 0x00000400
#define BIT_11 0x00000800
#define BIT_12 0x00001000
#define BIT_13 0x00002000
#define BIT_14 0x00004000
#define BIT_15 0x00008000
#define BIT_16 0x00010000
#define BIT_17 0x00020000
#define BIT_18 0x00040000
#define BIT_19 0x00080000
#define BIT_20 0x00100000
#define BIT_21 0x00200000
#define BIT_22 0x00400000
#define BIT_23 0x00800000
#define BIT_24 0x01000000
#define BIT_25 0x02000000
#define BIT_26 0x04000000
#define BIT_27 0x08000000
#define BIT_28 0x10000000
#define BIT_29 0x20000000
#define BIT_30 0x40000000
#define BIT_31 0x80000000
#define NUL '\0' // Easier to type and ?portable?
#if !_WIN32 || _WIN32_WCE
int stricmp(const char *src1, const char *src2);
int strnicmp(const char *src1, const char *src2, size_t max);
#endif//_WIN32
#ifdef _WIN32_WCE
char *strdup(const char *src);
#endif
int iStrCmp(ILconst_string src1, ILconst_string src2);
//
// Some math functions
//
// A fast integer squareroot, completely accurate for x < 289.
// Taken from http://atoms.org.uk/sqrt/
// There is also a version that is accurate for all integers
// < 2^31, if we should need it
int iSqrt(int x);
//
// Useful miscellaneous functions
//
ILboolean iCheckExtension(ILconst_string Arg, ILconst_string Ext);
ILbyte* iFgets(char *buffer, ILuint maxlen);
ILboolean iFileExists(ILconst_string FileName);
ILstring iGetExtension(ILconst_string FileName);
ILstring ilStrDup(ILconst_string Str);
ILuint ilStrLen(ILconst_string Str);
ILuint ilCharStrLen(const char *Str);
// Miscellaneous functions
void ilDefaultStates(void);
ILenum iGetHint(ILenum Target);
ILint iGetInt(ILenum Mode);
void ilRemoveRegistered(void);
ILAPI void ILAPIENTRY ilSetCurImage(ILimage *Image);
ILuint ilDetermineSize(ILenum Type);
//
// Rle compression
//
#define IL_TGACOMP 0x01
#define IL_PCXCOMP 0x02
#define IL_SGICOMP 0x03
#define IL_BMPCOMP 0x04
ILboolean ilRleCompressLine(ILubyte *ScanLine, ILuint Width, ILubyte Bpp, ILubyte *Dest, ILuint *DestWidth, ILenum CompressMode);
ILuint ilRleCompress(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte *Dest, ILenum CompressMode, ILuint *ScanTable);
void iSetImage0(void);
// DXTC compression
ILuint ilNVidiaCompressDXTFile(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DxtType);
ILAPI ILubyte* ILAPIENTRY ilNVidiaCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DxtFormat, ILuint *DxtSize);
ILAPI ILubyte* ILAPIENTRY ilSquishCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DxtFormat, ILuint *DxtSize);
// Conversion functions
ILboolean ilAddAlpha(void);
ILboolean ilAddAlphaKey(ILimage *Image);
ILboolean iFastConvert(ILenum DestFormat);
ILboolean ilFixCur(void);
ILboolean ilFixImage(void);
ILboolean ilRemoveAlpha(void);
ILboolean ilSwapColours(void);
// Palette functions
ILboolean iCopyPalette(ILpal *Dest, ILpal *Src);
// Miscellaneous functions
char* iGetString(ILenum StringName); // Internal version of ilGetString
//
// Image loading/saving functions
//
ILboolean ilIsValidBlp(ILconst_string FileName);
ILboolean ilIsValidBlpF(ILHANDLE File);
ILboolean ilIsValidBlpL(const void *Lump, ILuint Size);
ILboolean ilLoadBlp(ILconst_string FileName);
ILboolean ilLoadBlpF(ILHANDLE File);
ILboolean ilLoadBlpL(const void *Lump, ILuint Size);
ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
ILboolean ilIsValidBmpF(ILHANDLE File);
ILboolean ilIsValidBmpL(const void *Lump, ILuint Size);
ILboolean ilLoadBmp(ILconst_string FileName);
ILboolean ilLoadBmpF(ILHANDLE File);
ILboolean ilLoadBmpL(const void *Lump, ILuint Size);
ILboolean ilSaveBmp(ILconst_string FileName);
ILuint ilSaveBmpF(ILHANDLE File);
ILuint ilSaveBmpL(void *Lump, ILuint Size);
ILboolean ilSaveCHeader(ILconst_string FileName, char *InternalName);
ILboolean ilLoadCut(ILconst_string FileName);
ILboolean ilLoadCutF(ILHANDLE File);
ILboolean ilLoadCutL(const void *Lump, ILuint Size);
ILboolean ilIsValidDcx(ILconst_string FileName);
ILboolean ilIsValidDcxF(ILHANDLE File);
ILboolean ilIsValidDcxL(const void *Lump, ILuint Size);
ILboolean ilLoadDcx(ILconst_string FileName);
ILboolean ilLoadDcxF(ILHANDLE File);
ILboolean ilLoadDcxL(const void *Lump, ILuint Size);
ILboolean ilIsValidDds(ILconst_string FileName);
ILboolean ilIsValidDdsF(ILHANDLE File);
ILboolean ilIsValidDdsL(const void *Lump, ILuint Size);
ILboolean ilLoadDds(ILconst_string FileName);
ILboolean ilLoadDdsF(ILHANDLE File);
ILboolean ilLoadDdsL(const void *Lump, ILuint Size);
ILboolean ilSaveDds(ILconst_string FileName);
ILuint ilSaveDdsF(ILHANDLE File);
ILuint ilSaveDdsL(void *Lump, ILuint Size);
ILboolean ilIsValidDicom(ILconst_string FileName);
ILboolean ilIsValidDicomF(ILHANDLE File);
ILboolean ilIsValidDicomL(const void *Lump, ILuint Size);
ILboolean ilLoadDicom(ILconst_string FileName);
ILboolean ilLoadDicomF(ILHANDLE File);
ILboolean ilLoadDicomL(const void *Lump, ILuint Size);
ILboolean ilLoadDoom(ILconst_string FileName);
ILboolean ilLoadDoomF(ILHANDLE File);
ILboolean ilLoadDoomL(const void *Lump, ILuint Size);
ILboolean ilLoadDoomFlat(ILconst_string FileName);
ILboolean ilLoadDoomFlatF(ILHANDLE File);
ILboolean ilLoadDoomFlatL(const void *Lump, ILuint Size);
ILboolean ilIsValidDpx(ILconst_string FileName);
ILboolean ilIsValidDpxF(ILHANDLE File);
ILboolean ilIsValidDpxL(const void *Lump, ILuint Size);
ILboolean ilLoadDpx(ILconst_string FileName);
ILboolean ilLoadDpxF(ILHANDLE File);
ILboolean ilLoadDpxL(const void *Lump, ILuint Size);
ILboolean ilIsValidExr(ILconst_string FileName);
ILboolean ilIsValidExrF(ILHANDLE File);
ILboolean ilIsValidExrL(const void *Lump, ILuint Size);
ILboolean ilLoadExr(ILconst_string FileName);
ILboolean ilLoadExrF(ILHANDLE File);
ILboolean ilLoadExrL(const void *Lump, ILuint Size);
ILboolean ilSaveExr(ILconst_string FileName);
ILuint ilSaveExrF(ILHANDLE File);
ILuint ilSaveExrL(void *Lump, ILuint Size);
ILboolean ilIsValidFits(ILconst_string FileName);
ILboolean ilIsValidFitsF(ILHANDLE File);
ILboolean ilIsValidFitsL(const void *Lump, ILuint Size);
ILboolean ilLoadFits(ILconst_string FileName);
ILboolean ilLoadFitsF(ILHANDLE File);
ILboolean ilLoadFitsL(const void *Lump, ILuint Size);
ILboolean ilLoadFtx(ILconst_string FileName);
ILboolean ilLoadFtxF(ILHANDLE File);
ILboolean ilLoadFtxL(const void *Lump, ILuint Size);
ILboolean ilIsValidGif(ILconst_string FileName);
ILboolean ilIsValidGifF(ILHANDLE File);
ILboolean ilIsValidGifL(const void *Lump, ILuint Size);
ILboolean ilLoadGif(ILconst_string FileName);
ILboolean ilLoadGifF(ILHANDLE File);
ILboolean ilLoadGifL(const void *Lump, ILuint Size);
ILboolean ilIsValidHdr(ILconst_string FileName);
ILboolean ilIsValidHdrF(ILHANDLE File);
ILboolean ilIsValidHdrL(const void *Lump, ILuint Size);
ILboolean ilLoadHdr(ILconst_string FileName);
ILboolean ilLoadHdrF(ILHANDLE File);
ILboolean ilLoadHdrL(const void *Lump, ILuint Size);
ILboolean ilSaveHdr(ILconst_string FileName);
ILuint ilSaveHdrF(ILHANDLE File);
ILuint ilSaveHdrL(void *Lump, ILuint Size);
ILboolean ilLoadIcon(ILconst_string FileName);
ILboolean ilLoadIconF(ILHANDLE File);
ILboolean ilLoadIconL(const void *Lump, ILuint Size);
ILboolean ilIsValidIcns(ILconst_string FileName);
ILboolean ilIsValidIcnsF(ILHANDLE File);
ILboolean ilIsValidIcnsL(const void *Lump, ILuint Size);
ILboolean ilLoadIcns(ILconst_string FileName);
ILboolean ilLoadIcnsF(ILHANDLE File);
ILboolean ilLoadIcnsL(const void *Lump, ILuint Size);
ILboolean ilLoadIff(ILconst_string FileName);
ILboolean ilLoadIffF(ILHANDLE File);
ILboolean ilLoadIffL(const void *Lump, ILuint Size);
ILboolean ilIsValidIlbm(ILconst_string FileName);
ILboolean ilIsValidIlbmF(ILHANDLE File);
ILboolean ilIsValidIlbmL(const void *Lump, ILuint Size);
ILboolean ilLoadIlbm(ILconst_string FileName);
ILboolean ilLoadIlbmF(ILHANDLE File);
ILboolean ilLoadIlbmL(const void *Lump, ILuint Size);
ILboolean ilIsValidIwi(ILconst_string FileName);
ILboolean ilIsValidIwiF(ILHANDLE File);
ILboolean ilIsValidIwiL(const void *Lump, ILuint Size);
ILboolean ilLoadIwi(ILconst_string FileName);
ILboolean ilLoadIwiF(ILHANDLE File);
ILboolean ilLoadIwiL(const void *Lump, ILuint Size);
ILboolean ilIsValidJp2(ILconst_string FileName);
ILboolean ilIsValidJp2F(ILHANDLE File);
ILboolean ilIsValidJp2L(const void *Lump, ILuint Size);
ILboolean ilLoadJp2(ILconst_string FileName);
ILboolean ilLoadJp2F(ILHANDLE File);
ILboolean ilLoadJp2L(const void *Lump, ILuint Size);
ILboolean ilLoadJp2LInternal(const void *Lump, ILuint Size, ILimage *Image);
ILboolean ilSaveJp2(ILconst_string FileName);
ILuint ilSaveJp2F(ILHANDLE File);
ILuint ilSaveJp2L(void *Lump, ILuint Size);
ILboolean ilIsValidJpeg(ILconst_string FileName);
ILboolean ilIsValidJpegF(ILHANDLE File);
ILboolean ilIsValidJpegL(const void *Lump, ILuint Size);
ILboolean ilLoadJpeg(ILconst_string FileName);
ILboolean ilLoadJpegF(ILHANDLE File);
ILboolean ilLoadJpegL(const void *Lump, ILuint Size);
ILboolean ilSaveJpeg(ILconst_string FileName);
ILuint ilSaveJpegF(ILHANDLE File);
ILuint ilSaveJpegL(void *Lump, ILuint Size);
ILboolean ilIsValidLif(ILconst_string FileName);
ILboolean ilIsValidLifF(ILHANDLE File);
ILboolean ilIsValidLifL(const void *Lump, ILuint Size);
ILboolean ilLoadLif(ILconst_string FileName);
ILboolean ilLoadLifF(ILHANDLE File);
ILboolean ilLoadLifL(const void *Lump, ILuint Size);
ILboolean ilIsValidMdl(ILconst_string FileName);
ILboolean ilIsValidMdlF(ILHANDLE File);
ILboolean ilIsValidMdlL(const void *Lump, ILuint Size);
ILboolean ilLoadMdl(ILconst_string FileName);
ILboolean ilLoadMdlF(ILHANDLE File);
ILboolean ilLoadMdlL(const void *Lump, ILuint Size);
ILboolean ilLoadMng(ILconst_string FileName);
ILboolean ilLoadMngF(ILHANDLE File);
ILboolean ilLoadMngL(const void *Lump, ILuint Size);
ILboolean ilSaveMng(ILconst_string FileName);
ILuint ilSaveMngF(ILHANDLE File);
ILuint ilSaveMngL(void *Lump, ILuint Size);
ILboolean ilIsValidMp3(ILconst_string FileName);
ILboolean ilIsValidMp3F(ILHANDLE File);
ILboolean ilIsValidMp3L(const void *Lump, ILuint Size);
ILboolean ilLoadMp3(ILconst_string FileName);
ILboolean ilLoadMp3F(ILHANDLE File);
ILboolean ilLoadMp3L(const void *Lump, ILuint Size);
ILboolean ilLoadPcd(ILconst_string FileName);
ILboolean ilLoadPcdF(ILHANDLE File);
ILboolean ilLoadPcdL(const void *Lump, ILuint Size);
ILboolean ilIsValidPcx(ILconst_string FileName);
ILboolean ilIsValidPcxF(ILHANDLE File);
ILboolean ilIsValidPcxL(const void *Lump, ILuint Size);
ILboolean ilLoadPcx(ILconst_string FileName);
ILboolean ilLoadPcxF(ILHANDLE File);
ILboolean ilLoadPcxL(const void *Lump, ILuint Size);
ILboolean ilSavePcx(ILconst_string FileName);
ILuint ilSavePcxF(ILHANDLE File);
ILuint ilSavePcxL(void *Lump, ILuint Size);
ILboolean ilIsValidPic(ILconst_string FileName);
ILboolean ilIsValidPicF(ILHANDLE File);
ILboolean ilIsValidPicL(const void *Lump, ILuint Size);
ILboolean ilLoadPic(ILconst_string FileName);
ILboolean ilLoadPicF(ILHANDLE File);
ILboolean ilLoadPicL(const void *Lump, ILuint Size);
ILboolean ilLoadPix(ILconst_string FileName);
ILboolean ilLoadPixF(ILHANDLE File);
ILboolean ilLoadPixL(const void *Lump, ILuint Size);
ILboolean ilIsValidPng(ILconst_string FileName);
ILboolean ilIsValidPngF(ILHANDLE File);
ILboolean ilIsValidPngL(const void *Lump, ILuint Size);
ILboolean ilLoadPng(ILconst_string FileName);
ILboolean ilLoadPngF(ILHANDLE File);
ILboolean ilLoadPngL(const void *Lump, ILuint Size);
ILboolean ilSavePng(ILconst_string FileName);
ILuint ilSavePngF(ILHANDLE File);
ILuint ilSavePngL(void *Lump, ILuint Size);
ILboolean ilIsValidPnm(ILconst_string FileName);
ILboolean ilIsValidPnmF(ILHANDLE File);
ILboolean ilIsValidPnmL(const void *Lump, ILuint Size);
ILboolean ilLoadPnm(ILconst_string FileName);
ILboolean ilLoadPnmF(ILHANDLE File);
ILboolean ilLoadPnmL(const void *Lump, ILuint Size);
ILboolean ilSavePnm(ILconst_string FileName);
ILuint ilSavePnmF(ILHANDLE File);
ILuint ilSavePnmL(void *Lump, ILuint Size);
ILboolean ilIsValidPsd(ILconst_string FileName);
ILboolean ilIsValidPsdF(ILHANDLE File);
ILboolean ilIsValidPsdL(const void *Lump, ILuint Size);
ILboolean ilLoadPsd(ILconst_string FileName);
ILboolean ilLoadPsdF(ILHANDLE File);
ILboolean ilLoadPsdL(const void *Lump, ILuint Size);
ILboolean ilSavePsd(ILconst_string FileName);
ILuint ilSavePsdF(ILHANDLE File);
ILuint ilSavePsdL(void *Lump, ILuint Size);
ILboolean ilIsValidPsp(ILconst_string FileName);
ILboolean ilIsValidPspF(ILHANDLE File);
ILboolean ilIsValidPspL(const void *Lump, ILuint Size);
ILboolean ilLoadPsp(ILconst_string FileName);
ILboolean ilLoadPspF(ILHANDLE File);
ILboolean ilLoadPspL(const void *Lump, ILuint Size);
ILboolean ilLoadPxr(ILconst_string FileName);
ILboolean ilLoadPxrF(ILHANDLE File);
ILboolean ilLoadPxrL(const void *Lump, ILuint Size);
ILboolean ilLoadRaw(ILconst_string FileName);
ILboolean ilLoadRawF(ILHANDLE File);
ILboolean ilLoadRawL(const void *Lump, ILuint Size);
ILboolean ilSaveRaw(ILconst_string FileName);
ILuint ilSaveRawF(ILHANDLE File);
ILuint ilSaveRawL(void *Lump, ILuint Size);
ILboolean ilLoadRot(ILconst_string FileName);
ILboolean ilLoadRotF(ILHANDLE File);
ILboolean ilLoadRotL(const void *Lump, ILuint Size);
ILboolean ilIsValidRot(ILconst_string FileName);
ILboolean ilIsValidRotF(ILHANDLE File);
ILboolean ilIsValidRotL(const void *Lump, ILuint Size);
ILboolean ilIsValidSgi(ILconst_string FileName);
ILboolean ilIsValidSgiF(ILHANDLE File);
ILboolean ilIsValidSgiL(const void *Lump, ILuint Size);
ILboolean ilLoadSgi(ILconst_string FileName);
ILboolean ilLoadSgiF(ILHANDLE File);
ILboolean ilLoadSgiL(const void *Lump, ILuint Size);
ILboolean ilSaveSgi(ILconst_string FileName);
ILuint ilSaveSgiF(ILHANDLE File);
ILuint ilSaveSgiL(void *Lump, ILuint Size);
ILboolean ilIsValidSun(ILconst_string FileName);
ILboolean ilIsValidSunF(ILHANDLE File);
ILboolean ilIsValidSunL(const void *Lump, ILuint Size);
ILboolean ilLoadSun(ILconst_string FileName);
ILboolean ilLoadSunF(ILHANDLE File);
ILboolean ilLoadSunL(const void *Lump, ILuint Size);
ILboolean ilIsValidTga(ILconst_string FileName);
ILboolean ilIsValidTgaF(ILHANDLE File);
ILboolean ilIsValidTgaL(const void *Lump, ILuint Size);
ILboolean ilLoadTarga(ILconst_string FileName);
ILboolean ilLoadTargaF(ILHANDLE File);
ILboolean ilLoadTargaL(const void *Lump, ILuint Size);
ILboolean ilSaveTarga(ILconst_string FileName);
ILuint ilSaveTargaF(ILHANDLE File);
ILuint ilSaveTargaL(void *Lump, ILuint Size);
ILboolean ilLoadTexture(ILconst_string FileName);
ILboolean ilLoadTextureF(ILHANDLE File);
ILboolean ilLoadTextureL(const void *Lump, ILuint Size);
ILboolean ilIsValidTiff(ILconst_string FileName);
ILboolean ilIsValidTiffF(ILHANDLE File);
ILboolean ilIsValidTiffL(const void *Lump, ILuint Size);
ILboolean ilLoadTiff(ILconst_string FileName);
ILboolean ilLoadTiffF(ILHANDLE File);
ILboolean ilLoadTiffL(const void *Lump, ILuint Size);
ILboolean ilSaveTiff(ILconst_string FileName);
ILuint ilSaveTiffF(ILHANDLE File);
ILuint ilSaveTiffL(void *Lump, ILuint Size);
ILboolean ilIsValidTpl(ILconst_string FileName);
ILboolean ilIsValidTplF(ILHANDLE File);
ILboolean ilIsValidTplL(const void *Lump, ILuint Size);
ILboolean ilLoadTpl(ILconst_string FileName);
ILboolean ilLoadTplF(ILHANDLE File);
ILboolean ilLoadTplL(const void *Lump, ILuint Size);
ILboolean ilLoadUtx(ILconst_string FileName);
ILboolean ilLoadUtxF(ILHANDLE File);
ILboolean ilLoadUtxL(const void *Lump, ILuint Size);
ILboolean ilIsValidVtf(ILconst_string FileName);
ILboolean ilIsValidVtfF(ILHANDLE File);
ILboolean ilIsValidVtfL(const void *Lump, ILuint Size);
ILboolean ilLoadVtf(ILconst_string FileName);
ILboolean ilLoadVtfF(ILHANDLE File);
ILboolean ilLoadVtfL(const void *Lump, ILuint Size);
ILboolean ilSaveVtf(ILconst_string FileName);
ILuint ilSaveVtfF(ILHANDLE File);
ILuint ilSaveVtfL(void *Lump, ILuint Size);ILboolean ilLoadWal(ILconst_string FileName);
ILboolean ilLoadWalF(ILHANDLE File);
ILboolean ilLoadWalL(const void *Lump, ILuint Size);
ILboolean ilLoadWbmp(ILconst_string FileName);
ILboolean ilLoadWbmpF(ILHANDLE File);
ILboolean ilLoadWbmpL(const void *Lump, ILuint Size);
ILboolean ilSaveWbmp(ILconst_string FileName);
ILuint ilSaveWbmpF(ILHANDLE File);
ILuint ilSaveWbmpL(void *Lump, ILuint Size);
ILboolean ilIsValidWdp(ILconst_string FileName);
ILboolean ilIsValidWdpF(ILHANDLE File);
ILboolean ilIsValidWdpL(const void *Lump, ILuint Size);
ILboolean ilLoadWdp(ILconst_string FileName);
ILboolean ilLoadWdpF(ILHANDLE File);
ILboolean ilLoadWdpL(const void *Lump, ILuint Size);
ILboolean ilIsValidXpm(ILconst_string FileName);
ILboolean ilIsValidXpmF(ILHANDLE File);
ILboolean ilIsValidXpmL(const void *Lump, ILuint Size);
ILboolean ilLoadXpm(ILconst_string FileName);
ILboolean ilLoadXpmF(ILHANDLE File);
ILboolean ilLoadXpmL(const void *Lump, ILuint Size);
// OpenEXR is written in C++, so we have to wrap this to avoid linker errors.
/*#ifndef IL_NO_EXR
#ifdef __cplusplus
extern "C" {
#endif
ILboolean ilLoadExr(ILconst_string FileName);
#ifdef __cplusplus
}
#endif
#endif*/
//ILboolean ilLoadExr(ILconst_string FileName);
#ifdef __cplusplus
}
#endif
#endif//INTERNAL_H
+22
View File
@@ -0,0 +1,22 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 08/24/2008
//
// Filename: src-IL/src/il_jp2.h
//
// Description: Jpeg-2000 (.jp2) functions
//
//-----------------------------------------------------------------------------
#ifndef JP2_H
#define JP2_H
#include "il_internal.h"
ILboolean iLoadJp2Internal(jas_stream_t *Stream, ILimage *Image);
ILboolean iSaveJp2Internal();
jas_stream_t *iJp2ReadStream();
#endif//JP2_H
+29
View File
@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 03/07/2009
//
// Filename: src-IL/include/il_jpeg.h
//
// Description: Jpeg (.jpg) functions
//
//-----------------------------------------------------------------------------
#ifndef JPEG_H
#define JPEG_H
#include "il_internal.h"
ILboolean iCheckJpg(ILubyte Header[2]);
ILboolean iIsValidJpg(void);
#ifndef IL_USE_IJL
ILboolean iLoadJpegInternal(void);
ILboolean iSaveJpegInternal(void);
#else
ILboolean iLoadJpegInternal(ILconst_string FileName, ILvoid *Lump, ILuint Size);
ILboolean iSaveJpegInternal(ILconst_string FileName, ILvoid *Lump, ILuint Size);
#endif
#endif//JPEG_H
+37
View File
@@ -0,0 +1,37 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2001 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_lif.c
//
// Description: Reads a Homeworld image.
//
//-----------------------------------------------------------------------------
#ifndef LIF_H
#define LIF_H
#include "il_internal.h"
typedef struct LIF_HEAD
{
char Id[8]; //"Willy 7"
ILuint Version; // Version Number (260)
ILuint Flags; // Usually 50
ILuint Width;
ILuint Height;
ILuint PaletteCRC; // CRC of palettes for fast comparison.
ILuint ImageCRC; // CRC of the image.
ILuint PalOffset; // Offset to the palette (not used).
ILuint TeamEffect0; // Team effect offset 0
ILuint TeamEffect1; // Team effect offset 1
} LIF_HEAD;
ILboolean iIsValidLif(void);
ILboolean iCheckLif(LIF_HEAD *Header);
ILboolean iLoadLifInternal(void);
#endif//LIF_H
+249
View File
@@ -0,0 +1,249 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2001-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_manip.h
//
// Description: Image manipulation
//
//-----------------------------------------------------------------------------
#ifndef MANIP_H
#define MANIP_H
#ifdef _cplusplus
extern "C" {
#endif
ILboolean ilFlipImage(void);
ILboolean ilMirrorImage(void); //@JASON New routine created 03/28/2001
//-----------------------------------------------
// Overflow handler for float-to-half conversion;
// generates a hardware floating-point overflow,
// which may be trapped by the operating system.
//-----------------------------------------------
#ifndef NOINLINE
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4756) // Disables 'named type definition in parentheses' warning
#endif
INLINE ILfloat /*ILAPIENTRY*/ ilFloatToHalfOverflow() {
ILfloat f = 1e10;
ILint j;
for (j = 0; j < 10; j++)
f *= f; // this will overflow before
// the for loop terminates
return f;
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
//-----------------------------------------------------
// Float-to-half conversion -- general case, including
// zeroes, denormalized numbers and exponent overflows.
//-----------------------------------------------------
INLINE ILushort ILAPIENTRY ilFloatToHalf(ILuint i) {
//
// Our floating point number, f, is represented by the bit
// pattern in integer i. Disassemble that bit pattern into
// the sign, s, the exponent, e, and the significand, m.
// Shift s into the position where it will go in in the
// resulting half number.
// Adjust e, accounting for the different exponent bias
// of float and half (127 versus 15).
//
register int s = (i >> 16) & 0x00008000;
register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
register int m = i & 0x007fffff;
//
// Now reassemble s, e and m into a half:
//
if (e <= 0)
{
if (e < -10)
{
//
// E is less than -10. The absolute value of f is
// less than HALF_MIN (f may be a small normalized
// float, a denormalized float or a zero).
//
// We convert f to a half zero.
//
return 0;
}
//
// E is between -10 and 0. F is a normalized float,
// whose magnitude is less than HALF_NRM_MIN.
//
// We convert f to a denormalized half.
//
m = (m | 0x00800000) >> (1 - e);
//
// Round to nearest, round "0.5" up.
//
// Rounding may cause the significand to overflow and make
// our number normalized. Because of the way a half's bits
// are laid out, we don't have to treat this case separately;
// the code below will handle it correctly.
//
if (m & 0x00001000)
m += 0x00002000;
//
// Assemble the half from s, e (zero) and m.
//
return s | (m >> 13);
}
else if (e == 0xff - (127 - 15))
{
if (m == 0)
{
//
// F is an infinity; convert f to a half
// infinity with the same sign as f.
//
return s | 0x7c00;
}
else
{
//
// F is a NAN; we produce a half NAN that preserves
// the sign bit and the 10 leftmost bits of the
// significand of f, with one exception: If the 10
// leftmost bits are all zero, the NAN would turn
// into an infinity, so we have to set at least one
// bit in the significand.
//
m >>= 13;
return s | 0x7c00 | m | (m == 0);
}
}
else
{
//
// E is greater than zero. F is a normalized float.
// We try to convert f to a normalized half.
//
//
// Round to nearest, round "0.5" up
//
if (m & 0x00001000)
{
m += 0x00002000;
if (m & 0x00800000)
{
m = 0; // overflow in significand,
e += 1; // adjust exponent
}
}
//
// Handle exponent overflow
//
if (e > 30)
{
ilFloatToHalfOverflow(); // Cause a hardware floating point overflow;
return s | 0x7c00; // if this returns, the half becomes an
} // infinity with the same sign as f.
//
// Assemble the half from s, e and m.
//
return s | (e << 10) | (m >> 13);
}
}
// Taken from OpenEXR
INLINE ILuint ILAPIENTRY ilHalfToFloat (ILushort y) {
int s = (y >> 15) & 0x00000001;
int e = (y >> 10) & 0x0000001f;
int m = y & 0x000003ff;
if (e == 0)
{
if (m == 0)
{
//
// Plus or minus zero
//
return s << 31;
}
else
{
//
// Denormalized number -- renormalize it
//
while (!(m & 0x00000400))
{
m <<= 1;
e -= 1;
}
e += 1;
m &= ~0x00000400;
}
}
else if (e == 31)
{
if (m == 0)
{
//
// Positive or negative infinity
//
return (s << 31) | 0x7f800000;
}
else
{
//
// Nan -- preserve sign and significand bits
//
return (s << 31) | 0x7f800000 | (m << 13);
}
}
//
// Normalized number
//
e = e + (127 - 15);
m = m << 13;
//
// Assemble s, e and m.
//
return (s << 31) | (e << 23) | m;
}
#endif //NOINLINE
#ifdef _cplusplus
}
#endif
#endif//MANIP_H
+28
View File
@@ -0,0 +1,28 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_mdl.h
//
// Description: Reads a Half-Life model file.
//
//-----------------------------------------------------------------------------
#ifndef MD2_H
#define MD2_H
#include "il_internal.h"
typedef struct TEX_HEAD
{
char Name[64];
ILuint Flags;
ILuint Width;
ILuint Height;
ILuint Offset;
} TEX_HEAD;
#endif//MD2_H
+54
View File
@@ -0,0 +1,54 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_pal.h
//
// Description: Loads palettes from different file formats
//
//-----------------------------------------------------------------------------
#ifndef IL_PAL_H
#define IL_PAL_H
#include "il_internal.h"
#define BUFFLEN 256
#define PALBPP 3
#ifdef _MSC_VER
#pragma pack(push, packed_struct, 1)
#endif
typedef struct HALOHEAD
{
ILushort Id; // 'AH'
ILshort Version;
ILshort Size;
ILbyte Filetype;
ILbyte Subtype;
//ILshort Brdid, Grmode;
ILint Ignored;
ILushort MaxIndex; // Colors = maxindex + 1
ILushort MaxRed;
ILushort MaxGreen;
ILushort MaxBlue;
/*ILbyte Signature[8];
ILbyte Filler[12];*/
ILbyte Filler[20]; // Always 0 by PSP 4
} IL_PACKSTRUCT HALOHEAD;
#ifdef _MSC_VER
#pragma pack(pop, packed_struct)
#endif
ILboolean ilLoadJascPal(ILconst_string FileName);
ILboolean ilSaveJascPal(ILconst_string FileName);
char *iFgetw(ILubyte *Buff, ILint MaxLen, FILE *File);
ILboolean ilLoadHaloPal(ILconst_string FileName);
ILboolean ilLoadColPal(ILconst_string FileName);
ILboolean ilLoadActPal(ILconst_string FileName);
ILboolean ilLoadPltPal(ILconst_string FileName);
#endif//IL_PAL_H
+58
View File
@@ -0,0 +1,58 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_pcx.h
//
// Description: Reads and writes from/to a .pcx file.
//
//-----------------------------------------------------------------------------
#ifndef PCX_H
#define PCX_H
#include "il_internal.h"
#ifdef _WIN32
#pragma pack(push, packed_struct, 1)
#endif
typedef struct PCXHEAD
{
ILubyte Manufacturer;
ILubyte Version;
ILubyte Encoding;
ILubyte Bpp;
ILushort Xmin, Ymin, Xmax, Ymax;
ILushort HDpi;
ILushort VDpi;
ILubyte ColMap[48];
ILubyte Reserved;
ILubyte NumPlanes;
ILushort Bps;
ILushort PaletteInfo;
ILushort HScreenSize;
ILushort VScreenSize;
ILubyte Filler[54];
} IL_PACKSTRUCT PCXHEAD;
#ifdef _WIN32
#pragma pack(pop, packed_struct)
#endif
// For checking and reading
ILboolean iIsValidPcx(void);
ILboolean iCheckPcx(PCXHEAD *Header);
ILboolean iLoadPcxInternal(void);
ILboolean iSavePcxInternal(void);
ILboolean iUncompressPcx(PCXHEAD *Header);
ILboolean iUncompressSmall(PCXHEAD *Header);
// For writing
ILuint encput(ILubyte byt, ILubyte cnt);
ILuint encLine(ILubyte *inBuff, ILint inLen, ILubyte Stride);
#endif//PCX_H
+79
View File
@@ -0,0 +1,79 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/21/2002 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_pic.h
//
// Description: Softimage Pic (.pic) functions
//
//-----------------------------------------------------------------------------
#ifndef PIC_H
#define PIC_H
#include "il_internal.h"
#ifdef _MSC_VER
#pragma pack(push, packed_struct, 1)
#endif
typedef struct PIC_HEAD
{
ILint Magic; // PIC_MAGIC_NUMBER
ILfloat Version; // Version of format
ILbyte Comment[80]; // Prototype description
ILbyte Id[4]; // 'PICT'
ILshort Width; // Image width, in pixels
ILshort Height; // Image height, in pixels
ILfloat Ratio; // Pixel aspect ratio
ILshort Fields; // Picture field type
ILshort Padding; // Unused
} IL_PACKSTRUCT PIC_HEAD;
typedef struct CHANNEL
{
ILubyte Size;
ILubyte Type;
ILubyte Chan;
void *Next;
} CHANNEL;
#ifdef _MSC_VER
#pragma pack(pop, packed_struct)
#endif
// Data type
#define PIC_UNSIGNED_INTEGER 0x00
#define PIC_SIGNED_INTEGER 0x10 // XXX: Not implemented
#define PIC_SIGNED_FLOAT 0x20 // XXX: Not implemented
// Compression type
#define PIC_UNCOMPRESSED 0x00
#define PIC_PURE_RUN_LENGTH 0x01
#define PIC_MIXED_RUN_LENGTH 0x02
// CHANNEL types (OR'd)
#define PIC_RED_CHANNEL 0x80
#define PIC_GREEN_CHANNEL 0x40
#define PIC_BLUE_CHANNEL 0x20
#define PIC_ALPHA_CHANNEL 0x10
#define PIC_SHADOW_CHANNEL 0x08 // XXX: Not implemented
#define PIC_DEPTH_CHANNEL 0x04 // XXX: Not implemented
#define PIC_AUXILIARY_1_CHANNEL 0x02 // XXX: Not implemented
#define PIC_AUXILIARY_2_CHANNEL 0x01 // XXX: Not implemented
ILboolean iIsValidPic(void);
ILboolean iCheckPic(PIC_HEAD *Header);
ILboolean iLoadPicInternal(void);
ILboolean readScanlines(ILuint *image, ILint width, ILint height, CHANNEL *channel, ILuint alpha);
ILuint readScanline(ILubyte *scan, ILint width, CHANNEL *channel, ILint bytes);
ILboolean channelReadRaw(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
ILboolean channelReadPure(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
ILboolean channelReadMixed(ILubyte *scan, ILint width, ILint noCol, ILint *off, ILint bytes);
#endif//PIC_H
+46
View File
@@ -0,0 +1,46 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_pnm.h
//
// Description: Reads/writes to/from pbm/pgm/ppm formats
//
//-----------------------------------------------------------------------------
#ifndef PPMPGM_H
#define PPMPGM_H
#include "il_internal.h"
#define IL_PBM_ASCII 0x0001
#define IL_PGM_ASCII 0x0002
#define IL_PPM_ASCII 0x0003
#define IL_PBM_BINARY 0x0004
#define IL_PGM_BINARY 0x0005
#define IL_PPM_BINARY 0x0006
typedef struct PPMINFO
{
ILenum Type;
ILuint Width;
ILuint Height;
ILuint MaxColour;
ILubyte Bpp;
} PPMINFO;
ILboolean iIsValidPnm(void);
ILboolean iCheckPnm(char Header[2]);
ILboolean iLoadPnmInternal(void);
ILboolean iSavePnmInternal(void);
ILimage *ilReadAsciiPpm(PPMINFO *Info);
ILimage *ilReadBinaryPpm(PPMINFO *Info);
ILimage *ilReadBitPbm(PPMINFO *Info);
ILboolean iGetWord(ILboolean);
void PbmMaximize(ILimage *Image);
#endif//PPMPGM_H
+56
View File
@@ -0,0 +1,56 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2001 by Denton Woods
// Last modified: 01/23/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_il_psd.c
//
// Description: Reads from a PhotoShop (.psd) file.
//
//-----------------------------------------------------------------------------
#ifndef PSD_H
#define PSD_H
#include "il_internal.h"
#ifdef _MSC_VER
#pragma pack(push, packed_struct, 1)
#endif
typedef struct PSDHEAD
{
ILubyte Signature[4];
ILushort Version;
ILubyte Reserved[6];
ILushort Channels;
ILuint Height;
ILuint Width;
ILushort Depth;
ILushort Mode;
} IL_PACKSTRUCT PSDHEAD;
#ifdef _MSC_VER
#pragma pack(pop, packed_struct)
#endif
ILushort ChannelNum;
ILboolean iIsValidPsd(void);
ILboolean iCheckPsd(PSDHEAD *Header);
ILboolean iLoadPsdInternal(void);
ILboolean ReadPsd(PSDHEAD *Head);
ILboolean ReadGrey(PSDHEAD *Head);
ILboolean ReadIndexed(PSDHEAD *Head);
ILboolean ReadRGB(PSDHEAD *Head);
ILboolean ReadCMYK(PSDHEAD *Head);
ILuint *GetCompChanLen(PSDHEAD *Head);
ILboolean PsdGetData(PSDHEAD *Head, void *Buffer, ILboolean Compressed);
ILboolean ParseResources(ILuint ResourceSize, ILubyte *Resources);
ILboolean GetSingleChannel(PSDHEAD *Head, ILubyte *Buffer, ILboolean Compressed);
ILboolean iSavePsdInternal(void);
#endif//PSD_H
+250
View File
@@ -0,0 +1,250 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/02/2002 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_psp.h
//
// Description: Reads a Paint Shop Pro file.
//
//-----------------------------------------------------------------------------
#ifndef PSP_H
#define PSP_H
#include "il_internal.h"
// Block identifiers
enum PSPBlockID {
PSP_IMAGE_BLOCK = 0, // (0) General Image Attributes Block (main)
PSP_CREATOR_BLOCK, // (1) Creator Data Block (main)
PSP_COLOR_BLOCK, // (2) Color Palette Block (main and sub)
PSP_LAYER_START_BLOCK, // (3) Layer Bank Block (main)
PSP_LAYER_BLOCK, // (4) Layer Block (sub)
PSP_CHANNEL_BLOCK, // (5) Channel Block (sub)
PSP_SELECTION_BLOCK, // (6) Selection Block (main)
PSP_ALPHA_BANK_BLOCK, // (7) Alpha Bank Block (main)
PSP_ALPHA_CHANNEL_BLOCK, // (8) Alpha Channel Block (sub)
PSP_COMPOSITE_IMAGE_BLOCK, // (9) Composite Image Block (sub)
PSP_EXTENDED_DATA_BLOCK, // (10) Extended Data Block (main)
PSP_TUBE_BLOCK, // (11) Picture Tube Data Block (main)
PSP_ADJUSTMENT_EXTENSION_BLOCK, // (12) Adjustment Layer Block (sub)
PSP_VECTOR_EXTENSION_BLOCK, // (13) Vector Layer Block (sub)
PSP_SHAPE_BLOCK, // (14) Vector Shape Block (sub)
PSP_PAINTSTYLE_BLOCK, // (15) Paint Style Block (sub)
PSP_COMPOSITE_IMAGE_BANK_BLOCK, // (16) Composite Image Bank (main)
PSP_COMPOSITE_ATTRIBUTES_BLOCK, // (17) Composite Image Attr. (sub)
PSP_JPEG_BLOCK, // (18) JPEG Image Block (sub)
PSP_LINESTYLE_BLOCK, // (19) Line Style Block (sub)
PSP_TABLE_BANK_BLOCK, // (20) Table Bank Block (main)
PSP_TABLE_BLOCK, // (21) Table Block (sub)
PSP_PAPER_BLOCK, // (22) Vector Table Paper Block (sub)
PSP_PATTERN_BLOCK, // (23) Vector Table Pattern Block (sub)
};
// Bitmap type
enum PSPDIBType {
PSP_DIB_IMAGE = 0, // Layer color bitmap
PSP_DIB_TRANS_MASK, // Layer transparency mask bitmap
PSP_DIB_USER_MASK, // Layer user mask bitmap
PSP_DIB_SELECTION, // Selection mask bitmap
PSP_DIB_ALPHA_MASK, // Alpha channel mask bitmap
PSP_DIB_THUMBNAIL // Thumbnail bitmap
};
// Channel types
enum PSPChannelType {
PSP_CHANNEL_COMPOSITE = 0, // Channel of single channel bitmap
PSP_CHANNEL_RED, // Red channel of 24 bit bitmap
PSP_CHANNEL_GREEN, // Green channel of 24 bit bitmap
PSP_CHANNEL_BLUE // Blue channel of 24 bit bitmap
};
// Possible metrics used to measure resolution
enum PSP_METRIC {
PSP_METRIC_UNDEFINED = 0, // Metric unknown
PSP_METRIC_INCH, // Resolution is in inches
PSP_METRIC_CM // Resolution is in centimeters
};
// Possible types of compression.
enum PSPCompression {
PSP_COMP_NONE = 0, // No compression
PSP_COMP_RLE, // RLE compression
PSP_COMP_LZ77, // LZ77 compression
PSP_COMP_JPEG // JPEG compression (only used by thumbnail and composite image)
};
// Picture tube placement mode.
enum TubePlacementMode {
tpmRandom, // Place tube images in random intervals
tpmConstant // Place tube images in constant intervals
};
// Picture tube selection mode.
enum TubeSelectionMode {
tsmRandom, // Randomly select the next image in tube to display
tsmIncremental, // Select each tube image in turn
tsmAngular, // Select image based on cursor direction
tsmPressure, // Select image based on pressure (from pressure-sensitive pad)
tsmVelocity // Select image based on cursor speed
};
// Extended data field types.
enum PSPExtendedDataID {
PSP_XDATA_TRNS_INDEX = 0 // Transparency index field
};
// Creator field types.
enum PSPCreatorFieldID {
PSP_CRTR_FLD_TITLE = 0, // Image document title field
PSP_CRTR_FLD_CRT_DATE, // Creation date field
PSP_CRTR_FLD_MOD_DATE, // Modification date field
PSP_CRTR_FLD_ARTIST, // Artist name field
PSP_CRTR_FLD_CPYRGHT, // Copyright holder name field
PSP_CRTR_FLD_DESC, // Image document description field
PSP_CRTR_FLD_APP_ID, // Creating app id field
PSP_CRTR_FLD_APP_VER, // Creating app version field
};
// Creator application identifiers.
enum PSPCreatorAppID {
PSP_CREATOR_APP_UNKNOWN = 0, // Creator application unknown
PSP_CREATOR_APP_PAINT_SHOP_PRO // Creator is Paint Shop Pro
};
// Layer types.
enum PSPLayerType {
PSP_LAYER_NORMAL = 0, // Normal layer
PSP_LAYER_FLOATING_SELECTION // Floating selection layer
};
// Truth values.
/*enum PSP_BOOLEAN {
FALSE = 0,
TRUE
};*/
#ifdef _MSC_VER
#pragma pack(push, packed_struct, 1)
#endif
typedef struct PSPRECT
{
ILuint x1,y1,x2,y2;
} IL_PACKSTRUCT PSPRECT;
typedef struct PSPHEAD
{
char FileSig[32];
ILushort MajorVersion;
ILushort MinorVersion;
} IL_PACKSTRUCT PSPHEAD;
typedef struct BLOCKHEAD
{
ILubyte HeadID[4];
ILushort BlockID;
ILuint BlockLen;
} IL_PACKSTRUCT BLOCKHEAD;
typedef struct GENATT_CHUNK
{
ILint Width;
ILint Height;
ILdouble Resolution;
ILubyte ResMetric;
ILushort Compression;
ILushort BitDepth;
ILushort PlaneCount;
ILuint ColourCount;
ILubyte GreyscaleFlag;
ILuint SizeOfImage;
ILint ActiveLayer;
ILushort LayerCount;
ILuint GraphicContents;
} IL_PACKSTRUCT GENATT_CHUNK;
typedef struct LAYERINFO_CHUNK
{
ILubyte LayerType;
PSPRECT ImageRect;
PSPRECT SavedImageRect;
ILubyte Opacity;
ILubyte BlendingMode;
ILubyte LayerFlags;
ILubyte TransProtFlag;
ILubyte LinkID;
PSPRECT MaskRect;
PSPRECT SavedMaskRect;
ILubyte MaskLinked;
ILubyte MaskDisabled;
ILubyte InvertMaskBlend;
ILushort BlendRange;
ILubyte SourceBlend1[4];
ILubyte DestBlend1[4];
ILubyte SourceBlend2[4];
ILubyte DestBlend2[4];
ILubyte SourceBlend3[4];
ILubyte DestBlend3[4];
ILubyte SourceBlend4[4];
ILubyte DestBlend4[4];
ILubyte SourceBlend5[4];
ILubyte DestBlend5[4];
} IL_PACKSTRUCT LAYERINFO_CHUNK;
typedef struct LAYERBITMAP_CHUNK
{
ILushort NumBitmaps;
ILushort NumChannels;
} IL_PACKSTRUCT LAYERBITMAP_CHUNK;
typedef struct CHANNEL_CHUNK
{
ILuint CompLen;
ILuint Length;
ILushort BitmapType;
ILushort ChanType;
} IL_PACKSTRUCT CHANNEL_CHUNK;
typedef struct ALPHAINFO_CHUNK
{
PSPRECT AlphaRect;
PSPRECT AlphaSavedRect;
} IL_PACKSTRUCT ALPHAINFO_CHUNK;
typedef struct ALPHA_CHUNK
{
ILushort BitmapCount;
ILushort ChannelCount;
} IL_PACKSTRUCT ALPHA_CHUNK;
#ifdef _MSC_VER
#pragma pack(pop, packed_struct)
#endif
// Function definitions
ILboolean iLoadPspInternal(void);
ILboolean iCheckPsp(void);
ILboolean iIsValidPsp(void);
ILboolean ReadGenAttributes(void);
ILboolean ParseChunks(void);
ILboolean ReadLayerBlock(ILuint BlockLen);
ILboolean ReadAlphaBlock(ILuint BlockLen);
ILubyte *GetChannel(void);
ILboolean UncompRLE(ILubyte *CompData, ILubyte *Data, ILuint CompLen);
ILboolean ReadPalette(ILuint BlockLen);
ILboolean AssembleImage(void);
ILboolean Cleanup(void);
#endif//PSP_H
+276
View File
@@ -0,0 +1,276 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_q2pal.h
//
// Description: The default Quake2 palette
//
//-----------------------------------------------------------------------------
#ifndef Q2PAL_H
#define Q2PAL_H
#define IL_Q2PAL_SIZE 768
ILubyte ilDefaultQ2Pal[IL_Q2PAL_SIZE] = {
0, 0, 0,
15, 15, 15,
31, 31, 31,
47, 47, 47,
63, 63, 63,
75, 75, 75,
91, 91, 91,
107, 107, 107,
123, 123, 123,
139, 139, 139,
155, 155, 155,
171, 171, 171,
187, 187, 187,
203, 203, 203,
219, 219, 219,
235, 235, 235,
99, 75, 35,
91, 67, 31,
83, 63, 31,
79, 59, 27,
71, 55, 27,
63, 47, 23,
59, 43, 23,
51, 39, 19,
47, 35, 19,
43, 31, 19,
39, 27, 15,
35, 23, 15,
27, 19, 11,
23, 15, 11,
19, 15, 7,
15, 11, 7,
95, 95, 111,
91, 91, 103,
91, 83, 95,
87, 79, 91,
83, 75, 83,
79, 71, 75,
71, 63, 67,
63, 59, 59,
59, 55, 55,
51, 47, 47,
47, 43, 43,
39, 39, 39,
35, 35, 35,
27, 27, 27,
23, 23, 23,
19, 19, 19,
143, 119, 83,
123, 99, 67,
115, 91, 59,
103, 79, 47,
207, 151, 75,
167, 123, 59,
139, 103, 47,
111, 83, 39,
235, 159, 39,
203, 139, 35,
175, 119, 31,
147, 99, 27,
119, 79, 23,
91, 59, 15,
63, 39, 11,
35, 23, 7,
167, 59, 43,
159, 47, 35,
151, 43, 27,
139, 39, 19,
127, 31, 15,
115, 23, 11,
103, 23, 7,
87, 19, 0,
75, 15, 0,
67, 15, 0,
59, 15, 0,
51, 11, 0,
43, 11, 0,
35, 11, 0,
27, 7, 0,
19, 7, 0,
123, 95, 75,
115, 87, 67,
107, 83, 63,
103, 79, 59,
95, 71, 55,
87, 67, 51,
83, 63, 47,
75, 55, 43,
67, 51, 39,
63, 47, 35,
55, 39, 27,
47, 35, 23,
39, 27, 19,
31, 23, 15,
23, 15, 11,
15, 11, 7,
111, 59, 23,
95, 55, 23,
83, 47, 23,
67, 43, 23,
55, 35, 19,
39, 27, 15,
27, 19, 11,
15, 11, 7,
179, 91, 79,
191, 123, 111,
203, 155, 147,
215, 187, 183,
203, 215, 223,
179, 199, 211,
159, 183, 195,
135, 167, 183,
115, 151, 167,
91, 135, 155,
71, 119, 139,
47, 103, 127,
23, 83, 111,
19, 75, 103,
15, 67, 91,
11, 63, 83,
7, 55, 75,
7, 47, 63,
7, 39, 51,
0, 31, 43,
0, 23, 31,
0, 15, 19,
0, 7, 11,
0, 0, 0,
139, 87, 87,
131, 79, 79,
123, 71, 71,
115, 67, 67,
107, 59, 59,
99, 51, 51,
91, 47, 47,
87, 43, 43,
75, 35, 35,
63, 31, 31,
51, 27, 27,
43, 19, 19,
31, 15, 15,
19, 11, 11,
11, 7, 7,
0, 0, 0,
151, 159, 123,
143, 151, 115,
135, 139, 107,
127, 131, 99,
119, 123, 95,
115, 115, 87,
107, 107, 79,
99, 99, 71,
91, 91, 67,
79, 79, 59,
67, 67, 51,
55, 55, 43,
47, 47, 35,
35, 35, 27,
23, 23, 19,
15, 15, 11,
159, 75, 63,
147, 67, 55,
139, 59, 47,
127, 55, 39,
119, 47, 35,
107, 43, 27,
99, 35, 23,
87, 31, 19,
79, 27, 15,
67, 23, 11,
55, 19, 11,
43, 15, 7,
31, 11, 7,
23, 7, 0,
11, 0, 0,
0, 0, 0,
119, 123, 207,
111, 115, 195,
103, 107, 183,
99, 99, 167,
91, 91, 155,
83, 87, 143,
75, 79, 127,
71, 71, 115,
63, 63, 103,
55, 55, 87,
47, 47, 75,
39, 39, 63,
35, 31, 47,
27, 23, 35,
19, 15, 23,
11, 7, 7,
155, 171, 123,
143, 159, 111,
135, 151, 99,
123, 139, 87,
115, 131, 75,
103, 119, 67,
95, 111, 59,
87, 103, 51,
75, 91, 39,
63, 79, 27,
55, 67, 19,
47, 59, 11,
35, 47, 7,
27, 35, 0,
19, 23, 0,
11, 15, 0,
0, 255, 0,
35, 231, 15,
63, 211, 27,
83, 187, 39,
95, 167, 47,
95, 143, 51,
95, 123, 51,
255, 255, 255,
255, 255, 211,
255, 255, 167,
255, 255, 127,
255, 255, 83,
255, 255, 39,
255, 235, 31,
255, 215, 23,
255, 191, 15,
255, 171, 7,
255, 147, 0,
239, 127, 0,
227, 107, 0,
211, 87, 0,
199, 71, 0,
183, 59, 0,
171, 43, 0,
155, 31, 0,
143, 23, 0,
127, 15, 0,
115, 7, 0,
95, 0, 0,
71, 0, 0,
47, 0, 0,
27, 0, 0,
239, 0, 0,
55, 55, 255,
255, 0, 0,
0, 0, 255,
43, 43, 35,
27, 27, 23,
19, 19, 15,
235, 151, 127,
195, 115, 83,
159, 87, 51,
123, 63, 27,
235, 211, 199,
199, 171, 155,
167, 139, 119,
135, 107, 87,
159, 91, 83
};
#endif//Q2PAL_H
@@ -0,0 +1,41 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_register.h
//
// Description: Allows the caller to specify user-defined callback functions
// to open files DevIL does not support, to parse files
// differently, or anything else a person can think up.
//
//-----------------------------------------------------------------------------
#ifndef REGISTER_H
#define REGISTER_H
#include "il_internal.h"
typedef struct iFormatL
{
ILstring Ext;
IL_LOADPROC Load;
struct iFormatL *Next;
} iFormatL;
typedef struct iFormatS
{
ILstring Ext;
IL_SAVEPROC Save;
struct iFormatS *Next;
} iFormatS;
#define I_LOAD_FUNC 0
#define I_SAVE_FUNC 1
ILboolean iRegisterLoad(ILconst_string FileName);
ILboolean iRegisterSave(ILconst_string FileName);
#endif//REGISTER_H
+92
View File
@@ -0,0 +1,92 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_rle.h
//
// Description: Functions for run-length encoding
//
//-----------------------------------------------------------------------------
#ifndef RLE_H
#define RLE_H
#include "il_internal.h"
#define TGA_MAX_RUN 128
#define SGI_MAX_RUN 127
#define BMP_MAX_RUN 127
#ifdef IL_RLE_C
#undef NOINLINE
#undef INLINE
#define INLINE
#endif
#ifndef NOINLINE
INLINE ILuint GetPix(ILubyte *p, ILuint bpp) {
ILuint Pixel;
Pixel = (ILuint)*p++;
while( bpp-- > 1 ) {
Pixel <<= 8;
Pixel |= (ILuint)*p++;
}
return Pixel;
}
INLINE ILint CountDiffPixels(ILubyte *p, ILuint bpp, ILuint pixCnt) {
ILuint pixel;
ILuint nextPixel = 0;
ILint n;
n = 0;
if (pixCnt == 1)
return pixCnt;
pixel = GetPix(p, bpp);
while (pixCnt > 1) {
p += bpp;
nextPixel = GetPix(p, bpp);
if (nextPixel == pixel)
break;
pixel = nextPixel;
++n;
--pixCnt;
}
if (nextPixel == pixel)
return n;
return n + 1;
}
INLINE ILint CountSamePixels(ILubyte *p, ILuint bpp, ILuint pixCnt) {
ILuint pixel;
ILuint nextPixel;
ILint n;
n = 1;
pixel = GetPix(p, bpp);
pixCnt--;
while (pixCnt > 0) {
p += bpp;
nextPixel = GetPix(p, bpp);
if (nextPixel != pixel)
break;
++n;
--pixCnt;
}
return n;
}
#endif
ILuint GetPix(ILubyte *p, ILuint bpp);
ILint CountDiffPixels(ILubyte *p, ILuint bpp, ILuint pixCnt);
ILint CountSamePixels(ILubyte *p, ILuint bpp, ILuint pixCnt);
#endif//RLE_H
+66
View File
@@ -0,0 +1,66 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2002 <--Y2K Compliant! =]
//
// Filename: src-IL/include/sgi.h
//
// Description: Reads from and writes to SGI graphics files.
//
//-----------------------------------------------------------------------------
#ifndef SGI_H
#define SGI_H
#include "il_internal.h"
typedef struct iSgiHeader
{
ILshort MagicNum; // IRIS image file magic number
ILbyte Storage; // Storage format
ILbyte Bpc; // Number of bytes per pixel channel
ILushort Dim; // Number of dimensions
// 1: single channel, 1 row with XSize pixels
// 2: single channel, XSize*YSize pixels
// 3: ZSize channels, XSize*YSize pixels
ILushort XSize; // X size in pixels
ILushort YSize; // Y size in pixels
ILushort ZSize; // Number of channels
ILint PixMin; // Minimum pixel value
ILint PixMax; // Maximum pixel value
ILint Dummy1; // Ignored
ILbyte Name[80]; // Image name
ILint ColMap; // Colormap ID
ILbyte Dummy[404]; // Ignored
} IL_PACKSTRUCT iSgiHeader;
// Sgi format #define's
#define SGI_VERBATIM 0
#define SGI_RLE 1
#define SGI_MAGICNUM 474
// Sgi colormap types
#define SGI_COLMAP_NORMAL 0
#define SGI_COLMAP_DITHERED 1
#define SGI_COLMAP_SCREEN 2
#define SGI_COLMAP_COLMAP 3
// Internal functions
ILboolean iIsValidSgi(void);
ILboolean iCheckSgi(iSgiHeader *Header);
ILboolean iLoadSgiInternal(void);
ILboolean iSaveSgiInternal(void);
void iExpandScanLine(ILubyte *Dest, ILubyte *Src, ILuint Bpc);
ILint iGetScanLine(ILubyte *ScanLine, iSgiHeader *Head, ILuint Length);
ILint iGetScanLineFast(ILubyte *ScanLine, iSgiHeader *Head, ILuint Length, ILubyte*);
void sgiSwitchData(ILubyte *Data, ILuint SizeOfData);
ILboolean iNewSgi(iSgiHeader *Head);
ILboolean iReadNonRleSgi(iSgiHeader *Head);
ILboolean iReadRleSgi(iSgiHeader *Head);
ILboolean iSaveRleSgi(ILubyte *Data, ILuint w, ILuint h, ILuint numChannels, ILuint bps);
#endif//SGI_H
@@ -0,0 +1,43 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_stack.h
//
// Description: The main image stack
//
//-----------------------------------------------------------------------------
#ifndef IMAGESTACK_H
#define IMAGESTACK_H
#include "il_internal.h"
// Just a guess...seems large enough
#define I_STACK_INCREMENT 1024
typedef struct iFree
{
ILuint Name;
void *Next;
} iFree;
// Internal functions
ILboolean iEnlargeStack(void);
void iFreeMem(void);
// Globals for il_stack.c
ILuint StackSize = 0;
ILuint LastUsed = 0;
ILuint CurName = 0;
ILimage **ImageStack = NULL;
iFree *FreeNames = NULL;
ILboolean OnExit = IL_FALSE;
ILboolean ParentImage = IL_TRUE;
#endif//IMAGESTACK_H
+399
View File
@@ -0,0 +1,399 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 11/07/2008
//
// Filename: src-IL/src/il_states.h
//
// Description: State machine
//
//-----------------------------------------------------------------------------
#ifndef STATES_H
#define STATES_H
#include "il_internal.h"
ILboolean ilAble(ILenum Mode, ILboolean Flag);
#define IL_ATTRIB_STACK_MAX 32
ILuint ilCurrentPos = 0; // Which position on the stack
//
// Various states
//
typedef struct IL_STATES
{
// Origin states
ILboolean ilOriginSet;
ILenum ilOriginMode;
// Format and type states
ILboolean ilFormatSet;
ILboolean ilTypeSet;
ILenum ilFormatMode;
ILenum ilTypeMode;
// File mode states
ILboolean ilOverWriteFiles;
// Palette states
ILboolean ilAutoConvPal;
// Load fail states
ILboolean ilDefaultOnFail;
// Key colour states
ILboolean ilUseKeyColour;
// Alpha blend states
ILboolean ilBlitBlend;
// Compression states
ILenum ilCompression;
// Interlace states
ILenum ilInterlace;
// Quantization states
ILenum ilQuantMode;
ILuint ilNeuSample;
ILuint ilQuantMaxIndexs;
// DXTC states
ILboolean ilKeepDxtcData;
ILboolean ilUseNVidiaDXT;
ILboolean ilUseSquishDXT;
//
// Format-specific states
//
ILboolean ilTgaCreateStamp;
ILuint ilJpgQuality;
ILboolean ilPngInterlace;
ILboolean ilTgaRle;
ILboolean ilBmpRle;
ILboolean ilSgiRle;
ILenum ilJpgFormat;
ILboolean ilJpgProgressive;
ILenum ilDxtcFormat;
ILenum ilPcdPicNum;
ILint ilPngAlphaIndex; // this index should be treated as an alpha key (most formats use this rather than having alpha in the palette), -1 for none
// currently only used when writing out .png files and should obviously be set to -1 most of the time
ILenum ilVtfCompression;
//
// Format-specific strings
//
char* ilTgaId;
char* ilTgaAuthName;
char* ilTgaAuthComment;
char* ilPngAuthName;
char* ilPngTitle;
char* ilPngDescription;
char* ilTifDescription;
char* ilTifHostComputer;
char* ilTifDocumentName;
char* ilTifAuthName;
char* ilCHeader;
} IL_STATES;
IL_STATES ilStates[IL_ATTRIB_STACK_MAX];
typedef struct IL_HINTS
{
// Memory vs. Speed trade-off
ILenum MemVsSpeedHint;
// Compression hints
ILenum CompressHint;
} IL_HINTS;
IL_HINTS ilHints;
#ifndef IL_NO_BLP
#define IL_BLP_EXT "blp "
#else
#define IL_BLP_EXT ""
#endif
#ifndef IL_NO_BMP
#define IL_BMP_EXT "bmp dib "
#else
#define IL_BMP_EXT ""
#endif
#ifndef IL_NO_CHEAD
#define IL_CHEAD_EXT "h "
#else
#define IL_CHEAD_EXT ""
#endif
#ifndef IL_NO_CUT
#define IL_CUT_EXT "cut "
#else
#define IL_CUT_EXT ""
#endif
#ifndef IL_NO_DCX
#define IL_DCX_EXT "dcx "
#else
#define IL_DCX_EXT ""
#endif
#ifndef IL_NO_DCM
#define IL_DCM_EXT "dicom dcm"
#else
#define IL_DCM_EXT ""
#endif
#ifndef IL_NO_DDS
#define IL_DDS_EXT "dds "
#else
#define IL_DDS_EXT ""
#endif
#ifndef IL_NO_DPX
#define IL_DPX_EXT "dds "
#else
#define IL_DPX_EXT ""
#endif
#ifndef IL_NO_EXR
#define IL_EXR_EXT "exr "
#else
#define IL_EXR_EXT ""
#endif
#ifndef IL_NO_FITS
#define IL_FITS_EXT "fit fits "
#else
#define IL_FITS_EXT ""
#endif
#ifndef IL_NO_FTX
#define IL_FTX_EXT "ftx "
#else
#define IL_FTX_EXT ""
#endif
#ifndef IL_NO_GIF
#define IL_GIF_EXT "gif "
#else
#define IL_GIF_EXT ""
#endif
#ifndef IL_NO_HDR
#define IL_HDR_EXT "hdr "
#else
#define IL_HDR_EXT ""
#endif
#ifndef IL_NO_ICNS
#define IL_ICNS_EXT "icns "
#else
#define IL_ICNS_EXT ""
#endif
#ifndef IL_NO_ICO
#define IL_ICO_EXT "ico cur "
#else
#define IL_ICO_EXT ""
#endif
#ifndef IL_NO_IFF
#define IL_IFF_EXT "iff "
#else
#define IL_IFF_EXT ""
#endif
#ifndef IL_NO_IWI
#define IL_IWI_EXT "iwi "
#else
#define IL_IWI_EXT ""
#endif
#ifndef IL_NO_JP2
#define IL_JP2_EXT "jp2 "
#else
#define IL_JP2_EXT ""
#endif
#ifndef IL_NO_JPG
#define IL_JPG_EXT "jpg jpe jpeg "
#else
#define IL_JPG_EXT ""
#endif
#ifndef IL_NO_LIF
#define IL_LIF_EXT "lif "
#else
#define IL_LIF_EXT ""
#endif
#ifndef IL_NO_MDL
#define IL_MDL_EXT "mdl "
#else
#define IL_MDL_EXT ""
#endif
#ifndef IL_NO_MNG
#define IL_MNG_EXT "mng jng "
#else
#define IL_MNG_EXT ""
#endif
#ifndef IL_NO_MP3
#define IL_MP3_EXT "mp3 "
#else
#define IL_MP3_EXT ""
#endif
#ifndef IL_NO_PCD
#define IL_PCD_EXT "pcd "
#else
#define IL_PCD_EXT ""
#endif
#ifndef IL_NO_PCX
#define IL_PCX_EXT "pcx "
#else
#define IL_PCX_EXT ""
#endif
#ifndef IL_NO_PIC
#define IL_PIC_EXT "pic "
#else
#define IL_PIC_EXT ""
#endif
#ifndef IL_NO_PIX
#define IL_PIX_EXT "pix "
#else
#define IL_PIX_EXT ""
#endif
#ifndef IL_NO_PNG
#define IL_PNG_EXT "png "
#else
#define IL_PNG_EXT ""
#endif
#ifndef IL_NO_PNM
#define IL_PNM_EXT "pbm pgm pnm ppm "
#else
#define IL_PNM_EXT ""
#endif
#ifndef IL_NO_PSD
#define IL_PSD_EXT "psd pdd "
#else
#define IL_PSD_EXT ""
#endif
#ifndef IL_NO_PSP
#define IL_PSP_EXT "psp "
#else
#define IL_PSP_EXT ""
#endif
#ifndef IL_NO_PXR
#define IL_PXR_EXT "pxr "
#else
#define IL_PXR_EXT ""
#endif
#ifndef IL_NO_RAW
#define IL_RAW_EXT "raw "
#else
#define IL_RAW_EXT ""
#endif
#ifndef IL_NO_ROT
#define IL_ROT_EXT "rot "
#else
#define IL_ROT_EXT ""
#endif
#ifndef IL_NO_SGI
#define IL_SGI_EXT "sgi bw rgb rgba "
#else
#define IL_SGI_EXT ""
#endif
#ifndef IL_NO_SUN
#define IL_SUN_EXT "sun ras rs im1 im8 im24 im32 "
#else
#define IL_SUN_EXT ""
#endif
#ifndef IL_NO_TEXTURE
#define IL_TEX_EXT "texture "
#else
#define IL_TEX_EXT ""
#endif
#ifndef IL_NO_TGA
#define IL_TGA_EXT "tga vda icb vst "
#else
#define IL_TGA_EXT ""
#endif
#ifndef IL_NO_TIF
#define IL_TIF_EXT "tif tiff "
#else
#define IL_TIF_EXT ""
#endif
#ifndef IL_NO_TPL
#define IL_TPL_EXT "tpl "
#else
#define IL_TPL_EXT ""
#endif
#ifndef IL_NO_UTX
#define IL_UTX_EXT "utx "
#else
#define IL_UTX_EXT ""
#endif
#ifndef IL_NO_VTF
#define IL_VTF_EXT "vtf "
#else
#define IL_VTF_EXT ""
#endif
#ifndef IL_NO_WAL
#define IL_WAL_EXT "wal "
#else
#define IL_WAL_EXT ""
#endif
#ifndef IL_NO_WBMP
#define IL_WBMP_EXT "wbmp "
#else
#define IL_WBMP_EXT ""
#endif
#ifndef IL_NO_WDP
#define IL_WDP_EXT "wdp "
#else
#define IL_WDP_EXT ""
#endif
#ifndef IL_NO_XPM
#define IL_XPM_EXT "xpm "
#else
#define IL_XPM_EXT ""
#endif
#endif//STATES_H
+109
View File
@@ -0,0 +1,109 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/25/2001 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_targa.h
//
// Description: Targa (.tga) functions
//
//-----------------------------------------------------------------------------
#ifndef TARGA_H
#define TARGA_H
#include "il_internal.h"
#ifdef _MSC_VER
#pragma pack(push, tga_struct, 1)
#elif defined(MACOSX) || defined(__GNUC__)
#pragma pack(1)
#endif
typedef struct TARGAHEAD
{
ILubyte IDLen;
ILubyte ColMapPresent;
ILubyte ImageType;
ILshort FirstEntry;
ILshort ColMapLen;
ILubyte ColMapEntSize;
ILshort OriginX;
ILshort OriginY;
ILushort Width;
ILushort Height;
ILubyte Bpp;
ILubyte ImageDesc;
} IL_PACKSTRUCT TARGAHEAD;
typedef struct TARGAFOOTER
{
ILuint ExtOff; // Extension Area Offset
ILuint DevDirOff; // Developer Directory Offset
ILbyte Signature[16]; // TRUEVISION-XFILE
ILbyte Reserved; // ASCII period '.'
ILbyte NullChar; // NULL
} IL_PACKSTRUCT TARGAFOOTER;
#if defined(MACOSX) || defined(__GNUC__)
#pragma pack()
#elif _MSC_VER
#pragma pack(pop, tga_struct)
#endif
#define TGA_EXT_LEN 495
typedef struct TARGAEXT
{
// Dev Directory
// We don't mess with this
// Extension Area
ILshort Size; // should be TGA_EXT_LEN
ILbyte AuthName[41]; // the image author's name
ILbyte AuthComments[324]; // author's comments
ILshort Month, Day, Year, Hour, Minute, Second; // internal date of file
ILbyte JobID[41]; // the job description (if any)
ILshort JobHour, JobMin, JobSecs; // the job's time
ILbyte SoftwareID[41]; // the software that created this
ILshort SoftwareVer; // the software version number * 100
ILbyte SoftwareVerByte; // the software version letter
ILint KeyColor; // the transparent colour
} TARGAEXT;
// Different Targa formats
#define TGA_NO_DATA 0
#define TGA_COLMAP_UNCOMP 1
#define TGA_UNMAP_UNCOMP 2
#define TGA_BW_UNCOMP 3
#define TGA_COLMAP_COMP 9
#define TGA_UNMAP_COMP 10
#define TGA_BW_COMP 11
// Targa origins
#define IMAGEDESC_ORIGIN_MASK 0x30
#define IMAGEDESC_TOPLEFT 0x20
#define IMAGEDESC_BOTLEFT 0x00
#define IMAGEDESC_BOTRIGHT 0x10
#define IMAGEDESC_TOPRIGHT 0x30
// Internal functions
ILboolean iIsValidTarga();
ILboolean iGetTgaHead(TARGAHEAD *Header);
ILboolean iCheckTarga(TARGAHEAD *Header);
ILboolean iLoadTargaInternal(void);
ILboolean iSaveTargaInternal(void);
//ILvoid iMakeString(char *Str);
ILboolean iReadBwTga(TARGAHEAD *Header);
ILboolean iReadColMapTga(TARGAHEAD *Header);
ILboolean iReadUnmapTga(TARGAHEAD *Header);
ILboolean iUncompressTgaData(ILimage *Image);
ILboolean i16BitTarga(ILimage *Image);
void iGetDateTime(ILuint *Month, ILuint *Day, ILuint *Yr, ILuint *Hr, ILuint *Min, ILuint *Sec);
#endif//TARGA_H
+100
View File
@@ -0,0 +1,100 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 03/02/2009
//
// Filename: src-IL/include/il_utx.h
//
// Description: Reads from an Unreal and Unreal Tournament Texture (.utx) file.
// Specifications can be found at
// http://wiki.beyondunreal.com/Legacy:Package_File_Format.
//
//-----------------------------------------------------------------------------
#ifndef UTX_H
#define UTX_H
#ifdef __cplusplus
extern "C" {
#endif
#include "il_internal.h"
#include "il_dds.h"
#ifdef __cplusplus
}
#endif
#include <memory>
#include <vector>
#include <string>
using namespace std;
typedef struct UTXHEADER
{
ILuint Signature;
ILushort Version;
ILushort LicenseMode;
ILuint Flags;
ILuint NameCount;
ILuint NameOffset;
ILuint ExportCount;
ILuint ExportOffset;
ILuint ImportCount;
ILuint ImportOffset;
} UTXHEADER;
typedef struct UTXENTRYNAME
{
//char *Name;
string Name;
ILuint Flags;
} UTXENTRYNAME;
typedef struct UTXEXPORTTABLE
{
ILint Class;
ILint Super;
ILint Group;
ILint ObjectName;
ILuint ObjectFlags;
ILint SerialSize;
ILint SerialOffset;
ILboolean ClassImported;
ILboolean SuperImported;
ILboolean GroupImported;
} UTXEXPORTTABLE;
typedef struct UTXIMPORTTABLE
{
ILint ClassPackage;
ILint ClassName;
ILint Package;
ILint ObjectName;
ILboolean PackageImported;
} UTXIMPORTTABLE;
class UTXPALETTE
{
public:
UTXPALETTE() { Pal = NULL; }
~UTXPALETTE() { delete [] Pal; }
ILubyte *Pal;
ILuint Count;
ILuint Name;
};
// Data formats
#define UTX_P8 0x00
#define UTX_DXT1 0x03
ILboolean iLoadUtxInternal(void);
#endif//UTX_H
+132
View File
@@ -0,0 +1,132 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2009 by Denton Woods
// Last modified: 02/28/2009
//
// Filename: src-IL/include/il_vtf.h
//
// Description: Reads from and writes to a Valve Texture Format (.vtf) file.
// These are used in Valve's Source games. VTF specs available
// from http://developer.valvesoftware.com/wiki/VTF.
//
//-----------------------------------------------------------------------------
#ifndef VTF_H
#define VTF_H
#include "il_internal.h"
#ifdef _MSC_VER
#pragma pack(push, vtf_struct, 1)
#elif defined(MACOSX) || defined(__GNUC__)
#pragma pack(1)
#endif
typedef struct VTFHEAD
{
ILubyte Signature[4]; // File signature ("VTF\0").
ILuint Version[2]; // version[0].version[1] (currently 7.2).
ILuint HeaderSize; // Size of the header struct (16 byte aligned; currently 80 bytes).
ILushort Width; // Width of the largest mipmap in pixels. Must be a power of 2.
ILushort Height; // Height of the largest mipmap in pixels. Must be a power of 2.
ILuint Flags; // VTF flags.
ILushort Frames; // Number of frames, if animated (1 for no animation).
ILushort FirstFrame; // First frame in animation (0 based).
ILubyte Padding0[4]; // reflectivity padding (16 byte alignment).
ILfloat Reflectivity[3]; // reflectivity vector.
ILubyte Padding1[4]; // reflectivity padding (8 byte packing).
ILfloat BumpmapScale; // Bumpmap scale.
ILuint HighResImageFormat; // High resolution image format.
ILubyte MipmapCount; // Number of mipmaps.
ILuint LowResImageFormat; // Low resolution image format (always DXT1).
ILubyte LowResImageWidth; // Low resolution image width.
ILubyte LowResImageHeight; // Low resolution image height.
ILushort Depth; // Depth of the largest mipmap in pixels.
// Must be a power of 2. Can be 0 or 1 for a 2D texture (v7.2 only).
} IL_PACKSTRUCT VTFHEAD;
#if defined(MACOSX) || defined(__GNUC__)
#pragma pack()
#elif _MSC_VER
#pragma pack(pop, vtf_struct)
#endif
enum
{
IMAGE_FORMAT_NONE = -1,
IMAGE_FORMAT_RGBA8888 = 0,
IMAGE_FORMAT_ABGR8888,
IMAGE_FORMAT_RGB888,
IMAGE_FORMAT_BGR888,
IMAGE_FORMAT_RGB565,
IMAGE_FORMAT_I8,
IMAGE_FORMAT_IA88,
IMAGE_FORMAT_P8,
IMAGE_FORMAT_A8,
IMAGE_FORMAT_RGB888_BLUESCREEN,
IMAGE_FORMAT_BGR888_BLUESCREEN,
IMAGE_FORMAT_ARGB8888,
IMAGE_FORMAT_BGRA8888,
IMAGE_FORMAT_DXT1,
IMAGE_FORMAT_DXT3,
IMAGE_FORMAT_DXT5,
IMAGE_FORMAT_BGRX8888,
IMAGE_FORMAT_BGR565,
IMAGE_FORMAT_BGRX5551,
IMAGE_FORMAT_BGRA4444,
IMAGE_FORMAT_DXT1_ONEBITALPHA,
IMAGE_FORMAT_BGRA5551,
IMAGE_FORMAT_UV88,
IMAGE_FORMAT_UVWQ8888,
IMAGE_FORMAT_RGBA16161616F,
IMAGE_FORMAT_RGBA16161616,
IMAGE_FORMAT_UVLX8888
};
enum
{
TEXTUREFLAGS_POINTSAMPLE = 0x00000001,
TEXTUREFLAGS_TRILINEAR = 0x00000002,
TEXTUREFLAGS_CLAMPS = 0x00000004,
TEXTUREFLAGS_CLAMPT = 0x00000008,
TEXTUREFLAGS_ANISOTROPIC = 0x00000010,
TEXTUREFLAGS_HINT_DXT5 = 0x00000020,
TEXTUREFLAGS_NOCOMPRESS = 0x00000040,
TEXTUREFLAGS_NORMAL = 0x00000080,
TEXTUREFLAGS_NOMIP = 0x00000100,
TEXTUREFLAGS_NOLOD = 0x00000200,
TEXTUREFLAGS_MINMIP = 0x00000400,
TEXTUREFLAGS_PROCEDURAL = 0x00000800,
TEXTUREFLAGS_ONEBITALPHA = 0x00001000,
TEXTUREFLAGS_EIGHTBITALPHA = 0x00002000,
TEXTUREFLAGS_ENVMAP = 0x00004000,
TEXTUREFLAGS_RENDERTARGET = 0x00008000,
TEXTUREFLAGS_DEPTHRENDERTARGET = 0x00010000,
TEXTUREFLAGS_NODEBUGOVERRIDE = 0x00020000,
TEXTUREFLAGS_SINGLECOPY = 0x00040000,
TEXTUREFLAGS_ONEOVERMIPLEVELINALPHA = 0x00080000,
TEXTUREFLAGS_PREMULTCOLORBYONEOVERMIPLEVEL = 0x00100000,
TEXTUREFLAGS_NORMALTODUDV = 0x00200000,
TEXTUREFLAGS_ALPHATESTMIPGENERATION = 0x00400000,
TEXTUREFLAGS_NODEPTHBUFFER = 0x00800000,
TEXTUREFLAGS_NICEFILTERED = 0x01000000,
TEXTUREFLAGS_CLAMPU = 0x02000000
};
// Internal functions
ILboolean iIsValidVtf(void);
ILboolean iGetVtfHead(VTFHEAD *Header);
ILboolean iCheckVtf(VTFHEAD *Header);
ILboolean iLoadVtfInternal(void);
ILboolean VtfInitFacesMipmaps(ILimage *BaseImage, ILuint NumFaces, VTFHEAD *Header);
ILboolean VtfInitMipmaps(ILimage *BaseImage, VTFHEAD *Header);
ILboolean VtfReadData(void);
ILboolean VtfDecompressDXT1(ILimage *Image);
ILboolean VtfDecompressDXT5(ILimage *Image);
ILboolean iSaveVtfInternal(void);
#endif//VTF_H
+188
View File
@@ -0,0 +1,188 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2008 by Denton Woods
// Last modified: 09/26/2008
//
// Filename: src-IL/include/il_hdr.h
//
// Description: Reads a Microsoft HD Photo (.wdp)
//
//-----------------------------------------------------------------------------
#ifndef WDP_H
#define WDP_H
#include "il_internal.h"
//
// Structures
//
typedef struct WDPHEAD
{
ILubyte Encoding[2];
ILubyte UniqueID;
ILubyte Version;
ILuint Offset;
} WDPHEAD;
typedef struct WDPIFD
{
ILushort Tag;
ILushort Type;
ILuint Count;
ILuint ValOff;
ILuint NextOff;
} WDPIFD;
typedef struct WDPGUID
{
ILuint First;
ILushort Second;
ILushort Third;
ILuint Fourth;
ILuint Fifth;
} WDPGUID;
typedef struct WDPIMGHEAD
{
ILuint GDISignature[2];
ILuint Codec;
ILubyte Flags[2];
ILubyte Format;
ILuint Width, Height; // Can either be short or 32-bit int
ILuint VertTiles, HorzTiles; // 12-bits each
ILushort *TileWidth, *TileHeight; // 8 or 16-bits each
ILubyte *TileStretch; // 8-bits each
ILubyte ExtraPixels[3];
} WDPIMGHEAD;
typedef struct WDPIMGPLANE
{
ILubyte Flags1;
ILubyte Color;
ILubyte Bayer;
ILubyte ShiftBits;
ILubyte Mantissa;
ILubyte Expbias;
ILubyte Flags2;
ILubyte NumChannels;
} WDPIMGPLANE;
typedef struct WDPDCQUANT
{
ILubyte ChMode;
ILubyte DcQuant;
ILubyte DcQuantY;
ILubyte DcQuantUV;
ILubyte DcQuantChan;
} WDPDCQUANT;
typedef struct WDPTILE
{
ILuint StartCode;
ILubyte HashAndType;
} WDPTILE;
//
// Image header defines
//
// Codec and sub-codec
#define WDP_CODEC 0xF0
#define WDP_SUBCODEC 0x0F
// First set of flags
#define WDP_TILING_FLAG 0x80
#define WDP_BITSTREAM_FMT 0x40
#define WDP_ORIENTATION 0x38
#define WDP_INDEXTABLE 0x04
#define WDP_OVERLAP 0x03
// Second set of flags
#define WDP_SHORT_HEADER 0x80
#define WDP_LONG_WORD 0x40
#define WDP_WINDOWING 0x20
#define WDP_TRIM_FLEXBITS 0x10
#define WDP_TILE_STRETCH 0x08
#define WDP_ALPHACHANNEL 0x01
// Format and bit-depth
#define WDP_FORMAT 0xF0
#define WDP_BITDEPTH 0x0F
#define WDP_Y_ONLY 0x00
#define WDP_YUV_420 0x01
#define WDP_YUV_422 0x02
#define WDP_YUV_444 0x03
#define WDP_CMYK 0x04
#define WDP_BAYER 0x05
#define WDP_N_CHANNEL 0x06
#define WDP_RGB 0x07
#define WDP_RGBE 0x08
// Bitdepth
#define WDP_BD_1_WHITE 0x00
#define WDP_BD_8 0x01
#define WDP_BD_16 0x02
#define WDP_BD_16S 0x03
#define WDP_BD_16F 0x04
#define WDP_BD_32 0x05
#define WDP_BD_32S 0x06
#define WDP_BD_32F 0x07
#define WDP_BD_5 0x08
#define WDP_BD_10 0x09
#define WDP_BD_565 0x0A
#define WDP_BD_1_BLACK 0x0F
//
// Image plane header defines
//
// First set of flags
#define WDP_CLR_FMT 0xE0
#define WDP_NO_SCALED 0x10
#define WDP_BANDS_PRESENT 0x0F
// Defines for n-channels
#define WDP_NUM_CHANS 0xF0
#define WDP_COLOR_INTERP 0x0F
// Second set of flags
#define WDP_DC_FRAME 0x80
// Channel modes
#define WDP_CH_UNIFORM 0x00
#define WDP_CH_SEPARATE 0x01
#define WDP_CH_INDEPENDENT 0x02
// Tile types
#define WDP_TILE_HASH 0xF8
#define WDP_TILE_TYPE 0x03
#define WDP_SPATIAL_TILE 0x00
#define WDP_DC_TILE 0x01
#define WDP_LOWPASS_TILE 0x02
#define WDP_HIGHPASS_TILE 0x03
#define WDP_FLEXBITS_TILE 0x04
// Bands present
#define WDP_SB_ALL 0x00
#define WDP_SB_NO_FLEXBITS 0x01
#define WDP_SB_NO_HIGHPASS 0x02
#define WDP_SB_DC_ONLY 0x03
#define WDP_SB_ISOLATED 0x04
//
// Internal functions
//
ILboolean iIsValidWdp();
ILboolean iCheckWdp(WDPHEAD *Header);
ILboolean iLoadWdpInternal();
ILuint VLWESC();
#endif//WDP_H