58 std::vector<uint16_t>,
73 [](
const auto& vec) {
return vec.size() *
sizeof(
typename std::decay_t<
decltype(vec)>::value_type); },
80 [[nodiscard]]
const void*
data()
const
83 [](
const auto& vec) ->
const void* {
return vec.data(); },
93 [](
auto& vec) ->
void* {
return vec.data(); },
107 [[nodiscard]]
static std::optional<ImageData> allocate(
121 [[nodiscard]]
static std::optional<ImageData> from_bytes(
126 std::span<const uint8_t> bytes);
134 [](
const auto& vec) {
return vec.size(); },
144 [[nodiscard]]
bool is_consistent()
const;
149 [[nodiscard]]
const std::vector<uint8_t>*
as_uint8()
const {
return std::get_if<std::vector<uint8_t>>(&
pixels); }
150 [[nodiscard]]
const std::vector<uint16_t>*
as_uint16()
const {
return std::get_if<std::vector<uint16_t>>(&
pixels); }
151 [[nodiscard]]
const std::vector<float>*
as_float()
const {
return std::get_if<std::vector<float>>(&
pixels); }
153 [[nodiscard]] std::vector<uint8_t>*
as_uint8() {
return std::get_if<std::vector<uint8_t>>(&
pixels); }
154 [[nodiscard]] std::vector<uint16_t>*
as_uint16() {
return std::get_if<std::vector<uint16_t>>(&
pixels); }
155 [[nodiscard]] std::vector<float>*
as_float() {
return std::get_if<std::vector<float>>(&
pixels); }
const std::vector< float > * pixels
ImageFormat
User-friendly image format enum.
@ DEPTH24_STENCIL8
24-bit depth + 8-bit stencil
@ RGB8
Three channel 8-bit.
@ DEPTH32F
32-bit float depth
@ RG16
Two channel 16-bit unsigned integer.
@ BGRA8
8-bit BGRA unsigned normalized
@ RGBA16
Four channel 16-bit unsigned integer.
@ RGBA32F
Four channel 32-bit float.
@ R16F
Single channel 16-bit float.
@ R16
Single channel 16-bit unsigned integer.
@ RGBA16F
Four channel 16-bit float.
@ RGBA8
Four channel 8-bit.
@ RG32F
Two channel 32-bit float.
@ R32F
Single channel 32-bit float.
@ R8
Single channel 8-bit.
@ RG16F
Two channel 16-bit float.
@ RGBA8_SRGB
Four channel 8-bit sRGB.
@ BGRA8_SRGB
8-bit BGRA sRGB
size_t element_count() const
Number of pixel elements (not bytes), dispatched on variant.
std::vector< uint8_t > * as_uint8()
const std::vector< float > * as_float() const
std::vector< uint16_t > * as_uint16()
const std::vector< uint16_t > * as_uint16() const
const std::vector< uint8_t > * as_uint8() const
Typed accessors.
size_t byte_size() const
Total byte size of pixel storage, dispatched on variant.
const void * data() const
Raw data pointer, dispatched on variant.
std::vector< float > * as_float()
std::variant< std::vector< uint8_t >, std::vector< uint16_t >, std::vector< float > > PixelStorage
void * data()
Writable raw data pointer, dispatched on variant.
Raw image data loaded from file or read back from a GPU image.