pub struct Painter { /* private fields */ }Expand description
Draws on a canvas: shapes and text, in points from the top-left
corner.
Implementations§
Source§impl Painter
impl Painter
Sourcepub fn set_opacity(&mut self, opacity: f64)
pub fn set_opacity(&mut self, opacity: f64)
The opacity (0–1) of what’s drawn next.
Sourcepub fn fill_rounded_rect(
&mut self,
x: f64,
y: f64,
w: f64,
h: f64,
radius: f64,
color: Color,
)
pub fn fill_rounded_rect( &mut self, x: f64, y: f64, w: f64, h: f64, radius: f64, color: Color, )
Fills a rectangle with rounded corners.
Sourcepub fn stroke_rect(
&mut self,
x: f64,
y: f64,
w: f64,
h: f64,
color: Color,
width: f64,
)
pub fn stroke_rect( &mut self, x: f64, y: f64, w: f64, h: f64, color: Color, width: f64, )
Outlines a rectangle.
Sourcepub fn fill_circle(&mut self, cx: f64, cy: f64, r: f64, color: Color)
pub fn fill_circle(&mut self, cx: f64, cy: f64, r: f64, color: Color)
Fills a circle around cx, cy.
Sourcepub fn stroke_circle(
&mut self,
cx: f64,
cy: f64,
r: f64,
color: Color,
width: f64,
)
pub fn stroke_circle( &mut self, cx: f64, cy: f64, r: f64, color: Color, width: f64, )
Outlines a circle around cx, cy.
Sourcepub fn stroke_arc(
&mut self,
cx: f64,
cy: f64,
r: f64,
degrees: Range<f64>,
color: Color,
width: f64,
)
pub fn stroke_arc( &mut self, cx: f64, cy: f64, r: f64, degrees: Range<f64>, color: Color, width: f64, )
Part of a circle around cx, cy, clockwise through degrees with 0
at the top, with round ends: progress rings and gauges.
stroke_arc(cx, cy, r, 0.0..360.0 * done, ..) is a ring done full.
Sourcepub fn line(
&mut self,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
color: Color,
width: f64,
)
pub fn line( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, color: Color, width: f64, )
A straight line.
Sourcepub fn polyline(&mut self, points: &[(f64, f64)], color: Color, width: f64)
pub fn polyline(&mut self, points: &[(f64, f64)], color: Color, width: f64)
Lines through points.
Sourcepub fn fill_polygon(&mut self, points: &[(f64, f64)], color: Color)
pub fn fill_polygon(&mut self, points: &[(f64, f64)], color: Color)
Fills the polygon through points.
Sourcepub fn text(
&mut self,
x: f64,
y: f64,
text: &str,
size: f64,
color: Color,
align: Align,
)
pub fn text( &mut self, x: f64, y: f64, text: &str, size: f64, color: Color, align: Align, )
Text in the system font at size points. x is its start, centre
or end (align); y is its top.
Auto Trait Implementations§
impl Forget for Painter
impl Freeze for Painter
impl Move for Painter
impl RefUnwindSafe for Painter
impl Send for Painter
impl Sync for Painter
impl Unpin for Painter
impl UnsafeUnpin for Painter
impl UnwindSafe for Painter
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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