pub trait Renderer: 'static + Debug + Send + Sync {
Show 17 methods fn size(&self) -> Size<f32, Scaled>; fn theme(&self) -> SystemTheme; fn clip_to(&self, bounds: Rect<f32, Scaled>) -> Self; fn clip_bounds(&self) -> Rect<f32, Scaled>; fn scale(&self) -> DisplayScale<f32>; fn render_text(
        &self,
        text: &str,
        baseline_origin: impl Displayable<f32, Pixels = Point<f32, Pixels>>,
        options: &TextOptions
    ); fn measure_text(
        &self,
        text: &str,
        options: &TextOptions
    ) -> TextMetrics<Scaled>; fn fill_rect(
        &self,
        rect: &impl Displayable<f32, Pixels = Rect<f32, Pixels>>,
        color: Color
    ); fn stroke_rect(
        &self,
        rect: &impl Displayable<f32, Pixels = Rect<f32, Pixels>>,
        options: &StrokeOptions
    ); fn stroke_line<P>(&self, point_a: P, point_b: P, options: &StrokeOptions)
    where
        P: Displayable<f32, Pixels = Point<f32, Pixels>>
; fn draw_image(
        &self,
        image: &Image,
        location: impl Displayable<f32, Pixels = Point<f32, Pixels>>
    ); fn bounds(&self) -> Rect<f32, Scaled> { ... } fn render_text_with_style<F, P>(
        &self,
        text: &str,
        baseline_origin: P,
        style: &Style
    )
    where
        F: FallbackComponent<Value = ColorPair>,
        P: Displayable<f32, Pixels = Point<f32, Pixels>>
, { ... } fn measure_text_with_style(
        &self,
        text: &str,
        style: &Style
    ) -> TextMetrics<Scaled> { ... } fn fill_rect_with_style<F, R>(&self, rect: &R, style: &Style)
    where
        F: FallbackComponent<Value = ColorPair>,
        R: Displayable<f32, Pixels = Rect<f32, Pixels>>
, { ... } fn stroke_rect_with_style<F, R>(&self, rect: &R, style: &Style)
    where
        F: FallbackComponent<Value = ColorPair>,
        R: Displayable<f32, Pixels = Rect<f32, Pixels>>
, { ... } fn stroke_line_with_style<F, P>(
        &self,
        point_a: P,
        point_b: P,
        style: &Style
    )
    where
        F: FallbackComponent<Value = ColorPair>,
        P: Displayable<f32, Pixels = Point<f32, Pixels>>
, { ... }
}
Expand description

Implements drawing APIs.

Required Methods

The size of the area being drawn.

Returns the current system theme.

Returns a new renderer instance with the state such that each operation executes as if the origin is bounds.origin. The returned instance’s size() should equal bounds.size.

A Rect representing the area being drawn. This rect should be offset relative to the origin of the renderer.

The scaling factors to use when rendering.

Renders text at baseline_origin with options.

Measures text using options.

Fills rect using color.

Strokes the outline of rect using options.

Draws a line between point_a and point_b using options.

Draws an image at location.

Provided Methods

A Rect representing the area being drawn. Due to how rendering works, the origin is always zero.

Renders text at baseline_origin with options.

Measures text using style.

Fills rect using style.

Strokes the outline of rect using style.

Draws a line between point_a and point_b using style.

Implementors