You.i Engine
CYIImageDecoder Class Referenceabstract

Detailed Description

Raster image decoder base class; all raster image decoders should sub-type this class.

#include <asset/YiImageDecoder.h>

Inheritance diagram for CYIImageDecoder:

Public Member Functions

 CYIImageDecoder (bool bIsAnimationSupported, bool bIsPreallocatedBitmapSupported)
 
virtual ~CYIImageDecoder ()
 
bool IsAnimationSupported ()
 
bool IsPreAllocatedBitmapSupported ()
 
virtual bool IsFormatSupported (const uint8_t *pData, uint32_t nDataSize)
 
std::unique_ptr< CYIBitmapDecode (const uint8_t *pData, uint32_t nDataSize, YI_DECODER_BITMAP_PARAMS *pParams=nullptr)
 
std::unique_ptr< CYIBitmapDecode (const CYIString &path, YI_DECODER_BITMAP_PARAMS *pParams=nullptr)
 
virtual bool GetImageDimensions (const CYIString &path, uint32_t *pnWidth, uint32_t *pnHeight)
 

Protected Member Functions

virtual std::unique_ptr< CYIBitmapDecodeImpl (const uint8_t *pData, uint32_t nDataSize, YI_DECODER_BITMAP_PARAMS *pParams)=0
 
virtual std::unique_ptr< CYIBitmapDecodeImpl (const CYIString &path, YI_DECODER_BITMAP_PARAMS *pParams)=0
 
void SetMagicByteInformation (uint32_t uMagicByteOffset, const std::vector< const char * > &possibleSequences)
 

Friends

class CYIAssetDecoderImage
 

Constructor & Destructor Documentation

CYIImageDecoder::CYIImageDecoder ( bool  bIsAnimationSupported,
bool  bIsPreallocatedBitmapSupported 
)
virtual CYIImageDecoder::~CYIImageDecoder ( )
virtual

Member Function Documentation

std::unique_ptr<CYIBitmap> CYIImageDecoder::Decode ( const uint8_t *  pData,
uint32_t  nDataSize,
YI_DECODER_BITMAP_PARAMS pParams = nullptr 
)

Decode an asset using pre-loaded file data pData and the nDataSize; additional parameters can be supplied to the decoder via the pParams object.

std::unique_ptr<CYIBitmap> CYIImageDecoder::Decode ( const CYIString path,
YI_DECODER_BITMAP_PARAMS pParams = nullptr 
)

Decode an asset at the specified path; additional parameters can be supplied to the decoder via the pParams object.

virtual std::unique_ptr<CYIBitmap> CYIImageDecoder::DecodeImpl ( const uint8_t *  pData,
uint32_t  nDataSize,
YI_DECODER_BITMAP_PARAMS pParams 
)
protectedpure virtual

Decode an asset using pre-loaded file data pData and the nDataSize.

Implemented in CYIImageDecoderTGA, CYIImageDecoderWEBP, CYIImageDecoderJPG, CYIImageDecoderPNG, CYIImageDecoderSTU, and CYIImageDecoderGIF.

virtual std::unique_ptr<CYIBitmap> CYIImageDecoder::DecodeImpl ( const CYIString path,
YI_DECODER_BITMAP_PARAMS pParams 
)
protectedpure virtual
virtual bool CYIImageDecoder::GetImageDimensions ( const CYIString path,
uint32_t *  pnWidth,
uint32_t *  pnHeight 
)
virtual

Returns true if the image information can be loaded via the asset package path; the width and height of the asset will be returned through the pnWidth and pnHeight parameters.

Reimplemented in CYIImageDecoderPNG, CYIImageDecoderJPG, CYIImageDecoderSTU, CYIImageDecoderTGA, CYIImageDecoderGIF, and CYIImageDecoderWEBP.

bool CYIImageDecoder::IsAnimationSupported ( )

Returns true if image frame animation is supported by the image decoder.

virtual bool CYIImageDecoder::IsFormatSupported ( const uint8_t *  pData,
uint32_t  nDataSize 
)
virtual

Partially decodes the file content referred to by pData and returns true if the decoder can decode it.

Reimplemented in CYIImageDecoderTGA, and CYIImageDecoderWEBP.

bool CYIImageDecoder::IsPreAllocatedBitmapSupported ( )

Returns true if the decoder support using a pre-allocated bitmap.

void CYIImageDecoder::SetMagicByteInformation ( uint32_t  uMagicByteOffset,
const std::vector< const char * > &  possibleSequences 
)
protected

Subclasses can set magic byte information (if any) in their consutrctors, and this will be used by the default implementation of IsFormatSupported.

See also
IsFormatSupported

Friends And Related Function Documentation

friend class CYIAssetDecoderImage
friend

The documentation for this class was generated from the following file: