"L. Spiro Engine"
|
The main class that holds loaded image information. More...
#include <LSIImage.h>
Classes | |
union | LSI_BLOCK |
struct | LSI_DXT_THREAD_DATA |
struct | LSI_SORTED_PIXEL |
Public Types | |
enum | LSI_COMPRESSIONS { LSI_C_RAWCOMPRESSION, LSI_C_CHANNELCOMPRESSION, LSI_C_RLECOMPRESSION, LSI_C_INDEXCOMPRESSION, LSI_C_DTXCOMPRESSION } |
Public Member Functions | |
LSE_CALLCTOR | CImage (const CImage &_iOther) |
CImage &LSE_CALL | operator= (const CImage &_iOther) |
LSVOID LSE_CALL | SetAllocator (CAllocator *_paAllocator) |
LSVOID LSE_CALL | Reset () |
LSE_INLINE LSUINT32 LSE_CALL | GetWidth () const |
LSE_INLINE LSUINT32 LSE_CALL | GetHeight () const |
LSE_INLINE LSI_PIXEL_FORMAT LSE_CALL | GetFormat () const |
LSE_INLINE const LSVOID *LSE_CALL | GetBufferData () const |
LSE_INLINE const CImageLib::CTexelBuffer &LSE_CALL | GetBufferDataAsVector () const |
LSE_INLINE const CVector < CImageLib::CTexelBuffer > &LSE_CALL | GetMipMapBuffers () const |
LSE_INLINE LSUINT32 LSE_CALL | TotalMipLevels () const |
LSE_INLINE const CImageLib::CTexelBuffer &LSE_CALL | GetMipMapBuffers (LSUINT32 _ui32Level) const |
LSBOOL LSE_CALL | LoadFileFromMemory (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen) |
LSBOOL LSE_CALL | LoadFile (const LSCHAR *_pcFile) |
LSBOOL LSE_CALL | CreateBlank (LSI_PIXEL_FORMAT _pfFormat, LSUINT32 _ui32Width, LSUINT32 _ui32Height) |
LSBOOL LSE_CALL | CreateFromRgbAndAlpha (const CImage &_iRgb, const CImage &_iAlpha) |
LSE_INLINE LSUINT64 LSE_CALL | GetTexelAt (LSI_PIXEL_FORMAT _pfFormat, LSUINT32 _ui32X, LSUINT32 _ui32Y) const |
LSE_INLINE LSVOID LSE_CALL | SetTexelAt (LSUINT64 _ui64Texel, LSI_PIXEL_FORMAT _pfFormat, LSUINT32 _ui32X, LSUINT32 _ui32Y) |
LSBOOL LSE_CALL | CompressToBuffer (CMisc::LSC_BUFFER &_bBuffer) |
LSVOID LSE_CALL | Flip () |
LSVOID LSE_CALL | ConvertToFormat (LSI_PIXEL_FORMAT _pfFormat, CImage &_iDest) const |
CImage &LSE_CALL | ConvertToFormatInPlace (LSI_PIXEL_FORMAT _pfFormat) |
LSBOOL LSE_CALL | Resample (LSUINT32 _ui32NewWidth, LSUINT32 _ui32NewHeight, LSI_FILTER _fFilter, CImage &_iDest, LSFLOAT _fSrcGamma=2.2f, LSFLOAT _fFilterScale=1.0f) const |
LSBOOL LSE_CALL | ResampleInPlace (LSUINT32 _ui32NewWidth, LSUINT32 _ui32NewHeight, LSI_FILTER _fFilter, LSFLOAT _fSrcGamma=2.2f, LSFLOAT _fFilterScale=1.0f) |
LSUINT32 LSE_CALL | GetCrc32 () const |
LSUINT32 LSE_CALL | GetCrc32Alt () const |
LSVOID LSE_CALL | ConvertToNormalMap (LSFLOAT _fStr, LSBOOL _bWrapX=true, LSBOOL _bWrapY=true) |
LSBOOL LSE_CALL | ConvertToDds (LSI_PIXEL_FORMAT _pfFormat, CImage &_iDst) |
LSBOOL LSE_CALL | ConvertToDdsInPlace (LSI_PIXEL_FORMAT _pfFormat) |
LSBOOL LSE_CALL | IsBlackAndWhite () const |
Protected Types | |
enum | { LSI_LINEAR_TO_SRGB_TABLE_SIZE = 4096 } |
typedef struct lsi::CImage::LSI_SORTED_PIXEL * | LPLSI_SORTED_PIXEL |
typedef struct lsi::CImage::LSI_SORTED_PIXEL | LPCLSI_SORTED_PIXEL |
typedef union lsi::CImage::LSI_BLOCK * | LPLSI_BLOCK |
typedef union lsi::CImage::LSI_BLOCK | LPCLSI_BLOCK |
typedef struct lsi::CImage::LSI_DXT_THREAD_DATA * | LPLSI_DXT_THREAD_DATA |
typedef struct lsi::CImage::LSI_DXT_THREAD_DATA | LPCLSI_DXT_THREAD_DATA |
Protected Member Functions | |
LSVOID LSE_CALL | PostLoad () |
LSBOOL LSE_CALL | CompressChannels (CMisc::LSC_BUFFER &_bBuffer, LSUINT32 _ui32MaxSize=~0UL) |
LSBOOL LSE_CALL | CompressRaw (CMisc::LSC_BUFFER &_bBuffer, LSUINT32 _ui32MaxSize=~0UL) |
LSBOOL LSE_CALL | CompressRle (CMisc::LSC_BUFFER &_bBuffer, LSUINT32 _ui32MaxSize=~0UL) |
LSBOOL LSE_CALL | CompressIndex (CMisc::LSC_BUFFER &_bBuffer, LSUINT32 _ui32MaxSize=~0UL) |
LSBOOL LSE_CALL | CompressDxt (CMisc::LSC_BUFFER &_bBuffer) |
LSBOOL LSE_CALL | LoadCompressedChannels (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, CImageLib::CTexelBuffer &_tbOut) |
LSBOOL LSE_CALL | LoadCompressedRaw (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, CImageLib::CTexelBuffer &_tbOut) |
LSBOOL LSE_CALL | LoadCompressedBitwiseRle (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, CImageLib::CTexelBuffer &_tbOut) |
LSBOOL LSE_CALL | LoadCompressedIndices (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, CImageLib::CTexelBuffer &_tbOut) |
LSBOOL LSE_CALL | LoadDxt (LSUINT8 _ui8MipLevels, const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, CImageLib::CTexelBuffer &_tbOut, CVector< CImageLib::CTexelBuffer > &_vMipMaps) |
LSBOOL LSE_CALL | LoadLsi (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen) |
Static Protected Member Functions | |
static LSVOID LSE_CALL | GetKeyColors (const LSI_BLOCK _bBlock[4][4], LSI_BLOCK &_bMax, LSI_BLOCK &_bMin, LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSFLOAT _fAlphaHigh, LSFLOAT _fAlphaLow, LSI_PIXEL_FORMAT _pfFormat) |
static LSVOID LSE_CALL | RefineKeyColors (const CMap< LSFLOAT, LSUINT32 > _bUniqueValues[4], const CMap< LSI_BLOCK, LSUINT32 > &_bUniqueColors, const LSI_BLOCK _bBlock[4][4], LSI_BLOCK &_bMax, LSI_BLOCK &_bMin, LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSUINT32 _ui32Iters, LSFLOAT _fAlphaHigh, LSFLOAT _fAlphaLow, LSI_PIXEL_FORMAT _pfFormat) |
static LSVOID LSE_CALL | Get4Colors (const LSI_BLOCK &_bMax, const LSI_BLOCK &_bMin, LSI_BLOCK _bRet[4], LSBOOL _bOmitLast) |
static LSVOID LSE_CALL | Get4Colors (LSUINT32 _ui32Channel, const LSI_BLOCK &_bMax, const LSI_BLOCK &_bMin, LSFLOAT _fRet[4], LSBOOL _bOmitLast) |
static LSVOID LSE_CALL | MakeDxt1Block (const LSI_BLOCK _bBlock[4][4], const LSI_BLOCK &_bMax, const LSI_BLOCK &_bMin, LSUINT8 *_pui8Return) |
static LSUINT32 LSE_CALL | FindDxt1Match (const LSI_BLOCK &_bColor0, const LSI_BLOCK &_bColor1, const LSI_BLOCK &_bColor) |
static LSE_INLINE LSFLOAT LSE_CALL | GetError (const LSI_BLOCK &_bColor0, const LSI_BLOCK &_bColor1) |
static LSFLOAT LSE_CALL | GetError (const CMap< LSI_BLOCK, LSUINT32 > &_bUniqueColors, const LSI_BLOCK &_bMax, const LSI_BLOCK &_bMin, LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSBOOL _bOmitLast, LSFLOAT _fCurError) |
static LSFLOAT LSE_CALL | GetErrorStrict (const LSI_BLOCK _bBlock[4][4], const LSI_BLOCK &_bMax, const LSI_BLOCK &_bMin, LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSBOOL _bOmitLast) |
static LSE_INLINE LSFLOAT LSE_CALL | GetError (LSUINT32 _ui32Channel, const LSI_BLOCK _bBlocks[4], const LSI_BLOCK &_bSrc, LSUINT32 &_ui32Index, LSBOOL _bOmitLast) |
static LSE_INLINE LSFLOAT LSE_CALL | GetError (LSUINT32 _ui32Channel, const LSI_BLOCK _bBlocks[4], LSFLOAT _fValue, LSUINT32 &_ui32Index, LSBOOL _bOmitLast) |
static LSE_INLINE LSUINT16 LSE_CALL | ConvertBlockTexelTo16Bit (const LSI_BLOCK &_bColor) |
static LSE_INLINE LSI_BLOCK LSE_CALL | Convert16BitToBlockTexel (LSUINT16 _ui16Color) |
static LSE_INLINE LSBOOL LSE_CALL | Offset16BitColorChannel (LSUINT32 _ui32Channel, LSINT32 _i32Amount, LSUINT16 &_ui16Color) |
static LSVOID LSE_CALL | FindEndPoints (LSFLOAT _fEndPoint, LSFLOAT _fMidPoint, LSUINT32 _ui32EndIndex, LSUINT32 _ui32MidIndex, LSUINT32 _ui32Points, LSFLOAT _fRes, LSFLOAT &_fLow, LSFLOAT &_fHigh) |
static LSE_INLINE LSFLOAT LSE_CALL | Round (LSFLOAT _fValue, LSFLOAT _fRes) |
static LSUINT32 LSH_CALL | DxtThread (LSVOID *_lpParameter) |
Protected Attributes | |
CImageLib::CTexelBuffer | m_tbBuffer |
CVector< CImageLib::CTexelBuffer > | m_vMipMapBuffer |
LSUINT32 | m_ui32Width |
LSUINT32 | m_ui32Height |
LSI_PIXEL_FORMAT | m_pfFormat |
LSUINT32 | m_ui32RowWidth |
LSUINT32 | m_ui32TexelSize |
The main class that holds loaded image information.
Class CImage Description: The main class that holds loaded image information.
typedef union lsi::CImage::LSI_BLOCK * lsi::CImage::LPLSI_BLOCK [protected] |
A block of texels for DDS encoding.
typedef struct lsi::CImage::LSI_DXT_THREAD_DATA * lsi::CImage::LPLSI_DXT_THREAD_DATA [protected] |
Thread data for converting blocks to DXTn.
typedef struct lsi::CImage::LSI_SORTED_PIXEL * lsi::CImage::LPLSI_SORTED_PIXEL [protected] |
For sorting pixels. Used when creating index tables.
anonymous enum [protected] |
Compression types.
LSBOOL LSE_CALL lsi::CImage::CompressChannels | ( | CMisc::LSC_BUFFER & | _bBuffer, |
LSUINT32 | _ui32MaxSize = ~0UL |
||
) | [protected] |
Compress this texture by grouping the reds, greens, blues, and alphas together and compressing them separately.
_bBuffer | The output buffer where the compressed data will be stored. |
_ui32MaxSize | Buffer Size after which compression automatically fails. |
LSBOOL LSE_CALL lsi::CImage::CompressDxt | ( | CMisc::LSC_BUFFER & | _bBuffer | ) | [protected] |
Compress an image that is already in DXT format. Simply uses LZW on the compressed data.
_bBuffer | The output buffer where the compressed data will be stored. |
LSBOOL LSE_CALL lsi::CImage::CompressIndex | ( | CMisc::LSC_BUFFER & | _bBuffer, |
LSUINT32 | _ui32MaxSize = ~0UL |
||
) | [protected] |
Compress this texture by creating indexed data. The index table and indexed data are then further compressed.
_bBuffer | The output buffer where the compressed data will be stored. |
_ui32MaxSize | Buffer Size after which compression automatically fails. |
LSBOOL LSE_CALL lsi::CImage::CompressRaw | ( | CMisc::LSC_BUFFER & | _bBuffer, |
LSUINT32 | _ui32MaxSize = ~0UL |
||
) | [protected] |
Compress this texture by just performing a raw compression of the data.
_bBuffer | The output buffer where the compressed data will be stored. |
_ui32MaxSize | Buffer Size after which compression automatically fails. |
LSBOOL LSE_CALL lsi::CImage::CompressRle | ( | CMisc::LSC_BUFFER & | _bBuffer, |
LSUINT32 | _ui32MaxSize = ~0UL |
||
) | [protected] |
Compress this texture by using RLE encoding. The RLE data is also compressed.
_bBuffer | The output buffer where the compressed data will be stored. |
_ui32MaxSize | Buffer Size after which compression automatically fails. |
LSBOOL LSE_CALL lsi::CImage::CompressToBuffer | ( | CMisc::LSC_BUFFER & | _bBuffer | ) |
Compress this texture to a buffer. All compressions are tested and the smallest is used. Also stores the width, height, and format.
_bBuffer | The output buffer where the compressed data will be stored. |
LSE_INLINE CImage::LSI_BLOCK LSE_CALL lsi::CImage::Convert16BitToBlockTexel | ( | LSUINT16 | _ui16Color | ) | [static, protected] |
Converts a 16-bit R5 G6 B5 value into a block texel.
_ui16Color | The value to convert. |
LSE_INLINE LSUINT16 LSE_CALL lsi::CImage::ConvertBlockTexelTo16Bit | ( | const LSI_BLOCK & | _bColor | ) | [static, protected] |
Converts a block texel to a 16-bit R5 G6 B5 value.
_bColor | The color to convert. |
LSBOOL LSE_CALL lsi::CImage::ConvertToDds | ( | LSI_PIXEL_FORMAT | _pfFormat, |
CImage & | _iDst | ||
) |
Converts the image to DDS format.
_pfFormat | The format to which to convert the image. Must be one of the DXT formats. |
_iDst | The destination image to which this image is converted. |
LSBOOL LSE_CALL lsi::CImage::ConvertToDdsInPlace | ( | LSI_PIXEL_FORMAT | _pfFormat | ) |
Converts the image to DDS format in-place.
_pfFormat | The format to which to convert the image. Must be one of the DXT formats. |
LSVOID LSE_CALL lsi::CImage::ConvertToFormat | ( | LSI_PIXEL_FORMAT | _pfFormat, |
CImage & | _iDest | ||
) | const |
Converts to a given format and return a new image in that format.
_pfFormat | Format to which to convert this image. |
_iDest | Destination image. |
CImage& LSE_CALL lsi::CImage::ConvertToFormatInPlace | ( | LSI_PIXEL_FORMAT | _pfFormat | ) |
Converts this image in-place to a given format.
_pfFormat | Format to which to convert this image. |
LSVOID LSE_CALL lsi::CImage::ConvertToNormalMap | ( | LSFLOAT | _fStr, |
LSBOOL | _bWrapX = true , |
||
LSBOOL | _bWrapY = true |
||
) |
Converts the image to a normal map using average color intensities from each channel of the image. Normally images are greyscale when converted to normal maps.
_fStr | The strength of the normals. Must not be 0. |
_bWrapX | If true, the normal map is calculated with wrapping at the horizontal borders. |
_bWrapY | If true, the normal map is calculated with wrapping at the vertical borders. |
LSBOOL LSE_CALL lsi::CImage::CreateBlank | ( | LSI_PIXEL_FORMAT | _pfFormat, |
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height | ||
) |
Create a blank image.
_pfFormat | Format of the image to create. |
_ui32Width | Width of the image to create. |
_ui32Height | Height of the image to create. |
Create an image from an RGB and alpha source. The created image is always in LSI_PF_R8G8B8A8 format. If the alpha source has no alpha channel, the intensities of its RGB channels are used to create the alpha. The dimensions of the created image are the the independant maximums of the widths and heights of the input images.
_iRgb | The image from which to extract the RGB components for the final image. |
_iAlpha | The image from which to extract the alpha components for the final image. |
static LSUINT32 LSH_CALL lsi::CImage::DxtThread | ( | LSVOID * | _lpParameter | ) | [static, protected] |
Thread function for converting a block of texels to DXTn format.
_lpParameter | The thread information, stored as a pointer to a LSI_DXT_THREAD_DATA structure. |
static LSUINT32 LSE_CALL lsi::CImage::FindDxt1Match | ( | const LSI_BLOCK & | _bColor0, |
const LSI_BLOCK & | _bColor1, | ||
const LSI_BLOCK & | _bColor | ||
) | [static, protected] |
Finds the 2-bit DXT code that represents the given color's relationship between the two givem key colors. 0 color0 1 color1 2 (2*color0 + color1) / 3 3 (color0 + 2*color1) / 3
_bColor0 | The first key color. |
_bColor1 | The second key color. |
_bColor | The color to test for being closer to one or the other key color. |
static LSVOID LSE_CALL lsi::CImage::FindEndPoints | ( | LSFLOAT | _fEndPoint, |
LSFLOAT | _fMidPoint, | ||
LSUINT32 | _ui32EndIndex, | ||
LSUINT32 | _ui32MidIndex, | ||
LSUINT32 | _ui32Points, | ||
LSFLOAT | _fRes, | ||
LSFLOAT & | _fLow, | ||
LSFLOAT & | _fHigh | ||
) | [static, protected] |
Gets the 2 end points that would allow the line segment between them pass through the given value.
_fEndPoint | The left end point. |
_fMidPoint | The point through which to pass. |
_ui32EndIndex | The index of the left point. |
_ui32MidIndex | The index of the middle point. |
_ui32Points | The total number of possible points. |
_fRes | The resolution of the rounding. |
_fLow | Holds the low end point on return. |
_fHigh | Holds the high end point on return. |
LSVOID LSE_CALL lsi::CImage::Flip | ( | ) |
Flip the image vertically.
static LSVOID LSE_CALL lsi::CImage::Get4Colors | ( | LSUINT32 | _ui32Channel, |
const LSI_BLOCK & | _bMax, | ||
const LSI_BLOCK & | _bMin, | ||
LSFLOAT | _fRet[4], | ||
LSBOOL | _bOmitLast | ||
) | [static, protected] |
Makes the 4 colors that can be created with the given block texels on one channel only.
_ui32Channel | The channel for which to derive the 4 possible values. |
_bMax | The max color. |
_bMin | The min color. |
_fRet | The returned array of 4 colors along the given channel. |
_bOmitLast | If true, 3 colors are returned instead of 4. |
static LSVOID LSE_CALL lsi::CImage::Get4Colors | ( | const LSI_BLOCK & | _bMax, |
const LSI_BLOCK & | _bMin, | ||
LSI_BLOCK | _bRet[4], | ||
LSBOOL | _bOmitLast | ||
) | [static, protected] |
Makes the 4 colors that can be created with the given block texels.
_bMax | The max color. |
_bMin | The min color. |
_bRet | The returned array of 4 colors. |
_bOmitLast | If true, 3 colors are returned instead of 4. |
LSE_INLINE const LSVOID *LSE_CALL lsi::CImage::GetBufferData | ( | ) | const |
Gets a read-only pointer to the raw buffer of texel data.
LSE_INLINE const CImageLib::CTexelBuffer &LSE_CALL lsi::CImage::GetBufferDataAsVector | ( | ) | const |
Gets a read-only reference to the raw buffer of texel data as a vector.
LSUINT32 LSE_CALL lsi::CImage::GetCrc32 | ( | ) | const |
Calculates and returns the standard 32-bit CRC for this image.
LSUINT32 LSE_CALL lsi::CImage::GetCrc32Alt | ( | ) | const |
Calculates and returns the alternative 32-bit CRC for this image.
static LSFLOAT LSE_CALL lsi::CImage::GetError | ( | const CMap< LSI_BLOCK, LSUINT32 > & | _bUniqueColors, |
const LSI_BLOCK & | _bMax, | ||
const LSI_BLOCK & | _bMin, | ||
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height, | ||
LSBOOL | _bOmitLast, | ||
LSFLOAT | _fCurError | ||
) | [static, protected] |
Gets the amount of error of an entire block between 2 colors. The orders of the highs and lows in the channels does not impact the result.
_bUniqueColors | The input block of 4-by-4 texels. |
_bMax | The max color. |
_bMin | The min color. |
_ui32Width | Width of the block. |
_ui32Height | Height of the block. |
_bOmitLast | If true, 3 colors are returned instead of 4. |
_fCurError | The current amount of error. Knowing this helps the routine early-out. |
LSE_INLINE LSFLOAT LSE_CALL lsi::CImage::GetError | ( | const LSI_BLOCK & | _bColor0, |
const LSI_BLOCK & | _bColor1 | ||
) | [static, protected] |
Gets the amount of error between 2 colors.
_bColor0 | Color 1. |
_bColor1 | Color 2. |
LSE_INLINE LSFLOAT LSE_CALL lsi::CImage::GetError | ( | LSUINT32 | _ui32Channel, |
const LSI_BLOCK | _bBlocks[4], | ||
const LSI_BLOCK & | _bSrc, | ||
LSUINT32 & | _ui32Index, | ||
LSBOOL | _bOmitLast | ||
) | [static, protected] |
Gets the amount of error of a single color channel between 4 block colors.
_ui32Channel | The channel for which to determine the amount of error. |
_bBlocks | The input array of 4 colors. |
_bSrc | The color to test against the array of blocks to find the least amount of error. |
_ui32Index | On return, this holds the index of the color that was the closest match. |
_bOmitLast | If true, 3 colors are checked instead of 4. |
LSE_INLINE LSFLOAT LSE_CALL lsi::CImage::GetError | ( | LSUINT32 | _ui32Channel, |
const LSI_BLOCK | _bBlocks[4], | ||
LSFLOAT | _fValue, | ||
LSUINT32 & | _ui32Index, | ||
LSBOOL | _bOmitLast | ||
) | [static, protected] |
Gets the amount of error of a single color channel between 4 block colors.
_ui32Channel | The channel for which to determine the amount of error. |
_bBlocks | The input array of 4 colors. |
_fValue | The value to test against the array of blocks to find the least amount of error. |
_ui32Index | On return, this holds the index of the color that was the closest match. |
_bOmitLast | If true, 3 colors are checked instead of 4. |
static LSFLOAT LSE_CALL lsi::CImage::GetErrorStrict | ( | const LSI_BLOCK | _bBlock[4][4], |
const LSI_BLOCK & | _bMax, | ||
const LSI_BLOCK & | _bMin, | ||
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height, | ||
LSBOOL | _bOmitLast | ||
) | [static, protected] |
Gets the amount of error of an entire block between 2 colors.
_bBlock | The input block of 4-by-4 texels. |
_bMax | The max color. |
_bMin | The min color. |
_ui32Width | Width of the block. |
_ui32Height | Height of the block. |
_bOmitLast | If true, 3 colors are returned instead of 4. |
LSE_INLINE LSI_PIXEL_FORMAT LSE_CALL lsi::CImage::GetFormat | ( | ) | const |
Gets the texel format.
LSE_INLINE LSUINT32 LSE_CALL lsi::CImage::GetHeight | ( | ) | const |
Gets the image height.
static LSVOID LSE_CALL lsi::CImage::GetKeyColors | ( | const LSI_BLOCK | _bBlock[4][4], |
LSI_BLOCK & | _bMax, | ||
LSI_BLOCK & | _bMin, | ||
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height, | ||
LSFLOAT | _fAlphaHigh, | ||
LSFLOAT | _fAlphaLow, | ||
LSI_PIXEL_FORMAT | _pfFormat | ||
) | [static, protected] |
Takes an array of 16 texels in floating-point format and determines the two colors best suited to represent the given colors via simple interpolation. In other words, it determines the two key colors for a DXT block.
_bBlock | The input block of 4-by-4 texels. |
_fMax | Upon return, this holds the computed maximum color value. |
_fMin | Upon return, this holds the computed minimum color value. |
_ui32Width | Width of the block. |
_ui32Height | Height of the block. |
_fAlphaHigh | The highest alpha value in the block. |
_fAlphaLow | The lowest alpha value in the block. |
_pfFormat | The DXTn format to which the block is to be converted. |
LSE_INLINE const CVector< CImageLib::CTexelBuffer > &LSE_CALL lsi::CImage::GetMipMapBuffers | ( | ) | const |
Gets the mipmaps of this image, if any.
LSE_INLINE const CImageLib::CTexelBuffer &LSE_CALL lsi::CImage::GetMipMapBuffers | ( | LSUINT32 | _ui32Level | ) | const |
Gets a mipmap level such that 0 is the main image buffer and the remaining are from the mipmap chain.
_ui32Level | Level of the buffer to get. |
LSE_INLINE LSUINT64 LSE_CALL lsi::CImage::GetTexelAt | ( | LSI_PIXEL_FORMAT | _pfFormat, |
LSUINT32 | _ui32X, | ||
LSUINT32 | _ui32Y | ||
) | const |
Gets a texel in the given format. Integer formats only are accepted.
_pfFormat | Form in which to return the texel. Function is fast if the format matches the format of the image. Must be an integer format. |
_ui32X | X location of the texel to get. |
_ui32Y | Y location of the texel to get. |
LSE_INLINE LSUINT32 LSE_CALL lsi::CImage::GetWidth | ( | ) | const |
Gets the image width.
LSBOOL LSE_CALL lsi::CImage::IsBlackAndWhite | ( | ) | const |
Is this image black-and-white?
LSBOOL LSE_CALL lsi::CImage::LoadCompressedBitwiseRle | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen, | ||
CImageLib::CTexelBuffer & | _tbOut | ||
) | [protected] |
Loads an LSI image that was compressed via bitwise RLE compression.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_tbOut | Buffer where to store the decompressed image data. |
LSBOOL LSE_CALL lsi::CImage::LoadCompressedChannels | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen, | ||
CImageLib::CTexelBuffer & | _tbOut | ||
) | [protected] |
Loads an LSI image that was compressed via channel compression.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_tbOut | Buffer where to store the decompressed image data. |
LSBOOL LSE_CALL lsi::CImage::LoadCompressedIndices | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen, | ||
CImageLib::CTexelBuffer & | _tbOut | ||
) | [protected] |
Loads an LSI image that was compressed via index compression.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_tbOut | Buffer where to store the decompressed image data. |
LSBOOL LSE_CALL lsi::CImage::LoadCompressedRaw | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen, | ||
CImageLib::CTexelBuffer & | _tbOut | ||
) | [protected] |
Loads an LSI image that was compressed via raw compression.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_tbOut | Buffer where to store the decompressed image data. |
LSBOOL LSE_CALL lsi::CImage::LoadDxt | ( | LSUINT8 | _ui8MipLevels, |
const LSUINT8 * | _pui8FileData, | ||
LSUINT32 | _ui32DataLen, | ||
CImageLib::CTexelBuffer & | _tbOut, | ||
CVector< CImageLib::CTexelBuffer > & | _vMipMaps | ||
) | [protected] |
Loads an LSI image that was compressed via index compression.
_ui8MipLevels | The number of mipmap levels in the file. Always at least 1. |
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_tbOut | Buffer where to store the level-0 decompressed image data. |
_vMipMaps | Buffers where to store the mipmap decompressed image data. |
LSBOOL LSE_CALL lsi::CImage::LoadFile | ( | const LSCHAR * | _pcFile | ) |
Create an image from a file. Path must be in UTF-8 format.
_pcFile | UTF-8-formatted string representing the path to the file to load. |
LSBOOL LSE_CALL lsi::CImage::LoadFileFromMemory | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen | ||
) |
Create an image from a file already loaded to memory.
_pui8FileData | Pointer to the loaded file. |
_ui32DataLen | Length of the loaded file data. |
LSBOOL LSE_CALL lsi::CImage::LoadLsi | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen | ||
) | [protected] |
Load an LSI file from memory.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
static LSVOID LSE_CALL lsi::CImage::MakeDxt1Block | ( | const LSI_BLOCK | _bBlock[4][4], |
const LSI_BLOCK & | _bMax, | ||
const LSI_BLOCK & | _bMin, | ||
LSUINT8 * | _pui8Return | ||
) | [static, protected] |
Makes a DXT1 block.
_bBlock | Contains the 4-by-4 block of texels to be encoded. |
_fMax | Holds the maximum values for each channel of the color to use. |
_fMin | Holds the minimum values for each channel of the color to use. |
_pui8Return | Holds the returned compressed block. |
LSE_INLINE LSBOOL LSE_CALL lsi::CImage::Offset16BitColorChannel | ( | LSUINT32 | _ui32Channel, |
LSINT32 | _i32Amount, | ||
LSUINT16 & | _ui16Color | ||
) | [static, protected] |
Offsets a component in a 16-bit R5 G6 B5 color by a given amount. If false is returned, the component can't be offset by the given amount.
_ui32Channel | The channel on the color to modify. |
_i32Amount | The amount by which to modify the color. |
_ui16Color | The color to modify. |
Assignment operator.
_iOther | The object to copy. |
LSVOID LSE_CALL lsi::CImage::PostLoad | ( | ) | [protected] |
Called after a successful load. Sets various values based on the loaded data.
static LSVOID LSE_CALL lsi::CImage::RefineKeyColors | ( | const CMap< LSFLOAT, LSUINT32 > | _bUniqueValues[4], |
const CMap< LSI_BLOCK, LSUINT32 > & | _bUniqueColors, | ||
const LSI_BLOCK | _bBlock[4][4], | ||
LSI_BLOCK & | _bMax, | ||
LSI_BLOCK & | _bMin, | ||
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height, | ||
LSUINT32 | _ui32Iters, | ||
LSFLOAT | _fAlphaHigh, | ||
LSFLOAT | _fAlphaLow, | ||
LSI_PIXEL_FORMAT | _pfFormat | ||
) | [static, protected] |
Refines the given key colors iteratively, with each iteration bringing it closer to the most optimal solution.
_bUniqueValues | The unique values in each channel in the block, along with the number of times the value appears. |
_bUniqueColors | The unique colors in the block, along with the number of times the value appears. |
_bBlock | The input block of 4-by-4 texels. |
_fMax | Upon return, this holds the computed maximum color value. |
_fMin | Upon return, this holds the computed minimum color value. |
_ui32Width | Width of the block. |
_ui32Height | Height of the block. |
_ui32Iters | Iteration count for the 2nd phase. |
_fAlphaHigh | The highest alpha value in the block. |
_fAlphaLow | The lowest alpha value in the block. |
_pfFormat | The DXTn format to which the block is to be converted. |
LSBOOL LSE_CALL lsi::CImage::Resample | ( | LSUINT32 | _ui32NewWidth, |
LSUINT32 | _ui32NewHeight, | ||
LSI_FILTER | _fFilter, | ||
CImage & | _iDest, | ||
LSFLOAT | _fSrcGamma = 2.2f , |
||
LSFLOAT | _fFilterScale = 1.0f |
||
) | const |
Returns a new image instance that represents a resampled version of this image.
_ui32NewWidth | The width of the new image. |
_ui32NewHeight | The height of the new image. |
_fFilter | The filter to use for the resample. |
_iDest | Destination image. |
_fSrcGamma | Gamma-correction value. Set to 1.0f to disable gamma correction. Partial gamma correction produces better mipmaps. |
_fFilterScale | Filter scale. Values below 1.0f cause aliasing, but can produce better mipmaps. |
LSBOOL LSE_CALL lsi::CImage::ResampleInPlace | ( | LSUINT32 | _ui32NewWidth, |
LSUINT32 | _ui32NewHeight, | ||
LSI_FILTER | _fFilter, | ||
LSFLOAT | _fSrcGamma = 2.2f , |
||
LSFLOAT | _fFilterScale = 1.0f |
||
) |
Resample this image in-place to a given size.
_ui32NewWidth | The width of the new image. |
_ui32NewHeight | The height of the new image. |
_fFilter | The filter to use for the resample. |
_fSrcGamma | Gamma-correction value. Set to 1.0f to disable gamma correction. Partial gamma correction produces better mipmaps. |
_fFilterScale | Filter scale. Values below 1.0f cause aliasing, but can produce better mipmaps. |
LSVOID LSE_CALL lsi::CImage::Reset | ( | ) |
Reset the image entirely, leaving it ready to be used again for a new image.
LSE_INLINE LSFLOAT LSE_CALL lsi::CImage::Round | ( | LSFLOAT | _fValue, |
LSFLOAT | _fRes | ||
) | [static, protected] |
Rounds the given value off given a resolution for rounding.
_fValue | The value to round. |
_fRes | The resolution of the rounding. |
LSVOID LSE_CALL lsi::CImage::SetAllocator | ( | CAllocator * | _paAllocator | ) |
Set the allocator. Causes the object to be fully reset.
_paAllocator | The new allocator to be used by this object or NULL to use the default allocator. |
LSE_INLINE LSVOID LSE_CALL lsi::CImage::SetTexelAt | ( | LSUINT64 | _ui64Texel, |
LSI_PIXEL_FORMAT | _pfFormat, | ||
LSUINT32 | _ui32X, | ||
LSUINT32 | _ui32Y | ||
) |
Set a texel at a given location. Input format can be any valid format.
_ui64Texel | The texel value to set at the given location. |
_pfFormat | Format of the incoming texel value. |
_ui32X | X coordinate of the texel to modify. |
_ui32Y | Y coordinate of the texel to modify. |
LSE_INLINE LSUINT32 LSE_CALL lsi::CImage::TotalMipLevels | ( | ) | const |
Gets the total mipmap levels including the base level.
LSI_PIXEL_FORMAT lsi::CImage::m_pfFormat [protected] |
The pixel format.
CImageLib::CTexelBuffer lsi::CImage::m_tbBuffer [protected] |
The actual texel buffer.
LSUINT32 lsi::CImage::m_ui32Height [protected] |
The height of the image in texels.
LSUINT32 lsi::CImage::m_ui32RowWidth [protected] |
The width of rows, in pixels.
LSUINT32 lsi::CImage::m_ui32TexelSize [protected] |
Texel size in bytes.
LSUINT32 lsi::CImage::m_ui32Width [protected] |
The width of the image in texels.
CVector<CImageLib::CTexelBuffer> lsi::CImage::m_vMipMapBuffer [protected] |
Optional precalculated mipmaps.