Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer { /* private fields */ }
Expand description

The fonts and text layout state a renderer keeps between paints.

Implementations§

Source§

impl Renderer

Source

pub fn new() -> Renderer

Source

pub fn layout(&mut self, scene: &Scene) -> Vec<Frame>

Lays the scene out: every node’s box, in tree order.

Source

pub fn display_list( &mut self, scene: &Scene, theme: Theme, ) -> (Frame, Vec<Draw>)

The scene as drawing commands — laid out once, shaped once — and the area they cover: the design’s drawing, its root’s box plus anything painted outside it, in whole pixels. The list is clipped to that area, so every backend shows exactly it.

Source

pub fn drawing( &mut self, scene: &Scene, theme: Theme, after: Option<&Drawing>, ) -> Result<Drawing, Undrawable>

The scene laid out once and turned into its display list in theme — every color its value there — or why it can’t be drawn: a drawing bigger than MAX_SIDE a side, or images and shadows that don’t fit the GPU’s atlas together. What the PNG, the canvas and devpage check all start from.

Each image is painted under a blob of its own, made in the order the drawing first paints it — except that a drawing made after the one a canvas last showed, painting the same images in the same order, paints that drawing’s: the GPU then keeps the atlas it has, which holds exactly them, placed as a fresh one would.

Source

pub fn paint(&mut self, scene: &Scene, theme: Theme, scale: f32) -> Pixmap

Paints the scene’s drawing with vello_cpu at scale device pixels per scene pixel, its top-left at the drawing’s. A drawing bigger than MAX_SIDE a side is painted only that far.

Trait Implementations§

Source§

impl Default for Renderer

Source§

fn default() -> Self

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> ErasedDestructor for T
where T: 'static,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.