You.i Engine
CYIAbstractTextAtlas Class Referenceabstract

Detailed Description

Abstract class for a text atlas.

#include <graphics/YiAbstractTextAtlas.h>

Inheritance diagram for CYIAbstractTextAtlas:

Classes

struct  GlyphData
 

Public Member Functions

 CYIAbstractTextAtlas ()
 
virtual ~CYIAbstractTextAtlas ()
 
virtual bool CreateNewFontAtlas (uint32_t width, uint32_t height)=0
 
virtual void SetRegion (ssize_t id, void *pReference, YI_REGION region, const uint8_t *pData, const int32_t stride) override final
 
virtual void SetRegion (ssize_t id, void *pReference, YI_REGION region, GlyphData glyphData)=0
 
virtual YI_TEXTURE_DETAILSGetTexture (ssize_t id, void *pReference) override
 
int32_t GetGlyphPadding () const
 
bool AddGlyph (const uint32_t glyphWidth, const uint32_t glyphHeight, YI_GLYPH_DETAILS *pGlyphDetails, GlyphData glyphData)
 
- Public Member Functions inherited from CYITextureAtlas
 CYITextureAtlas ()
 
virtual ~CYITextureAtlas ()
 
bool CreateNewAtlas (uint32_t unWidth, uint32_t unHeight, size_t pages)
 
YI_REGION GetRegion (int32_t width, int32_t height)
 
void UpdateAtlas ()
 
const std::shared_ptr< CYIBitmapGetBitmap () const
 
const std::vector< glm::ivec4 > * GetNodes (size_t page) const
 
virtual std::shared_ptr< CYIAssetTextureGetGLTexture () const
 
const std::shared_ptr< CYIAssetTextureGetTextureAsset ()
 
YI_LOADED_TEXTURESGetLoadedTextures ()
 
void SetTextureFilter (CYIAssetTexture::Filtering minificationFilter, CYIAssetTexture::Filtering magnificationFilter)
 
void SetTextureWrap (CYIAssetTexture::WrapMode wrapS, CYIAssetTexture::WrapMode wrapT)
 
void SetName (const CYIString &name)
 
const CYIStringGetName () const
 
float GetAtlasPercentageUsed () const
 
bool RenderAtlasToPng (const CYIString &filePath) const
 
void Reset ()
 

Protected Member Functions

void SetGlyphPadding (int32_t glyphPadding)
 
virtual bool CompareGlyphDetails (YI_GLYPH_DETAILS *pLeft, YI_GLYPH_DETAILS *pRight) const
 
- Protected Member Functions inherited from CYITextureAtlas
int32_t Fit (size_t page, size_t unIndex, int32_t width, int32_t height)
 
void Merge (size_t page)
 

Additional Inherited Members

- Protected Attributes inherited from CYITextureAtlas
CYIString m_name
 
std::shared_ptr< CYIBitmapm_Image
 
std::vector< glm::ivec4 > m_Nodes [4]
 
std::shared_ptr< CYIAssetTexturem_pTextureAsset
 
YI_LOADED_TEXTURES m_Textures
 
int32_t m_width
 
int32_t m_height
 
size_t m_pages
 
CYIAssetTexture::TextureConfig m_textureConfiguration
 
size_t m_unPixelsUsed
 
size_t m_unLastUpdatedSize
 

Constructor & Destructor Documentation

◆ CYIAbstractTextAtlas()

CYIAbstractTextAtlas::CYIAbstractTextAtlas ( )

◆ ~CYIAbstractTextAtlas()

virtual CYIAbstractTextAtlas::~CYIAbstractTextAtlas ( )
virtual

Member Function Documentation

◆ AddGlyph()

bool CYIAbstractTextAtlas::AddGlyph ( const uint32_t  glyphWidth,
const uint32_t  glyphHeight,
YI_GLYPH_DETAILS pGlyphDetails,
GlyphData  glyphData 
)

Adds the given glyph to this atlas. Returns true if the glyph was successfully added.

◆ CompareGlyphDetails()

virtual bool CYIAbstractTextAtlas::CompareGlyphDetails ( YI_GLYPH_DETAILS pLeft,
YI_GLYPH_DETAILS pRight 
) const
protectedvirtual

Reimplemented in CYISDFTextAtlas.

◆ CreateNewFontAtlas()

virtual bool CYIAbstractTextAtlas::CreateNewFontAtlas ( uint32_t  width,
uint32_t  height 
)
pure virtual

Should be implemented to do any internal initialization of the text atlas such as creating the atlas buffer. The width and height of the buffer are given as parameters.

Implemented in CYISDFTextAtlas, and CYITextAtlas.

◆ GetGlyphPadding()

int32_t CYIAbstractTextAtlas::GetGlyphPadding ( ) const

Returns the atlas' glyph padding. The glyph padding is a pixel padding added to each side of each glyph which is rendered into the atlas.

◆ GetTexture()

virtual YI_TEXTURE_DETAILS* CYIAbstractTextAtlas::GetTexture ( ssize_t  id,
void *  pReference 
)
overridevirtual

Returns the texture region which matches the given data. Returns nullptr if no match is found.

Reimplemented from CYITextureAtlas.

◆ SetGlyphPadding()

void CYIAbstractTextAtlas::SetGlyphPadding ( int32_t  glyphPadding)
protected

Sets the amount of glyph padding to use when rendering glyphs into the atlas.

◆ SetRegion() [1/2]

virtual void CYIAbstractTextAtlas::SetRegion ( ssize_t  id,
void *  pReference,
YI_REGION  region,
const uint8_t *  pData,
const int32_t  stride 
)
finaloverridevirtual

Should be implemented to write the given data to the atlas buffer and store a reference to it as a YI_TEXTURE_DETAILS.

Parameters
[in]idA user provided ID. The implementation can use this for whatever it wants
[in]pReferenceA user provided pointer. The implementation can use this for whatever it wants
[in]regionThe region in the atlas to write the data to
[in]pDataThe data to write to the atlas
[in]strideThe stride of pData

Reimplemented from CYITextureAtlas.

◆ SetRegion() [2/2]

virtual void CYIAbstractTextAtlas::SetRegion ( ssize_t  id,
void *  pReference,
YI_REGION  region,
GlyphData  glyphData 
)
pure virtual

Should be implemented to write the given data to the atlas buffer and store a reference to it as a YI_TEXTURE_DETAILS.

Parameters
[in]idA user provided ID. The implementation can use this for whatever it wants
[in]pReferenceA user provided pointer. The implementation can use this for whatever it wants
[in]regionThe region in the atlas to write the data to
[in]glyphDataThe glyph data to write into the atlas

Implemented in CYISDFTextAtlas, and CYITextAtlas.


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