|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
| MAYAFLUX_API DataAccess MayaFlux::Kakshya::readback_region | ( | const std::shared_ptr< Core::Window > & | window, |
| uint32_t | x_offset, | ||
| uint32_t | y_offset, | ||
| uint32_t | pixel_width, | ||
| uint32_t | pixel_height, | ||
| DataVariant & | out_variant | ||
| ) |
Read a pixel rectangle from the last completed swapchain frame into a DataVariant whose element type matches the live swapchain format.
Format -> DataVariant mapping: B8G8R8A8_SRGB / R8G8B8A8_SRGB / B8G8R8A8_UNORM / R8G8B8A8_UNORM -> std::vector<uint8_t> (4 bytes/pixel) R16G16B16A16_SFLOAT -> std::vector<uint16_t> (8 bytes/pixel, raw half-float bits) A2B10G10R10_UNORM -> std::vector<uint32_t> (4 bytes/pixel, packed word) R32G32B32A32_SFLOAT -> std::vector<float> (16 bytes/pixel)
The rectangle is cropped host-side from the full surface published by the per-window readback thread. The data is one frame late relative to the current render, not synchronously captured at call time. No GPU work and no staging buffer: the function reads the cached frame, validates the region against the swapchain extent, and copies the rows out. Safe to call without stalling the render pipeline. Returns failure if no frame has been captured yet or the region exceeds the surface bounds.
Dimensions on the returned DataAccess (IMAGE_COLOR convention): [0] SPATIAL_Y - pixel_height [1] SPATIAL_X - pixel_width [2] CHANNEL - channel_count derived from format traits
| window | Window whose surface is being read. |
| x_offset | Left edge of the pixel rectangle (inclusive). |
| y_offset | Top edge of the pixel rectangle (inclusive). |
| pixel_width | Width of the rectangle in pixels. |
| pixel_height | Height of the rectangle in pixels. |
| out_variant | Receives the typed pixel data. Left unchanged on failure. |
Definition at line 121 of file SurfaceUtils.cpp.
References MayaFlux::Journal::ContainerProcessing, MayaFlux::Core::from_vk_format(), MayaFlux::Core::get_surface_format_traits(), IMAGE_COLOR, MayaFlux::Journal::Kakshya, MF_RT_ERROR, UNKNOWN, and MayaFlux::Core::vk_format_bytes_per_pixel().
Referenced by MayaFlux::Kakshya::WindowAccessProcessor::process().
Here is the call graph for this function:
Here is the caller graph for this function: