Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

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(ILvoid *Buffer, ILuint Size, ILuint Number, BITFILE *BitFile);
//ILint bwrite(ILvoid *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

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 ILvoid 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

View File

@@ -0,0 +1,52 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 12/03/2001 <--Y2K Compliant! =]
//
// 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(ILvoid);
ILboolean iCheckDcx(DCXHEAD *Header);
ILboolean iLoadDcxInternal(ILvoid);
ILimage* iUncompressDcx(DCXHEAD *Header);
ILimage* iUncompressDcxSmall(DCXHEAD *Header);
#endif//PCX_H

View File

@@ -0,0 +1,214 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 02/21/2002 <--Y2K Compliant! =]
//
// 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(ILvoid);
ILboolean iIsValidDds(ILvoid);
ILboolean iCheckDds(DDSHEAD *Head);
ILvoid AdjustVolumeTexture(DDSHEAD *Head);
ILboolean ReadData(ILvoid);
ILboolean AllocImage(ILvoid);
ILboolean Decompress(ILvoid);
ILboolean ReadMipmaps(ILvoid);
ILuint DecodePixelFormat(ILvoid);
ILboolean DecompressARGB(ILvoid);
ILboolean DecompressDXT1(ILvoid);
ILboolean DecompressDXT2(ILvoid);
ILboolean DecompressDXT3(ILvoid);
ILboolean DecompressDXT4(ILvoid);
ILboolean DecompressDXT5(ILvoid);
ILboolean Decompress3Dc(ILvoid);
ILboolean DecompressAti1n(ILvoid);
ILboolean DecompressRXGB(ILvoid);
ILboolean DecompressFloat(ILvoid);
ILvoid CorrectPreMult(ILvoid);
ILvoid GetBitsFromMask(ILuint Mask, ILuint *ShiftLeft, ILuint *ShiftRight);
ILboolean iSaveDdsInternal(ILvoid);
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);

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_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

View File

@@ -0,0 +1,377 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 01/29/2002 <--Y2K Compliant! =]
//
// 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__
#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
ILvoid iSwapUShort(ILushort *s);
ILvoid iSwapShort(ILshort *s);
ILvoid iSwapUInt(ILuint *i);
ILvoid iSwapInt(ILint *i);
ILvoid iSwapFloat(ILfloat *f);
ILvoid 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 ILvoid 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) );
#else
*s = ((*s)>>8) | ((*s)<<8);
#endif //GCC_X86_ASM
#endif //USE_WIN32_ASM
}
INLINE ILvoid iSwapShort(ILshort *s) {
iSwapUShort((ILushort*)s);
}
INLINE ILvoid 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 ILvoid iSwapInt(ILint *i) {
iSwapUInt((ILuint*)i);
}
INLINE ILvoid iSwapFloat(ILfloat *f) {
iSwapUInt((ILuint*)f);
}
INLINE ILvoid 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
ILvoid EndianSwapData(void *_Image);
#endif//ENDIAN_H

View File

