Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ISprite Class Referenceabstract

#include <ISprite.h>

Inherits _i_reference_target< int >.

Inherited by CSprite.

Classes

struct  Borders
 
struct  SpriteSheetCell
 Defines the UV-extents of a particular "cell" in a sprite-sheet. 9-slice information for the cell is also stored. More...
 

Public Types

using SpriteSheetCellContainer = AZStd::vector< SpriteSheetCell >
 

Public Member Functions

virtual ~ISprite ()
 Deleting a sprite will release its texture.
 
virtual const AZStd::string & GetPathname () const =0
 Get the pathname of this sprite.
 
virtual const AZStd::string & GetTexturePathname () const =0
 Get the pathname of the texture of this sprite.
 
virtual Borders GetBorders () const =0
 Get the borders of this sprite.
 
virtual void SetBorders (Borders borders)=0
 Set the borders of this sprite.
 
virtual void SetCellBorders (int cellIndex, Borders borders)=0
 Set the borders of a given cell within the sprite-sheet.
 
virtual void Serialize (TSerialize ser)=0
 Serialize this object for save/load.
 
virtual bool SaveToXml (const AZStd::string &pathname)=0
 Save this sprite data to disk.
 
virtual bool AreBordersZeroWidth () const =0
 Test if this sprite has any borders.
 
virtual bool AreCellBordersZeroWidth (int cellIndex) const =0
 Tests if the sprite-sheet cell has borders.
 
virtual AZ::Vector2 GetSize ()=0
 Get the dimensions of the sprite.
 
virtual AZ::Vector2 GetCellSize (int cellIndex)=0
 Gets the dimensions of a specific cell texture within a sprite-sheet.
 
virtual const SpriteSheetCellContainer & GetSpriteSheetCells () const =0
 Gets cell info for each of the cells within the sprite-sheet.
 
virtual void SetSpriteSheetCells (const SpriteSheetCellContainer &cells)=0
 Sets the sprite's sprite-sheet cells.
 
virtual void ClearSpriteSheetCells ()=0
 Removes all sprite-sheet cell info for this sprite.
 
virtual void AddSpriteSheetCell (const SpriteSheetCell &spriteSheetCell)=0
 Defines a new SpriteSheetCell for this sprite.
 
virtual AZ::Vector2 GetCellUvSize (int cellIndex) const =0
 Gets the dimensions of a specific cell (in a sprite-sheet) in UV coords (UV range).
 
virtual UiTransformInterface::RectPoints GetCellUvCoords (int cellIndex) const =0
 Gets the UV coords associated for a given cell in a sprite-sheet.
 
virtual UiTransformInterface::RectPoints GetSourceCellUvCoords (int cellIndex) const =0
 Gets the UV coords associated for a given cell in a sprite-sheet in a way that ignores texture atlases.
 
virtual Borders GetCellUvBorders (int cellIndex) const =0
 
virtual Borders GetTextureSpaceCellUvBorders (int cellIndex) const =0
 
virtual const AZStd::string & GetCellAlias (int cellIndex) const =0
 Gets the string alias associated with the given cell in a sprite-sheet.
 
virtual void SetCellAlias (int cellIndex, const AZStd::string &cellAlias)=0
 Sets the string alias associated with the given cell in a sprite-sheet.
 
virtual int GetCellIndexFromAlias (const AZStd::string &cellAlias) const =0
 Returns the sprite-sheet cell index that corresponds to the given string alias.
 
virtual bool IsSpriteSheet () const =0
 Returns true if this sprite is configured as a sprite-sheet, false otherwise.
 
virtual AZ::Data::Instance< AZ::RPI::Image > GetImage ()=0
 

Detailed Description

A sprite is a texture with extra information about how it behaves for 2D drawing Currently a sprite exists on disk as a side car file next to the texture file.

Member Function Documentation

◆ AddSpriteSheetCell()

virtual void ISprite::AddSpriteSheetCell ( const SpriteSheetCell spriteSheetCell)
pure virtual

Defines a new SpriteSheetCell for this sprite.

Implemented in CSprite.

◆ AreBordersZeroWidth()

virtual bool ISprite::AreBordersZeroWidth ( ) const
pure virtual

Test if this sprite has any borders.

Implemented in CSprite.

◆ AreCellBordersZeroWidth()

virtual bool ISprite::AreCellBordersZeroWidth ( int  cellIndex) const
pure virtual

Tests if the sprite-sheet cell has borders.

Implemented in CSprite.

◆ ClearSpriteSheetCells()

virtual void ISprite::ClearSpriteSheetCells ( )
pure virtual

Removes all sprite-sheet cell info for this sprite.

