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§
Sourcefn stroke_rect(&mut self, rect: Rect, color: Color, width: f32)
fn stroke_rect(&mut self, rect: Rect, color: Color, width: f32)
Draw a stroked rectangle.
Sourcefn draw_line(&mut self, from: Point, to: Point, color: Color, width: f32)
fn draw_line(&mut self, from: Point, to: Point, color: Color, width: f32)
Draw a line between two points.
Sourcefn fill_circle(&mut self, center: Point, radius: f32, color: Color)
fn fill_circle(&mut self, center: Point, radius: f32, color: Color)
Draw a filled circle.
Sourcefn stroke_circle(
&mut self,
center: Point,
radius: f32,
color: Color,
width: f32,
)
fn stroke_circle( &mut self, center: Point, radius: f32, color: Color, width: f32, )
Draw a stroked circle.
Sourcefn fill_arc(
&mut self,
center: Point,
radius: f32,
start_angle: f32,
end_angle: f32,
color: Color,
)
fn fill_arc( &mut self, center: Point, radius: f32, start_angle: f32, end_angle: f32, color: Color, )
Draw a filled arc (pie slice).
Sourcefn fill_polygon(&mut self, points: &[Point], color: Color)
fn fill_polygon(&mut self, points: &[Point], color: Color)
Fill a polygon.
Sourcefn push_transform(&mut self, transform: Transform2D)
fn push_transform(&mut self, transform: Transform2D)
Push a transform.
Sourcefn pop_transform(&mut self)
fn pop_transform(&mut self)
Pop the transform.