pub struct CanvasContext { /* private fields */ }Implementations§
Source§impl CanvasContext
impl CanvasContext
Sourcepub fn line(&mut self, x0: usize, y0: usize, x1: usize, y1: usize)
pub fn line(&mut self, x0: usize, y0: usize, x1: usize, y1: usize)
Draw a line from (x0, y0) to (x1, y1) using Bresenham’s algorithm.
Sourcepub fn rect(&mut self, x: usize, y: usize, w: usize, h: usize)
pub fn rect(&mut self, x: usize, y: usize, w: usize, h: usize)
Draw a rectangle outline from (x, y) with w width and h height.
Sourcepub fn circle(&mut self, cx: usize, cy: usize, r: usize)
pub fn circle(&mut self, cx: usize, cy: usize, r: usize)
Draw a circle outline centered at (cx, cy) with radius r.
Sourcepub fn filled_circle(&mut self, cx: usize, cy: usize, r: usize)
pub fn filled_circle(&mut self, cx: usize, cy: usize, r: usize)
Draw a filled circle.
Sourcepub fn triangle(
&mut self,
x0: usize,
y0: usize,
x1: usize,
y1: usize,
x2: usize,
y2: usize,
)
pub fn triangle( &mut self, x0: usize, y0: usize, x1: usize, y1: usize, x2: usize, y2: usize, )
Draw a triangle outline.
Sourcepub fn filled_triangle(
&mut self,
x0: usize,
y0: usize,
x1: usize,
y1: usize,
x2: usize,
y2: usize,
)
pub fn filled_triangle( &mut self, x0: usize, y0: usize, x1: usize, y1: usize, x2: usize, y2: usize, )
Draw a filled triangle.
Sourcepub fn polyline(&mut self, pts: &[(usize, usize)])
pub fn polyline(&mut self, pts: &[(usize, usize)])
Draw a polyline connecting the given points in order.
Auto Trait Implementations§
impl Freeze for CanvasContext
impl RefUnwindSafe for CanvasContext
impl Send for CanvasContext
impl Sync for CanvasContext
impl Unpin for CanvasContext
impl UnsafeUnpin for CanvasContext
impl UnwindSafe for CanvasContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more