mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00

This adds a `unstable-wgpu-24` feature that exposes WGPU types in the GraphicsAPI enum, adds `require_wgpu_24()` to the backend selector, and adds a conversion from `wgpu::Texture` to `slint::Image`. The `require_wgpu_24()` function in the selector will be extended in the future (before the next release) to permit specifying additional aspects of the WGPU configuration. Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
1 KiB
1 KiB
WGPU Texture Import Example
This example application demonstrates how import a WGPU texture into a Slint scene:
- First a graphical effect is rendered using WGPU, into a texture.
- The texture is imported into a
slint::Image
and set on anImage
element. - A scene of Slint elements is rendered with the texture shown in the
Image
.
This is implemented using the set_rendering_notifier
function on the slint::Window
type. It takes a callback as a parameter and that is invoked during different phases of the rendering. In this example the invocation during the setup phase is used to prepare the pipeline for WGPU rendering later. Then the BeforeRendering
phase is used to render the graphical effect with WGPU into a texture. Then the texture is imported and Slint will render the scene of elements with the texture.
Since the graphical effect is continuous, the code in the callback requests a redraw of the contents by calling slint::Window::request_redraw()
.