pub struct SoftwareRenderer { /* private fields */ }Expand description
Rasterizes scenes on the CPU. Cheap to construct and reusable across
frames; the underlying oxideav renderer also caches per-subtree work.
Implementations§
Source§impl SoftwareRenderer
impl SoftwareRenderer
pub fn new() -> Self
Sourcepub fn with_background(self, color: Color) -> Self
pub fn with_background(self, color: Color) -> Self
Set the canvas clear color (default: transparent).
Sourcepub fn render(&self, scene: Scene, scale: ScaleFactor) -> Pixmap
pub fn render(&self, scene: Scene, scale: ScaleFactor) -> Pixmap
Rasterize scene at the given scale, returning a physical-pixel
Pixmap.
The scene’s logical size combined with scale determines the output
resolution; the rasterizer maps logical → physical via the frame’s
view box, so widgets are authored once in logical pixels and stay
crisp at any DPI.
Sourcepub fn render_at(&self, scene: Scene, physical: PhysicalSize) -> Pixmap
pub fn render_at(&self, scene: Scene, physical: PhysicalSize) -> Pixmap
Rasterize scene into a buffer of exactly physical pixels.
Sourcepub fn render_region(
&self,
scene: Scene,
view: Rect,
physical: PhysicalSize,
) -> Pixmap
pub fn render_region( &self, scene: Scene, view: Rect, physical: PhysicalSize, ) -> Pixmap
Rasterize only view — a logical sub-rect of scene — into a buffer of
exactly physical pixels, which the caller picks to match the integer
device-pixel rect it will blit/present (so there is no resampling seam).
Pixels outside view are clipped by the canvas bounds; the background
fill makes the region opaque, so the result can be composited with a
straight copy (see Pixmap::blit). This is the area-repaint path: a
hover change re-rasterizes two small button rects instead of the window.