Class SoftwareRenderer¶
Defined in File slint-platform.h
Nested Relationships¶
Nested Types¶
Inheritance Relationships¶
Base Type¶
public slint::platform::AbstractRenderer
(Class AbstractRenderer)
Class Documentation¶
-
class SoftwareRenderer : public slint::platform::AbstractRenderer¶
Slint’s software renderer.
To be used as a template parameter of the WindowAdapter.
Use the render() function to render in a buffer
Public Types
-
enum class RepaintBufferType : uint32_t¶
This enum describes which parts of the buffer passed to the SoftwareRenderer may be re-used to speed up painting.
Values:
-
enumerator NewBuffer¶
The full window is always redrawn. No attempt at partial rendering will be made.
-
enumerator ReusedBuffer¶
Only redraw the parts that have changed since the previous call to render().
This variant assumes that the same buffer is passed on every call to render() and that it still contains the previously rendered frame.
-
enumerator SwappedBuffers¶
Redraw the part that have changed since the last two frames were drawn.
This is used when using double buffering and swapping of the buffers.
-
enumerator NewBuffer¶
-
enum class RenderingRotation¶
This enum describes the rotation that is applied to the buffer when rendering. To be used in set_rendering_rotation()
Values:
-
enumerator NoRotation¶
No rotation.
-
enumerator Rotate90¶
Rotate 90° to the left.
-
enumerator Rotate180¶
180° rotation (upside-down)
-
enumerator Rotate270¶
Rotate 90° to the right.
-
enumerator NoRotation¶
Public Functions
-
inline virtual ~SoftwareRenderer()¶
-
SoftwareRenderer(const SoftwareRenderer&) = delete¶
-
SoftwareRenderer &operator=(const SoftwareRenderer&) = delete¶
-
inline explicit SoftwareRenderer(RepaintBufferType buffer_type)¶
Constructs a new SoftwareRenderer with the buffer_type as strategy for handling the differences between rendering buffers.
-
inline PhysicalRegion render(std::span<slint::Rgb8Pixel> buffer, std::size_t pixel_stride) const¶
Render the window scene into a pixel buffer
The buffer must be at least as large as the associated slint::Window
The stride is the amount of pixels between two lines in the buffer. It is must be at least as large as the width of the window.
-
inline PhysicalRegion render(std::span<Rgb565Pixel> buffer, std::size_t pixel_stride) const¶
Render the window scene into an RGB 565 encoded pixel buffer
The buffer must be at least as large as the associated slint::Window
The stride is the amount of pixels between two lines in the buffer. It is must be at least as large as the width of the window.
-
inline void set_rendering_rotation(RenderingRotation rotation)¶
Set how the window need to be rotated in the buffer.
This is typically used to implement screen rotation in software
-
struct PhysicalRegion¶
Represents a region on the screen, used for partial rendering.
The region may be composed of multiple sub-regions.
Public Functions
-
inline PhysicalSize bounding_box_size() const¶
Returns the size of the bounding box of this region.
-
inline PhysicalPosition bounding_box_origin() const¶
Returns the origin of the bounding box of this region.
-
inline auto rectangles() const¶
Returns a view on all the rectangles in this region. The rectangles do not overlap. The returned type is a C++ view over PhysicalRegion::Rect structs.
It can be used like so:
for (auto [origin, size] : region.rectangles()) { // Do something with the rect }
-
struct Rect¶
A Rectangle defined with an origin and a size. The PhysicalRegion::rectangles() function returns a view over them
Public Members
-
PhysicalPosition origin¶
The origin of the rectangle.
-
PhysicalSize size¶
The size of the rectangle.
-
PhysicalPosition origin¶
-
inline PhysicalSize bounding_box_size() const¶
-
enum class RepaintBufferType : uint32_t¶