|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Raw image data loaded from file or read back from a GPU image. More...
#include <ImageData.hpp>
Collaboration diagram for MayaFlux::Kakshya::ImageData:Public Types | |
| using | PixelStorage = std::variant< std::vector< uint8_t >, std::vector< uint16_t >, std::vector< float > > |
Public Member Functions | |
| std::vector< float > * | as_float () |
| const std::vector< float > * | as_float () const |
| std::vector< uint16_t > * | as_uint16 () |
| const std::vector< uint16_t > * | as_uint16 () const |
| std::vector< uint8_t > * | as_uint8 () |
| const std::vector< uint8_t > * | as_uint8 () const |
| Typed accessors. | |
| size_t | byte_size () const |
| Total byte size of pixel storage, dispatched on variant. | |
| void * | data () |
| Writable raw data pointer, dispatched on variant. | |
| const void * | data () const |
| Raw data pointer, dispatched on variant. | |
| size_t | element_count () const |
| Number of pixel elements (not bytes), dispatched on variant. | |
| bool | is_consistent () const |
| Check that the active variant matches the declared format. | |
Static Public Member Functions | |
| static std::optional< ImageData > | allocate (uint32_t width, uint32_t height, uint32_t channels, ImageFormat format) |
Allocate zeroed pixel storage of the variant format calls for. | |
| static std::optional< ImageData > | from_bytes (uint32_t width, uint32_t height, uint32_t channels, ImageFormat format, std::span< const uint8_t > bytes) |
Build an ImageData from raw pixel bytes in format's layout. | |
Public Attributes | |
| uint32_t | channels { 0 } |
| ImageFormat | format { ImageFormat::RGBA8 } |
| uint32_t | height { 0 } |
| PixelStorage | pixels |
| uint32_t | width { 0 } |
Raw image data loaded from file or read back from a GPU image.
Pixel storage is a variant over uint8, uint16, and float, chosen by the loader based on the source format. 8-bit formats (PNG, JPG, BMP, TGA) populate the uint8 variant. 16-bit PNG populates the uint16 variant. Floating-point formats (EXR, HDR) populate the float variant.
The declared ImageFormat must match the active variant. Accessors below enforce this; direct member access is permitted but callers are responsible for consistency.
Definition at line 55 of file ImageData.hpp.