iced::advanced

Trait Renderer

pub trait Renderer {
    // Required methods
    fn start_layer(&mut self, bounds: Rectangle);
    fn end_layer(&mut self);
    fn start_transformation(&mut self, transformation: Transformation);
    fn end_transformation(&mut self);
    fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>);
    fn clear(&mut self);

    // Provided methods
    fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) { ... }
    fn with_transformation(
        &mut self,
        transformation: Transformation,
        f: impl FnOnce(&mut Self),
    ) { ... }
    fn with_translation(
        &mut self,
        translation: Vector,
        f: impl FnOnce(&mut Self),
    ) { ... }
}
Available on crate feature advanced only.
Expand description

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

Required Methods§

fn start_layer(&mut self, bounds: Rectangle)

Starts recording a new layer.

fn end_layer(&mut self)

Ends recording a new layer.

The new layer will clip its contents to the provided bounds.

fn start_transformation(&mut self, transformation: Transformation)

Starts recording with a new Transformation.

fn end_transformation(&mut self)

Ends recording a new layer.

The new layer will clip its contents to the provided bounds.

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

Fills a Quad with the provided Background.

fn clear(&mut self)

Clears all of the recorded primitives in the Renderer.

Provided Methods§

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.

fn with_transformation( &mut self, transformation: Transformation, f: impl FnOnce(&mut Self), )

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

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

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl Renderer for ()

§

fn start_layer(&mut self, _bounds: Rectangle)

§

fn end_layer(&mut self)

§

fn start_transformation(&mut self, _transformation: Transformation)

§

fn end_transformation(&mut self)

§

fn clear(&mut self)

§

fn fill_quad(&mut self, _quad: Quad, _background: impl Into<Background>)

Source§

impl Renderer for Renderer

Source§

fn start_layer(&mut self, bounds: Rectangle)

Source§

fn end_layer(&mut self)

Source§

fn start_transformation(&mut self, transformation: Transformation)

Source§

fn end_transformation(&mut self)

Source§

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

Source§

fn clear(&mut self)

Source§

impl Renderer for Renderer

Source§

fn start_layer(&mut self, bounds: Rectangle)

Source§

fn end_layer(&mut self)

Source§

fn start_transformation(&mut self, transformation: Transformation)

Source§

fn end_transformation(&mut self)

Source§

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

Source§

fn clear(&mut self)

Source§

impl<A, B> Renderer for Renderer<A, B>
where A: Renderer, B: Renderer,

Source§

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

Source§

fn clear(&mut self)

Source§

fn start_layer(&mut self, bounds: Rectangle)

Source§

fn end_layer(&mut self)

Source§

fn start_transformation(&mut self, transformation: Transformation)

Source§

fn end_transformation(&mut self)

Implementors§