MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ set_pixels() [3/3]

void MayaFlux::Kakshya::TextureContainer::set_pixels ( std::span< const uint8_t >  data,
uint32_t  layer = 0 
)

Replace the layer's pixel buffer with a byte source.

Valid only when the declared format is uint8-backed. Size must equal width * height * bytes_per_pixel.

Definition at line 341 of file TextureContainer.cpp.

342{
343 if (layer >= m_data.size()) {
345 "TextureContainer::set_pixels(u8) layer {} out of range", layer);
346 return;
347 }
348 auto* buf = std::get_if<std::vector<uint8_t>>(&m_data[layer]);
349 if (!buf) {
351 "TextureContainer::set_pixels(u8) called on non-uint8 format {}",
352 static_cast<int>(m_format));
353 return;
354 }
355 if (data.size() != buf->size()) {
357 "TextureContainer::set_pixels(u8) size mismatch: got {} expected {}",
358 data.size(), buf->size());
359 return;
360 }
361 std::unique_lock lock(m_data_mutex);
362 std::ranges::copy(data, buf->begin());
363 m_processed_data[layer] = m_data[layer];
364}
#define MF_ERROR(comp, ctx,...)
void lock() override
Acquire a lock for thread-safe access.
Portal::Graphics::ImageFormat m_format
std::vector< DataVariant > m_processed_data
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MF_ERROR.