"L. Spiro Engine"
Classes | Static Public Member Functions | Protected Types | Static Protected Member Functions | Static Protected Attributes

lsi::CPng Class Reference

Handles the loading of 8-bit PNG files. More...

#include <LSIPng.h>

List of all members.

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 []

Detailed Description

Handles the loading of 8-bit PNG files.

Class CPng Description: Handles the loading of 8-bit PNG files.


Member Typedef Documentation

A PNG chunk.

For composing the final PNG structure.


Member Function Documentation

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.

Parameters:
_ebsStreamThe stream containing the loaded PNG file. The position must be at the start of the stream.
Returns:
Returns true if the bytes in the stream form a valid PNG header.
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.

Parameters:
_pfFinalParameters.
_tbReturnThe output of the processing.
Returns:
Returns true if there is enough memory to allocate the final buffer.
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.

Parameters:
_pfFinalParameters.
_tbReturnThe output of the processing.
_bInterlacedIf true, the interlace decoder is used.
Returns:
Returns true if there is enough memory to allocate the final buffer.
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.

Parameters:
_tbReturnThe buffer to expand in-place.
_pui8PaletteThe palette.
_ui32LenLength of the palette.
_ui32WidthWidth of the image.
_ui32HeightHeight of the image.
_ui32ComponentsComponents in the image.
_bSwapRBIf true, the R and B components of the palette are swapped as they are placed into the image buffer.
Returns:
Returns true if there is enough memory to expand the buffer and if none of the indices refence above or equal to _ui32Len.
static LSVOID LSE_CALL lsi::CPng::FixColors ( CImageLib::CTexelBuffer _tbBuffer,
LSUINT32  _ui32Components 
) [static, protected]

Swap the RGB colors in the given buffer.

Parameters:
_tbBufferBuffer of colors to fix.
_ui32ComponentsNumber 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.

Parameters:
_pui8FileDataThe in-memory image of the file.
_ui32DataLenThe length of the in-memory image of the file.
_ui32WidthThe returned width of the image.
_ui32HeightThe returned height of the image.
_pfFormatIndicates the format of the converted data held in _tbReturn.
_tbReturnThe returned data.
Returns:
Returns true if the file was successfully loaded. False indicates an invalid file or lack of RAM.
static LSBOOL LSE_CALL lsi::CPng::NextChunk ( const CExternalByteStream &  _ebsStream,
LSI_PNG_CHUNK _pcChunk 
) [static, protected]

Read the next chunk.

Parameters:
_ebsStreamThe stream from which to read the next chunk.
_pcChunkHolds the returned chunk data, which does not need to be freed.
Returns:
Returns true if the next chunk was read.
static LSINT32 LSE_CALL lsi::CPng::Paeth ( LSINT32  _i32A,
LSINT32  _i32B,
LSINT32  _i32C 
) [static, protected]

Perform a PAETH filter.

Parameters:
_i32AA.
_i32BB.
_i32CC.
Returns:
Returns happiness.
static LSBOOL LSE_CALL lsi::CPng::ReadUi16 ( const CExternalByteStream &  _ebsStream,
LSUINT16 &  _ui16Dst 
) [static, protected]

Reads a single 16-bit value from the given stream.

Parameters:
_ebsStreamThe stream from which to read an 16-bit value.
_ui16DstDestination for the read value.
Returns:
Returns true if the value was read from the stream.
static LSBOOL LSE_CALL lsi::CPng::ReadUi32 ( const CExternalByteStream &  _ebsStream,
LSUINT32 &  _ui32Dst 
) [static, protected]

Reads a single 32-bit value from the given stream.

Parameters:
_ebsStreamThe stream from which to read an 32-bit value.
_ui32DstDestination for the read value.
Returns:
Returns true if the value was read from the stream.
static LSBOOL LSE_CALL lsi::CPng::ReadUi8 ( const CExternalByteStream &  _ebsStream,
LSUINT8 &  _ui8Dst 
) [static, protected]

Reads a single 8-bit value from the given stream.

Parameters:
_ebsStreamThe stream from which to read an 8-bit value.
_ui8DstDestination for the read value.
Returns:
Returns true if the value was read from the stream.
static LSVOID LSE_CALL lsi::CPng::Skip ( const CExternalByteStream &  _ebsStream,
LSUINT32  _ui32Length 
) [static, protected]

Skip a section of the stream.

Parameters:
_ebsStreamThe stream.
_ui32LengthNumber of bytes to skip.

Member Data Documentation

LSI_PNG_FILTER lsi::CPng::m_pfFirstRowFilter[] [static, protected]

Translates from a standard filter to a first-row filter.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator