Canvas

Trait Canvas 

Source
pub trait Canvas {
Show 13 methods // Required methods fn fill_rect(&mut self, rect: Rect, color: Color); fn stroke_rect(&mut self, rect: Rect, color: Color, width: f32); fn draw_text(&mut self, text: &str, position: Point, style: &TextStyle); fn draw_line(&mut self, from: Point, to: Point, color: Color, width: f32); fn fill_circle(&mut self, center: Point, radius: f32, color: Color); fn stroke_circle( &mut self, center: Point, radius: f32, color: Color, width: f32, ); fn fill_arc( &mut self, center: Point, radius: f32, start_angle: f32, end_angle: f32, color: Color, ); fn draw_path(&mut self, points: &[Point], color: Color, width: f32); fn fill_polygon(&mut self, points: &[Point], color: Color); fn push_clip(&mut self, rect: Rect); fn pop_clip(&mut self); fn push_transform(&mut self, transform: Transform2D); fn pop_transform(&mut self);
}
Expand description

Canvas trait for paint operations.

This is a minimal abstraction over the rendering backend.

Required Methods§

Source

fn fill_rect(&mut self, rect: Rect, color: Color)

Draw a filled rectangle.

Source

fn stroke_rect(&mut self, rect: Rect, color: Color, width: f32)

Draw a stroked rectangle.

Source

fn draw_text(&mut self, text: &str, position: Point, style: &TextStyle)

Draw text.

Source

fn draw_line(&mut self, from: Point, to: Point, color: Color, width: f32)

Draw a line between two points.

Source

fn fill_circle(&mut self, center: Point, radius: f32, color: Color)

Draw a filled circle.

Source

fn stroke_circle( &mut self, center: Point, radius: f32, color: Color, width: f32, )

Draw a stroked circle.

Source

fn fill_arc( &mut self, center: Point, radius: f32, start_angle: f32, end_angle: f32, color: Color, )

Draw a filled arc (pie slice).

Source

fn draw_path(&mut self, points: &[Point], color: Color, width: f32)

Draw a path (polyline).

Source

fn fill_polygon(&mut self, points: &[Point], color: Color)

Fill a polygon.

Source

fn push_clip(&mut self, rect: Rect)

Push a clip region.

Source

fn pop_clip(&mut self)

Pop the clip region.

Source

fn push_transform(&mut self, transform: Transform2D)

Push a transform.

Source

fn pop_transform(&mut self)

Pop the transform.

Implementors§