Skip to main content

SoftwareRenderer

Struct SoftwareRenderer 

Source
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

Source

pub fn new() -> Self

Source

pub fn with_background(self, color: Color) -> Self

Set the canvas clear color (default: transparent).

Source

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.

Source

pub fn render_at(&self, scene: Scene, physical: PhysicalSize) -> Pixmap

Rasterize scene into a buffer of exactly physical pixels.

Source

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.

Trait Implementations§

Source§

impl Debug for SoftwareRenderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SoftwareRenderer

Source§

fn default() -> SoftwareRenderer

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.