pub trait Renderer: Sized {
    type Theme;

    // Required methods
    fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self));
    fn with_translation(
        &mut self,
        translation: Vector,
        f: impl FnOnce(&mut Self)
    );
    fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>);
    fn clear(&mut self);

    // Provided method
    fn layout<Message>(
        &mut self,
        element: &Element<'_, Message, Self>,
        limits: &Limits
    ) -> Node { ... }
}
Expand description

A component that can be used by widgets to draw themselves on a screen.

Required Associated Types§

source

type Theme

The supported theme of the Renderer.

Required Methods§

source

fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self))

Draws the primitives recorded in the given closure in a new layer.

The layer will clip its contents to the provided bounds.

source

fn with_translation(&mut self, translation: Vector, f: impl FnOnce(&mut Self))

Applies a translation to the primitives recorded in the given closure.

source

fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>)

Fills a Quad with the provided Background.

source

fn clear(&mut self)

Clears all of the recorded primitives in the Renderer.

Provided Methods§

source

fn layout<Message>( &mut self, element: &Element<'_, Message, Self>, limits: &Limits ) -> Node

Lays out the elements of a user interface.

You should override this if you need to perform any operations before or after layouting. For instance, trimming the measurements cache.

Implementors§