@@ -0,0 +1,76 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 10/20/2001 <--Y2K Compliant! =]
//
// 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 ILvoid ILAPIENTRY iPreserveReadFuncs(ILvoid);
__FILES_EXTERN ILvoid ILAPIENTRY iRestoreReadFuncs(ILvoid);
__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 ILvoid ILAPIENTRY iDefaultClose(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultGetc(ILHANDLE Handle);
__FILES_EXTERN ILint ILAPIENTRY iDefaultRead(ILvoid *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 ILvoid *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle);
__FILES_EXTERN ILvoid iSetInputFile(ILHANDLE File);
__FILES_EXTERN ILvoid iSetInputLump(const ILvoid *Lump, ILuint Size);
__FILES_EXTERN ILboolean (ILAPIENTRY *ieof)(ILvoid);
__FILES_EXTERN ILHANDLE (ILAPIENTRY *iopenr)(ILconst_string);
__FILES_EXTERN ILvoid (ILAPIENTRY *icloser)(ILHANDLE);
__FILES_EXTERN ILint (ILAPIENTRY *igetc)(ILvoid);
__FILES_EXTERN ILuint (ILAPIENTRY *iread)(ILvoid *Buffer, ILuint Size, ILuint Number);
__FILES_EXTERN ILuint (ILAPIENTRY *iseek)(ILint Offset, ILuint Mode);
__FILES_EXTERN ILuint (ILAPIENTRY *itell)(ILvoid);
__FILES_EXTERN ILvoid iSetOutputFile(ILHANDLE File);
__FILES_EXTERN ILvoid iSetOutputLump(ILvoid *Lump, ILuint Size);
__FILES_EXTERN ILvoid (ILAPIENTRY *iclosew)(ILHANDLE);
__FILES_EXTERN ILHANDLE (ILAPIENTRY *iopenw)(ILconst_string);
__FILES_EXTERN ILint (ILAPIENTRY *iputc)(ILubyte Char);
__FILES_EXTERN ILuint (ILAPIENTRY *iseekw)(ILint Offset, ILuint Mode);
__FILES_EXTERN ILuint (ILAPIENTRY *itellw)(ILvoid);
__FILES_EXTERN ILint (ILAPIENTRY *iwrite)(const ILvoid *Buffer, ILuint Size, ILuint Number);
__FILES_EXTERN ILHANDLE ILAPIENTRY iGetFile(ILvoid);
__FILES_EXTERN const ILubyte* ILAPIENTRY iGetLump(ILvoid);
__FILES_EXTERN ILuint ILAPIENTRY ilprintf(const char *, ...);
__FILES_EXTERN ILvoid ipad(ILuint NumZeros);
__FILES_EXTERN ILboolean iPreCache(ILuint Size);
__FILES_EXTERN ILvoid iUnCache(ILvoid);
#endif//FILES_H

View File

@@ -0,0 +1,71 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/18/2002 <--Y2K Compliant! =]
//
// 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(ILvoid);
ILboolean ilLoadGifF(ILHANDLE File);
ILboolean iIsValidGif(ILvoid);
ILboolean iGetPalette(ILubyte Info, ILpal *Pal);
ILboolean GetImages(ILpal *GlobalPal, GIFHEAD *GifHead);
ILboolean SkipExtensions(GFXCONTROL *Gfx);
ILboolean GifGetData(ILubyte *Data, ILuint ImageSize, ILuint Width, ILuint Height, ILuint Stride, GFXCONTROL *Gfx);
ILboolean RemoveInterlace(ILimage *image);
ILboolean iCopyPalette(ILpal *Dest, ILpal *Src);
ILboolean ConvertTransparent(ILimage *Image, ILubyte TransColour);

View File

@@ -0,0 +1,42 @@
//-----------------------------------------------------------------------------
//
// 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();
ILvoid ReadScanline(ILubyte *scanline, ILuint w);
#endif//HDR_H

View File

@@ -0,0 +1,71 @@
//-----------------------------------------------------------------------------
//
// 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"
ILboolean iLoadIconInternal();
#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
#endif//ICON_H

View File

@@ -0,0 +1,380 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 02/19/2002 <--Y2K Compliant! =]
//
// Filename: src-IL/include/il_internal.h
//
// Description: Internal stuff for DevIL
//
//-----------------------------------------------------------------------------
#ifndef INTERNAL_H
#define INTERNAL_H
#define _IL_BUILD_LIBRARY
// Standard headers
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
// Local headers
#if defined(_WIN32) && !defined(HAVE_CONFIG_H)
#define HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
#include <IL/config.h>
#endif
#include <IL/il.h>
#include <IL/devil_internal_exports.h>
#include "il_files.h"
#include "il_endian.h"
// 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 // Erroneous size_t conversion warnings
pragma warning(disable : 4267)
#endif
pragma comment(linker, "/NODEFAULTLIB:libc")
pragma comment(linker, "/NODEFAULTLIB:libcd")
pragma comment(linker, "/NODEFAULTLIB:libcmt.lib")
#ifdef _DEBUG
pragma comment(linker, "/NODEFAULTLIB:libcmtd")
pragma comment(linker, "/NODEFAULTLIB:msvcrt.lib")
#endif // _DEBUG
*/
#endif // _MSC_VER > 1000
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#endif
// Windows has a TEXT macro defined in WinNT.h that makes string Unicode if UNICODE is defined.
/*#ifndef _WIN32
#define IL_TEXT(s) s
#endif*/
/*#ifdef _WIN32_WCE
#define IL_TEXT(s) ((char*)TEXT(s))
#elif _WIN32
#define IL_TEXT(s) (s)
#else
#define IL_TEXT(s) (s)
#define TEXT(s) (s)
#endif*/
#ifdef _UNICODE
#define IL_TEXT(s) L##s
#else
#define IL_TEXT(s) (s)
#endif
#ifdef IL_INLINE_ASM
#ifdef _MSC_VER // MSVC++ only
#define 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
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);
char* ilStrDup(const char *Str);
ILuint ilStrLen(const char *Str);
// Miscellaneous functions
ILvoid ilDefaultStates(ILvoid);
ILenum iGetHint(ILenum Target);
ILint iGetInt(ILenum Mode);
ILvoid ilRemoveRegistered(ILvoid);
ILAPI ILvoid ILAPIENTRY ilSetCurImage(ILimage *Image);
//
// 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);
ILvoid iSetImage0(ILvoid);
// Conversion functions
ILboolean ilAddAlpha(ILvoid);
ILboolean ilAddAlphaKey(ILimage *Image);
ILboolean iFastConvert(ILenum DestFormat);
ILboolean ilFixImage(ILvoid);
ILboolean ilRemoveAlpha(ILvoid);
ILboolean ilSwapColours(ILvoid);
// Miscellaneous functions
char *iGetString(ILenum StringName); // Internal version of ilGetString
// Library usage
#if _MSC_VER && !_WIN32_WCE
#ifndef IL_NO_JPG
#ifdef IL_USE_IJL
//pragma comment(lib, "ijl15.lib")
#else
#ifndef IL_DEBUG
//pragma comment(lib, "libjpeg.lib")
#else
//ragma comment(lib, "debug/libjpeg.lib")
#endif
#endif
#endif
#ifndef IL_NO_MNG
#ifndef IL_DEBUG
//pragma comment(lib, "libmng.lib")
//pragma comment(lib, "libjpeg.lib") // For JNG support.
#else
//pragma comment(lib, "debug/libmng.lib")
//pragma comment(lib, "debug/libjpeg.lib") // For JNG support.
#endif
#endif
#ifndef IL_NO_PNG
#ifndef IL_DEBUG
//pragma comment(lib, "libpng.lib")
#else
//pragma comment(lib, "debug/libpng.lib")
#endif
#endif
#ifndef IL_NO_TIF
#ifndef IL_DEBUG
//pragma comment(lib, "libtiff.lib")
#else
//pragma comment(lib, "debug/libtiff.lib")
#endif
#endif
#if !defined(IL_NO_MNG) || !defined(IL_NO_PNG)
#ifndef IL_DEBUG
//pragma comment(lib, "zlib.lib")
#else
//pragma comment(lib, "debug/zlib.lib")
#endif
#endif
#endif
//
// Image loading/saving functions
//
ILboolean ilIsValidBmp(ILconst_string FileName);
ILboolean ilIsValidBmpF(ILHANDLE File);
ILboolean ilIsValidBmpL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadBmp(ILconst_string FileName);
ILboolean ilLoadBmpF(ILHANDLE File);
ILboolean ilLoadBmpL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveBmp(ILconst_string FileName);
ILboolean ilSaveBmpF(ILHANDLE File);
ILboolean ilSaveBmpL(ILvoid *Lump, ILuint Size);
ILboolean ilSaveCHeader(ILconst_string FileName, const char *InternalName);
ILboolean ilLoadCut(ILconst_string FileName);
ILboolean ilLoadCutF(ILHANDLE File);
ILboolean ilLoadCutL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidDcx(ILconst_string FileName);
ILboolean ilIsValidDcxF(ILHANDLE File);
ILboolean ilIsValidDcxL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadDcx(ILconst_string FileName);
ILboolean ilLoadDcxF(ILHANDLE File);
ILboolean ilLoadDcxL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidDds(ILconst_string FileName);
ILboolean ilIsValidDdsF(ILHANDLE File);
ILboolean ilIsValidDdsL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadDds(ILconst_string FileName);
ILboolean ilLoadDdsF(ILHANDLE File);
ILboolean ilLoadDdsL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveDds(ILconst_string FileName);
ILboolean ilSaveDdsF(ILHANDLE File);
ILboolean ilSaveDdsL(ILvoid *Lump, ILuint Size);
ILboolean ilLoadDoom(ILconst_string FileName);
ILboolean ilLoadDoomF(ILHANDLE File);
ILboolean ilLoadDoomL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadDoomFlat(ILconst_string FileName);
ILboolean ilLoadDoomFlatF(ILHANDLE File);
ILboolean ilLoadDoomFlatL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidGif(ILconst_string FileName);
ILboolean ilIsValidGifF(ILHANDLE File);
ILboolean ilIsValidGifL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadGif(ILconst_string FileName);
ILboolean ilLoadGifF(ILHANDLE File);
ILboolean ilLoadGifL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidHdr(ILconst_string FileName);
ILboolean ilIsValidHdrF(ILHANDLE File);
ILboolean ilIsValidHdrL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadHdr(ILconst_string FileName);
ILboolean ilLoadHdrF(ILHANDLE File);
ILboolean ilLoadHdrL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadIcon(ILconst_string FileName);
ILboolean ilLoadIconF(ILHANDLE File);
ILboolean ilLoadIconL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidJpg(ILconst_string FileName);
ILboolean ilIsValidJpgF(ILHANDLE File);
ILboolean ilIsValidJpgL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadJpeg(ILconst_string FileName);
ILboolean ilLoadJpegF(ILHANDLE File);
ILboolean ilLoadJpegL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveJpeg(ILconst_string FileName);
ILboolean ilSaveJpegF(ILHANDLE File);
ILboolean ilSaveJpegL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidLif(ILconst_string FileName);
ILboolean ilIsValidLifF(ILHANDLE File);
ILboolean ilIsValidLifL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadLif(ILconst_string FileName);
ILboolean ilLoadLifF(ILHANDLE File);
ILboolean ilLoadLifL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadMdl(ILconst_string FileName);
ILboolean ilLoadMdlF(ILHANDLE File);
ILboolean ilLoadMdlL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadMng(ILconst_string FileName);
ILboolean ilLoadMngF(ILHANDLE File);
ILboolean ilLoadMngL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveMng(ILconst_string FileName);
ILboolean ilSaveMngF(ILHANDLE File);
ILboolean ilSaveMngL(ILvoid *Lump, ILuint Size);
ILboolean ilLoadPcd(ILconst_string FileName);
ILboolean ilLoadPcdF(ILHANDLE File);
ILboolean ilLoadPcdL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPcx(ILconst_string FileName);
ILboolean ilIsValidPcxF(ILHANDLE File);
ILboolean ilIsValidPcxL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPcx(ILconst_string FileName);
ILboolean ilLoadPcxF(ILHANDLE File);
ILboolean ilLoadPcxL(const ILvoid *Lump, ILuint Size);
ILboolean ilSavePcx(ILconst_string FileName);
ILboolean ilSavePcxF(ILHANDLE File);
ILboolean ilSavePcxL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPic(ILconst_string FileName);
ILboolean ilIsValidPicF(ILHANDLE File);
ILboolean ilIsValidPicL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPic(ILconst_string FileName);
ILboolean ilLoadPicF(ILHANDLE File);
ILboolean ilLoadPicL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPix(ILconst_string FileName);
ILboolean ilLoadPixF(ILHANDLE File);
ILboolean ilLoadPixL(const ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPng(ILconst_string FileName);
ILboolean ilIsValidPngF(ILHANDLE File);
ILboolean ilIsValidPngL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPng(ILconst_string FileName);
ILboolean ilLoadPngF(ILHANDLE File);
ILboolean ilLoadPngL(const ILvoid *Lump, ILuint Size);
ILboolean ilSavePng(ILconst_string FileName);
ILboolean ilSavePngF(ILHANDLE File);
ILboolean ilSavePngL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPnm(ILconst_string FileName);
ILboolean ilIsValidPnmF(ILHANDLE File);
ILboolean ilIsValidPnmL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPnm(ILconst_string FileName);
ILboolean ilLoadPnmF(ILHANDLE File);
ILboolean ilLoadPnmL(const ILvoid *Lump, ILuint Size);
ILboolean ilSavePnm(ILconst_string FileName);
ILboolean ilSavePnmF(ILHANDLE File);
ILboolean ilSavePnmL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPsd(ILconst_string FileName);
ILboolean ilIsValidPsdF(ILHANDLE File);
ILboolean ilIsValidPsdL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPsd(ILconst_string FileName);
ILboolean ilLoadPsdF(ILHANDLE File);
ILboolean ilLoadPsdL(const ILvoid *Lump, ILuint Size);
ILboolean ilSavePsd(ILconst_string FileName);
ILboolean ilSavePsdF(ILHANDLE File);
ILboolean ilSavePsdL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidPsp(ILconst_string FileName);
ILboolean ilIsValidPspF(ILHANDLE File);
ILboolean ilIsValidPspL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPsp(ILconst_string FileName);
ILboolean ilLoadPspF(ILHANDLE File);
ILboolean ilLoadPspL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadPxr(ILconst_string FileName);
ILboolean ilLoadPxrF(ILHANDLE File);
ILboolean ilLoadPxrL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadRaw(ILconst_string FileName);
ILboolean ilLoadRawF(ILHANDLE File);
ILboolean ilLoadRawL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveRaw(ILconst_string FileName);
ILboolean ilSaveRawF(ILHANDLE File);
ILboolean ilSaveRawL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidSgi(ILconst_string FileName);
ILboolean ilIsValidSgiF(ILHANDLE File);
ILboolean ilIsValidSgiL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadSgi(ILconst_string FileName);
ILboolean ilLoadSgiF(ILHANDLE File);
ILboolean ilLoadSgiL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveSgi(ILconst_string FileName);
ILboolean ilSaveSgiF(ILHANDLE File);
ILboolean ilSaveSgiL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidTga(ILconst_string FileName);
ILboolean ilIsValidTgaF(ILHANDLE File);
ILboolean ilIsValidTgaL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadTarga(ILconst_string FileName);
ILboolean ilLoadTargaF(ILHANDLE File);
ILboolean ilLoadTargaL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveTarga(ILconst_string FileName);
ILboolean ilSaveTargaF(ILHANDLE File);
ILboolean ilSaveTargaL(ILvoid *Lump, ILuint Size);
ILboolean ilIsValidTiff(ILconst_string FileName);
ILboolean ilIsValidTiffF(ILHANDLE File);
ILboolean ilIsValidTiffL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadTiff(ILconst_string FileName);
ILboolean ilLoadTiffF(ILHANDLE File);
ILboolean ilLoadTiffL(const ILvoid *Lump, ILuint Size);
ILboolean ilSaveTiff(ILconst_string FileName);
ILboolean ilSaveTiffF(ILHANDLE File);
ILboolean ilSaveTiffL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadWal(ILconst_string FileName);
ILboolean ilLoadWalF(ILHANDLE File);
ILboolean ilLoadWalL(const ILvoid *Lump, ILuint Size);
ILboolean ilLoadXpm(ILconst_string FileName);
ILboolean ilLoadXpmF(ILHANDLE File);
ILboolean ilLoadXpmL(const ILvoid *Lump, ILuint Size);
#endif//INTERNAL_H

View File

@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 02/16/2002 <--Y2K Compliant! =]
//
// 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(ILvoid);
#ifndef IL_USE_IJL
ILboolean iLoadJpegInternal(ILvoid);
ILboolean iSaveJpegInternal(ILvoid);
#else
ILboolean iLoadJpegInternal(ILconst_string FileName, ILvoid *Lump, ILuint Size);
ILboolean iSaveJpegInternal(ILconst_string FileName, ILvoid *Lump, ILuint Size);
#endif
#endif//JPEG_H

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(ILvoid);
ILboolean iCheckLif(LIF_HEAD *Header);
ILboolean iLoadLifInternal(ILvoid);
#endif//LIF_H

View File

@@ -0,0 +1,242 @@
//-----------------------------------------------------------------------------
//
// 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(ILvoid);
ILboolean ilMirrorImage(ILvoid); //@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
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;
}
//-----------------------------------------------------
// 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);
}
}
//stolen 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

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

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

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(ILvoid);
ILboolean iCheckPcx(PCXHEAD *Header);
ILboolean iLoadPcxInternal(ILvoid);
ILboolean iSavePcxInternal(ILvoid);
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

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;
ILvoid *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(ILvoid);
ILboolean iCheckPic(PIC_HEAD *Header);
ILboolean iLoadPicInternal(ILvoid);
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

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(ILvoid);
ILboolean iCheckPnm(char Header[2]);
ILboolean iLoadPnmInternal(ILvoid);
ILboolean iSavePnmInternal(ILvoid);
ILimage *ilReadAsciiPpm(PPMINFO *Info);
ILimage *ilReadBinaryPpm(PPMINFO *Info);
ILimage *ilReadBitPbm(PPMINFO *Info);
ILboolean iGetWord(ILvoid);
ILvoid PbmMaximize(ILimage *Image);
#endif//PPMPGM_H

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(ILvoid);
ILboolean iCheckPsd(PSDHEAD *Header);
ILboolean iLoadPsdInternal(ILvoid);
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, ILvoid *Buffer, ILboolean Compressed);
ILboolean ParseResources(ILuint ResourceSize, ILubyte *Resources);
ILboolean GetSingleChannel(PSDHEAD *Head, ILubyte *Buffer, ILboolean Compressed);
ILboolean iSavePsdInternal(ILvoid);
#endif//PSD_H

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(ILvoid);
ILboolean iCheckPsp(ILvoid);
ILboolean iIsValidPsp(ILvoid);
ILboolean ReadGenAttributes(ILvoid);
ILboolean ParseChunks(ILvoid);
ILboolean ReadLayerBlock(ILuint BlockLen);
ILboolean ReadAlphaBlock(ILuint BlockLen);
ILubyte *GetChannel(ILvoid);
ILboolean UncompRLE(ILubyte *CompData, ILubyte *Data, ILuint CompLen);
ILboolean ReadPalette(ILuint BlockLen);
ILboolean AssembleImage(ILvoid);
ILboolean Cleanup(ILvoid);
#endif//PSP_H

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

View File

@@ -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

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

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(ILvoid);
ILboolean iCheckSgi(iSgiHeader *Header);
ILboolean iLoadSgiInternal(ILvoid);
ILboolean iSaveSgiInternal(ILvoid);
ILvoid iExpandScanLine(ILubyte *Dest, ILubyte *Src, ILuint Bpc);
ILint iGetScanLine(ILubyte *ScanLine, iSgiHeader *Head, ILuint Length);
ILint iGetScanLineFast(ILubyte *ScanLine, iSgiHeader *Head, ILuint Length, ILubyte*);
ILvoid 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

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_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(ILvoid);
ILvoid iFreeMem(ILvoid);
// 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

View File

@@ -0,0 +1,266 @@
//-----------------------------------------------------------------------------
//
// ImageLib Sources
// Copyright (C) 2000-2002 by Denton Woods
// Last modified: 05/24/2001 <--Y2K Compliant! =]
//
// 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;
// Compression states
ILenum ilCompression;
// Interlace states
ILenum ilInterlace;
// Quantization states
ILenum ilQuantMode;
ILuint ilNeuSample;
ILuint ilQuantMaxIndexs;
// DXTC states
ILboolean ilKeepDxtcData;
//
// Format-specific states
//
ILboolean ilTgaCreateStamp;
ILuint ilJpgQuality;
ILboolean ilPngInterlace;
ILboolean ilTgaRle;
ILboolean ilBmpRle;
ILboolean ilSgiRle;
ILenum ilJpgFormat;
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
//
// 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_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_DDS
#define IL_DDS_EXT "dds "
#else
#define IL_DDS_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_ICO
#define IL_ICO_EXT "ico cur "
#else
#define IL_ICO_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_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_SGI
#define IL_SGI_EXT "sgi bw rgb rgba "
#else
#define IL_SGI_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_WAL
#define IL_WAL_EXT "wal "
#else
#define IL_WAL_EXT ""
#endif
#ifndef IL_NO_XPM
#define IL_XPM_EXT "xpm "
#else

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(ILvoid);
ILboolean iSaveTargaInternal(ILvoid);
//ILvoid iMakeString(char *Str);
ILboolean iReadBwTga(TARGAHEAD *Header);
ILboolean iReadColMapTga(TARGAHEAD *Header);
ILboolean iReadUnmapTga(TARGAHEAD *Header);
ILboolean iUncompressTgaData(ILimage *Image);
ILboolean i16BitTarga(ILimage *Image);
ILvoid iGetDateTime(ILuint *Month, ILuint *Day, ILuint *Yr, ILuint *Hr, ILuint *Min, ILuint *Sec);
#endif//TARGA_H