Implemented in CSprite.

◆ GetBorders()

virtual Borders ISprite::GetBorders ( ) const
pure virtual

Get the borders of this sprite.

Implemented in CSprite.

◆ GetCellAlias()

virtual const AZStd::string & ISprite::GetCellAlias ( int  cellIndex) const
pure virtual

Gets the string alias associated with the given cell in a sprite-sheet.

Implemented in CSprite.

◆ GetCellIndexFromAlias()

virtual int ISprite::GetCellIndexFromAlias ( const AZStd::string &  cellAlias) const
pure virtual

Returns the sprite-sheet cell index that corresponds to the given string alias.

Implemented in CSprite.

◆ GetCellSize()

virtual AZ::Vector2 ISprite::GetCellSize ( int  cellIndex)
pure virtual

Gets the dimensions of a specific cell texture within a sprite-sheet.

Implemented in CSprite.

◆ GetCellUvBorders()

virtual Borders ISprite::GetCellUvBorders ( int  cellIndex) const
pure virtual

Gets the sliced border info for a given cell within a sprite-sheet.

The returned UV borders are in "cell space" relative to the given indexed spell. For example, a top-left border of (0.5, 0.5) would be the center of the given cell.

Implemented in CSprite.

◆ GetCellUvCoords()

virtual UiTransformInterface::RectPoints ISprite::GetCellUvCoords ( int  cellIndex) const
pure virtual

Gets the UV coords associated for a given cell in a sprite-sheet.

Implemented in CSprite.

◆ GetCellUvSize()

virtual AZ::Vector2 ISprite::GetCellUvSize ( int  cellIndex) const
pure virtual

Gets the dimensions of a specific cell (in a sprite-sheet) in UV coords (UV range).

Implemented in CSprite.

◆ GetPathname()

virtual const AZStd::string & ISprite::GetPathname ( ) const
pure virtual

Get the pathname of this sprite.

Implemented in CSprite.

◆ GetSize()

virtual AZ::Vector2 ISprite::GetSize ( )
pure virtual

Get the dimensions of the sprite.

Implemented in CSprite.

◆ GetSourceCellUvCoords()

virtual UiTransformInterface::RectPoints ISprite::GetSourceCellUvCoords ( int  cellIndex) const
pure virtual

Gets the UV coords associated for a given cell in a sprite-sheet in a way that ignores texture atlases.

Implemented in CSprite.

◆ GetSpriteSheetCells()

virtual const SpriteSheetCellContainer & ISprite::GetSpriteSheetCells ( ) const
pure virtual

Gets cell info for each of the cells within the sprite-sheet.

Implemented in CSprite.

◆ GetTexturePathname()

virtual const AZStd::string & ISprite::GetTexturePathname ( ) const
pure virtual

Get the pathname of the texture of this sprite.

Implemented in CSprite.

◆ GetTextureSpaceCellUvBorders()

virtual Borders ISprite::GetTextureSpaceCellUvBorders ( int  cellIndex) const
pure virtual

Gets the sliced border UV coordinates in texture space for a given cell within a sprite-sheet.

The returned UV border coordinates are in texture space. For example, a top-left border of (0.5, 0.5) would be the center of the sprite-sheet.

Implemented in CSprite.

◆ IsSpriteSheet()

virtual bool ISprite::IsSpriteSheet ( ) const
pure virtual

Returns true if this sprite is configured as a sprite-sheet, false otherwise.

Implemented in CSprite.

◆ SaveToXml()

virtual bool ISprite::SaveToXml ( const AZStd::string &  pathname)
pure virtual

Save this sprite data to disk.

Implemented in CSprite.

◆ Serialize()

virtual void ISprite::Serialize ( TSerialize  ser)
pure virtual

Serialize this object for save/load.

Implemented in CSprite.

◆ SetBorders()

virtual void ISprite::SetBorders ( Borders  borders)
pure virtual

Set the borders of this sprite.

Implemented in CSprite.

◆ SetCellAlias()

virtual void ISprite::SetCellAlias ( int  cellIndex,
const AZStd::string &  cellAlias 
)
pure virtual

Sets the string alias associated with the given cell in a sprite-sheet.

Implemented in CSprite.

◆ SetCellBorders()

virtual void ISprite::SetCellBorders ( int  cellIndex,
Borders  borders 
)
pure virtual

Set the borders of a given cell within the sprite-sheet.

Implemented in CSprite.

◆ SetSpriteSheetCells()

virtual void ISprite::SetSpriteSheetCells ( const SpriteSheetCellContainer &  cells)
pure virtual

Sets the sprite's sprite-sheet cells.

Implemented in CSprite.


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