Kanzi 4.1.0
kanzi::CaptureRequest Class Reference

Token returned by captureFramebufferAsync(). More...

#include <kanzi/core.ui/graphics2d/screen_capture.hpp>

Public Member Functions

 CaptureRequest ()=default
 Default constructor. Creates an invalid token.
 
 CaptureRequest (gfx::GpuFenceHandleGuard fence, gfx::BufferHandleGuard readbackBuffer, size_t width, size_t height, GraphicsFormat format, GraphicsFormat readFormat, ImageFlipAxis flipAxis)
 Constructor.
 
KZ_NO_DISCARD BitmapImageUniquePtr tryGetResult () const
 Polls the GPU fence and, if the readback is complete, returns the captured image.
 

Detailed Description

Token returned by captureFramebufferAsync().

Use tryGetResult() to poll for the captured image. The token is copyable; copies share the underlying GPU resources via ref-counted handles.

Since
Kanzi 4.1.0

Constructor & Destructor Documentation

◆ CaptureRequest() [1/2]

kanzi::CaptureRequest::CaptureRequest ( )
default

Default constructor. Creates an invalid token.

◆ CaptureRequest() [2/2]

kanzi::CaptureRequest::CaptureRequest ( gfx::GpuFenceHandleGuard fence,
gfx::BufferHandleGuard readbackBuffer,
size_t width,
size_t height,
GraphicsFormat format,
GraphicsFormat readFormat,
ImageFlipAxis flipAxis )

Constructor.

Parameters
fenceGPU fence to poll for readback completion.
readbackBufferBuffer containing the readback pixel data.
widthCapture area width.
heightCapture area height.
formatRequested graphics format.
readFormatActual read format from the framebuffer (may differ for surfaces).
flipAxisFlip axis to apply when creating the image.

Member Function Documentation

◆ tryGetResult()

KZ_NO_DISCARD BitmapImageUniquePtr kanzi::CaptureRequest::tryGetResult ( ) const

Polls the GPU fence and, if the readback is complete, returns the captured image.

Each call creates a fresh BitmapImage from the GPU buffer. Returns nullptr if the capture is still pending or has failed.


The documentation for this class was generated from the following file: