|
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
|
#include <deki/assets/Texture2D.h>
Classes | |
| struct | Header |
| Header of a texture file. The file is [Header][pixel data][metadata]. More... | |
Public Types | |
| enum class | TextureFormat : uint32_t { RGB888 = 0 , RGBA8888 = 1 , RGB565 = 2 , RGB565A8 = 3 , ALPHA8 = 4 } |
Public Member Functions | |
| Texture2D () | |
| virtual | ~Texture2D () |
Static Public Member Functions | |
| static Texture2D * | Load (const char *filePath) |
| Loads a compiled texture file (.tex), or returns nullptr. | |
| static uint32_t | GetBytesPerPixel (TextureFormat format) |
| static const char * | GetFormatName (TextureFormat format) |
| The format's name, for logs. | |
| static bool | ValidateHeader (const Texture2D::Header &header) |
| True when the header is well formed. | |
| static uint8_t * | LoadAsRGBA (const char *filePath, int32_t &outWidth, int32_t &outHeight, bool &outHasAlpha) |
| Loads a .tex file as RGBA8888 pixels (editor). | |
| static uint8_t * | ConvertToRGBA (const uint8_t *srcData, int32_t width, int32_t height, TextureFormat format) |
| Converts pixels in format to RGBA8888. | |
Public Attributes | |
| uint8_t * | data |
| int32_t | width |
| int32_t | height |
| TextureFormat | format |
| bool | hasTransparency |
| bool | hasAlpha |
| Deki::Buffer< int16_t > | alphaRowSpans |
| bool | allocatedWithBackend |
Protected Member Functions | |
| virtual bool | LoadFromMemory (const Texture2D::Header &header, const uint8_t *data) |
| Fills the texture from data, the file's bytes after header. | |
|
strong |
| Deki::Texture2D::Texture2D | ( | ) |
|
virtual |
|
static |
Loads a compiled texture file (.tex), or returns nullptr.
|
static |
|
static |
The format's name, for logs.
|
static |
True when the header is well formed.
|
static |
Loads a .tex file as RGBA8888 pixels (editor).
The caller owns the result and frees it with delete[]; nullptr on failure.
|
static |
Converts pixels in format to RGBA8888.
The caller owns the result and frees it with delete[]; nullptr on failure.
|
protectedvirtual |
Fills the texture from data, the file's bytes after header.
Returns false on failure.
| uint8_t* Deki::Texture2D::data |
| int32_t Deki::Texture2D::width |
| int32_t Deki::Texture2D::height |
| TextureFormat Deki::Texture2D::format |
| bool Deki::Texture2D::hasTransparency |
| bool Deki::Texture2D::hasAlpha |
| Deki::Buffer<int16_t> Deki::Texture2D::alphaRowSpans |
| bool Deki::Texture2D::allocatedWithBackend |