mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 12:24:16 +00:00
Changelog: C++: Add slint::Window::take_snapshot()
Corresponds to the Rust API.
This commit is contained in:
parent
8fdbfc5ee5
commit
a7a3b3f9ee
5 changed files with 39 additions and 2 deletions
|
|
@ -602,6 +602,21 @@ public:
|
|||
return cbindgen_private::slint_windowrc_has_active_animations(&inner.handle());
|
||||
}
|
||||
|
||||
/// Takes a snapshot of the window contents and returns it as RGBA8 encoded pixel buffer.
|
||||
///
|
||||
/// Note that this function may be slow to call. Reading from the framebuffer previously
|
||||
/// rendered, too, may take a long time.
|
||||
std::optional<SharedPixelBuffer<Rgba8Pixel>> take_snapshot() const
|
||||
{
|
||||
SharedPixelBuffer<Rgba8Pixel> result;
|
||||
if (cbindgen_private::slint_windowrc_take_snapshot(&inner.handle(), &result.m_data,
|
||||
&result.m_width, &result.m_height)) {
|
||||
return result;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/// \private
|
||||
private_api::WindowAdapterRc &window_handle() { return inner; }
|
||||
/// \private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue