1
//-----------------------------------------------------------------------------
4
// Copyright (C) 2000-2002 by Denton Woods
5
// Last modified: 05/25/2001 <--Y2K Compliant! =]
7
// Filename: src-IL/src/il_utility.c
9
// Description: Utility functions
11
//-----------------------------------------------------------------------------
14
#include "il_internal.h"
17
// Returns the bpp of any Format
18
ILAPI ILubyte ILAPIENTRY ilGetBppFormat(ILenum Format)
26
case IL_LUMINANCE_ALPHA:
41
// Returns the format of any bpp
42
ILAPI ILenum ILAPIENTRY ilGetFormatBpp(ILubyte Bpp)
49
return IL_LUMINANCE_ALPHA;
59
// Returns the bpc of any Type
60
ILAPI ILubyte ILAPIENTRY ilGetBpcType(ILenum Type)
66
case IL_UNSIGNED_BYTE:
70
case IL_UNSIGNED_SHORT:
85
// Returns the type matching a bpc
86
ILAPI ILenum ILAPIENTRY ilGetTypeBpc(ILubyte Bpc)
91
return IL_UNSIGNED_BYTE;
93
return IL_UNSIGNED_SHORT;
95
return IL_UNSIGNED_INT;
103
// Returns the bpp of any palette type (PalType)
104
ILAPI ILubyte ILAPIENTRY ilGetBppPal(ILenum PalType)
125
// Returns the base format of a palette type (PalType)
126
ILAPI ILenum ILAPIENTRY ilGetPalBaseType(ILenum PalType)
133
return IL_RGBA; // Not sure
139
return IL_BGRA; // Not sure
148
// Returns the next power of 2 if Num isn't 2^n or returns Num if Num is 2^n
149
ILAPI ILuint ILAPIENTRY ilNextPower2(ILuint Num)
152
if (Num == 0) return 1;
153
for (; Power2 < Num; Power2 <<= 1);