|
Aeon Engine c550894
AeonGames Open Source Game Engine
|
Represents a 2D texture image resource. More...
#include <aeongames/Texture.hpp>


Public Types | |
| enum class | Format : uint32_t { Unknown = 0 , RGB , RGBA , BGRA } |
| Pixel channel layout format. More... | |
| enum class | Type : uint32_t { Unknown = 0 , UNSIGNED_BYTE , UNSIGNED_SHORT , UNSIGNED_INT_8_8_8_8_REV } |
| Pixel component data type. More... | |
Public Member Functions | |
| DLL | ~Texture () |
| Destructor. | |
| DLL void | Resize (uint32_t aWidth, uint32_t aHeight, const uint8_t *aPixels=nullptr, Format aFormat=Format::Unknown, Type aType=Type::Unknown) |
| Resizes the texture and optionally replaces pixel data. | |
| DLL void | WritePixels (int32_t aXOffset, int32_t aYOffset, uint32_t aWidth, uint32_t aHeight, Format aFormat, Type aType, const uint8_t *aPixels) |
| Writes pixel data into a sub-region of the texture. | |
| DLL void | LoadFromMemory (const void *aBuffer, size_t aBufferSize) final |
| Loads texture data from a raw memory buffer. | |
| DLL void | Unload () final |
| Releases all texture data and resets the texture to an empty state. | |
| DLL uint32_t | GetWidth () const |
| Returns the texture width in pixels. | |
| DLL uint32_t | GetHeight () const |
| Returns the texture height in pixels. | |
| DLL Format | GetFormat () const |
| Returns the pixel format. | |
| DLL Type | GetType () const |
| Returns the pixel component type. | |
| DLL const std::vector< uint8_t > & | GetPixels () const |
| Returns a reference to the raw pixel data. | |
| Public Member Functions inherited from AeonGames::Resource | |
| virtual | ~Resource () |
| Virtual destructor. | |
| DLL void | LoadFromId (uint32_t aId) |
| Load the resource identified by a numeric id. | |
| DLL void | LoadFromFile (const std::string &aFilename) |
| Load the resource from a file on disk. | |
| DLL size_t | GetConsecutiveId () const |
| Get the Consecutive Id for the resource object. | |
Represents a 2D texture image resource.
Provides functionality for loading, resizing, and accessing pixel data in various formats and types. Supports pluggable image decoders.
Definition at line 32 of file Texture.hpp.
|
strong |
Pixel channel layout format.
Specifies the ordering and number of color channels per pixel.
| Enumerator | |
|---|---|
| Unknown | Unspecified or invalid format. |
| RGB | 3-channel red, green, blue. |
| RGBA | 4-channel red, green, blue, alpha. |
| BGRA | 4-channel blue, green, red, alpha. |
Definition at line 39 of file Texture.hpp.
|
strong |
Pixel component data type.
Specifies the data type used for each color channel value.
Definition at line 50 of file Texture.hpp.
| Texture::Format AeonGames::Texture::GetFormat | ( | ) | const |
Returns the pixel format.
Definition at line 83 of file Texture.cpp.
| uint32_t AeonGames::Texture::GetHeight | ( | ) | const |
Returns the texture height in pixels.
Definition at line 79 of file Texture.cpp.
| const std::vector< uint8_t > & AeonGames::Texture::GetPixels | ( | ) | const |
Returns a reference to the raw pixel data.
Definition at line 92 of file Texture.cpp.
| Texture::Type AeonGames::Texture::GetType | ( | ) | const |
Returns the pixel component type.
Definition at line 87 of file Texture.cpp.
| uint32_t AeonGames::Texture::GetWidth | ( | ) | const |
Returns the texture width in pixels.
Definition at line 75 of file Texture.cpp.
|
finalvirtual |
Loads texture data from a raw memory buffer.
| aBuffer | Pointer to the encoded image data. |
| aBufferSize | Size of the buffer in bytes. |
Implements AeonGames::Resource.
Definition at line 97 of file Texture.cpp.
| void AeonGames::Texture::Resize | ( | uint32_t | aWidth, |
| uint32_t | aHeight, | ||
| const uint8_t * | aPixels = nullptr, | ||
| Format | aFormat = Format::Unknown, | ||
| Type | aType = Type::Unknown ) |
Resizes the texture and optionally replaces pixel data.
| aWidth | New width in pixels. |
| aHeight | New height in pixels. |
| aPixels | Optional pointer to new pixel data. |
| aFormat | Pixel format of the new data. Keeps current format if Unknown. |
| aType | Pixel type of the new data. Keeps current type if Unknown. |
Definition at line 46 of file Texture.cpp.
|
finalvirtual |
Releases all texture data and resets the texture to an empty state.
Implements AeonGames::Resource.
Definition at line 102 of file Texture.cpp.
| void AeonGames::Texture::WritePixels | ( | int32_t | aXOffset, |
| int32_t | aYOffset, | ||
| uint32_t | aWidth, | ||
| uint32_t | aHeight, | ||
| Format | aFormat, | ||
| Type | aType, | ||
| const uint8_t * | aPixels ) |
Writes pixel data into a sub-region of the texture.
| aXOffset | Horizontal offset in pixels. |
| aYOffset | Vertical offset in pixels. |
| aWidth | Width of the region to write. |
| aHeight | Height of the region to write. |
| aFormat | Pixel format of the source data. |
| aType | Pixel type of the source data. |
| aPixels | Pointer to the source pixel data. |
Definition at line 63 of file Texture.cpp.