"L. Spiro Engine"
|
Handles the loading of 8-bit PNG files. More...
#include <LSIPng.h>
Classes | |
struct | LSI_PNG_CHUNK |
struct | LSI_PNG_FINAL |
Static Public Member Functions | |
static LSBOOL LSE_CALL | LoadPng (const LSUINT8 *_pui8FileData, LSUINT32 _ui32DataLen, LSUINT32 &_ui32Width, LSUINT32 &_ui32Height, LSI_PIXEL_FORMAT &_pfFormat, CImageLib::CTexelBuffer &_tbReturn) |
Protected Types | |
enum | LSI_PNG_FILTER { LSI_PF_NONE, LSI_PF_SUB, LSI_PF_UP, LSI_PF_AVG, LSI_PF_PAETH, LSI_PF_AVG_FIRST, LSI_PF_PAETH_FIRST } |
typedef struct lsi::CPng::LSI_PNG_CHUNK * | LPLSI_PNG_CHUNK |
typedef struct lsi::CPng::LSI_PNG_CHUNK | LPCLSI_PNG_CHUNK |
typedef struct lsi::CPng::LSI_PNG_FINAL * | LPLSI_PNG_FINAL |
typedef struct lsi::CPng::LSI_PNG_FINAL | LPCLSI_PNG_FINAL |
Static Protected Member Functions | |
static LSBOOL LSE_CALL | CheckHeader (const CExternalByteStream &_ebsStream) |
static LSBOOL LSE_CALL | NextChunk (const CExternalByteStream &_ebsStream, LSI_PNG_CHUNK &_pcChunk) |
static LSBOOL LSE_CALL | CreatePng (LSI_PNG_FINAL &_pfFinal, CImageLib::CTexelBuffer &_tbReturn) |
static LSBOOL LSE_CALL | CreatePng (LSI_PNG_FINAL &_pfFinal, CImageLib::CTexelBuffer &_tbReturn, LSBOOL _bInterlaced) |
static LSBOOL LSE_CALL | ExpandPalette (CImageLib::CTexelBuffer &_tbReturn, const LSUINT8 *_pui8Palette, LSUINT32 _ui32Len, LSUINT32 _ui32Width, LSUINT32 _ui32Height, LSUINT32 _ui32Components, LSBOOL _bSwapRB) |
static LSVOID LSE_CALL | FixColors (CImageLib::CTexelBuffer &_tbBuffer, LSUINT32 _ui32Components) |
static LSBOOL LSE_CALL | ReadUi8 (const CExternalByteStream &_ebsStream, LSUINT8 &_ui8Dst) |
static LSBOOL LSE_CALL | ReadUi16 (const CExternalByteStream &_ebsStream, LSUINT16 &_ui16Dst) |
static LSBOOL LSE_CALL | ReadUi32 (const CExternalByteStream &_ebsStream, LSUINT32 &_ui32Dst) |
static LSVOID LSE_CALL | Skip (const CExternalByteStream &_ebsStream, LSUINT32 _ui32Length) |
static LSINT32 LSE_CALL | Paeth (LSINT32 _i32A, LSINT32 _i32B, LSINT32 _i32C) |
Static Protected Attributes | |
static LSI_PNG_FILTER | m_pfFirstRowFilter [] |
Handles the loading of 8-bit PNG files.
Class CPng Description: Handles the loading of 8-bit PNG files.
typedef struct lsi::CPng::LSI_PNG_CHUNK * lsi::CPng::LPLSI_PNG_CHUNK [protected] |
A PNG chunk.
typedef struct lsi::CPng::LSI_PNG_FINAL * lsi::CPng::LPLSI_PNG_FINAL [protected] |
For composing the final PNG structure.
static LSBOOL LSE_CALL lsi::CPng::CheckHeader | ( | const CExternalByteStream & | _ebsStream | ) | [static, protected] |
Check the header of a PNG file loaded to memory. Validates that the header data matches a PNG header.
_ebsStream | The stream containing the loaded PNG file. The position must be at the start of the stream. |
static LSBOOL LSE_CALL lsi::CPng::CreatePng | ( | LSI_PNG_FINAL & | _pfFinal, |
CImageLib::CTexelBuffer & | _tbReturn | ||
) | [static, protected] |
Create the final image data from decompressed PNG data. Image data must not be interlaced.
_pfFinal | Parameters. |
_tbReturn | The output of the processing. |
static LSBOOL LSE_CALL lsi::CPng::CreatePng | ( | LSI_PNG_FINAL & | _pfFinal, |
CImageLib::CTexelBuffer & | _tbReturn, | ||
LSBOOL | _bInterlaced | ||
) | [static, protected] |
Create the final image data from decompressed PNG data.
_pfFinal | Parameters. |
_tbReturn | The output of the processing. |
_bInterlaced | If true, the interlace decoder is used. |
static LSBOOL LSE_CALL lsi::CPng::ExpandPalette | ( | CImageLib::CTexelBuffer & | _tbReturn, |
const LSUINT8 * | _pui8Palette, | ||
LSUINT32 | _ui32Len, | ||
LSUINT32 | _ui32Width, | ||
LSUINT32 | _ui32Height, | ||
LSUINT32 | _ui32Components, | ||
LSBOOL | _bSwapRB | ||
) | [static, protected] |
Expand the color data with the data in the given palette.
_tbReturn | The buffer to expand in-place. |
_pui8Palette | The palette. |
_ui32Len | Length of the palette. |
_ui32Width | Width of the image. |
_ui32Height | Height of the image. |
_ui32Components | Components in the image. |
_bSwapRB | If true, the R and B components of the palette are swapped as they are placed into the image buffer. |
static LSVOID LSE_CALL lsi::CPng::FixColors | ( | CImageLib::CTexelBuffer & | _tbBuffer, |
LSUINT32 | _ui32Components | ||
) | [static, protected] |
Swap the RGB colors in the given buffer.
_tbBuffer | Buffer of colors to fix. |
_ui32Components | Number of components. |
static LSBOOL LSE_CALL lsi::CPng::LoadPng | ( | const LSUINT8 * | _pui8FileData, |
LSUINT32 | _ui32DataLen, | ||
LSUINT32 & | _ui32Width, | ||
LSUINT32 & | _ui32Height, | ||
LSI_PIXEL_FORMAT & | _pfFormat, | ||
CImageLib::CTexelBuffer & | _tbReturn | ||
) | [static] |
Load a PNG file from memory.
_pui8FileData | The in-memory image of the file. |
_ui32DataLen | The length of the in-memory image of the file. |
_ui32Width | The returned width of the image. |
_ui32Height | The returned height of the image. |
_pfFormat | Indicates the format of the converted data held in _tbReturn. |
_tbReturn | The returned data. |
static LSBOOL LSE_CALL lsi::CPng::NextChunk | ( | const CExternalByteStream & | _ebsStream, |
LSI_PNG_CHUNK & | _pcChunk | ||
) | [static, protected] |
Read the next chunk.
_ebsStream | The stream from which to read the next chunk. |
_pcChunk | Holds the returned chunk data, which does not need to be freed. |
static LSINT32 LSE_CALL lsi::CPng::Paeth | ( | LSINT32 | _i32A, |
LSINT32 | _i32B, | ||
LSINT32 | _i32C | ||
) | [static, protected] |
Perform a PAETH filter.
_i32A | A. |
_i32B | B. |
_i32C | C. |
static LSBOOL LSE_CALL lsi::CPng::ReadUi16 | ( | const CExternalByteStream & | _ebsStream, |
LSUINT16 & | _ui16Dst | ||
) | [static, protected] |
Reads a single 16-bit value from the given stream.
_ebsStream | The stream from which to read an 16-bit value. |
_ui16Dst | Destination for the read value. |
static LSBOOL LSE_CALL lsi::CPng::ReadUi32 | ( | const CExternalByteStream & | _ebsStream, |
LSUINT32 & | _ui32Dst | ||
) | [static, protected] |
Reads a single 32-bit value from the given stream.
_ebsStream | The stream from which to read an 32-bit value. |
_ui32Dst | Destination for the read value. |
static LSBOOL LSE_CALL lsi::CPng::ReadUi8 | ( | const CExternalByteStream & | _ebsStream, |
LSUINT8 & | _ui8Dst | ||
) | [static, protected] |
Reads a single 8-bit value from the given stream.
_ebsStream | The stream from which to read an 8-bit value. |
_ui8Dst | Destination for the read value. |
static LSVOID LSE_CALL lsi::CPng::Skip | ( | const CExternalByteStream & | _ebsStream, |
LSUINT32 | _ui32Length | ||
) | [static, protected] |
Skip a section of the stream.
_ebsStream | The stream. |
_ui32Length | Number of bytes to skip. |
LSI_PNG_FILTER lsi::CPng::m_pfFirstRowFilter[] [static, protected] |
Translates from a standard filter to a first-row filter.