pub struct Path { /* private fields */ }Expand description
a path: subpaths of lines and cubic curves, built once and drawn on any canvas (Canvas::append_path) or built on the canvas itself (its move_to, line_to, …)
Implementations§
Source§impl Path
impl Path
pub fn new() -> Path
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Sourcepub fn current(&self) -> Option<(f64, f64)>
pub fn current(&self) -> Option<(f64, f64)>
the current point (None before the first move_to and after clear)
Sourcepub fn line_to(&mut self, x: f64, y: f64) -> &mut Path
pub fn line_to(&mut self, x: f64, y: f64) -> &mut Path
a straight line from the current point (without one: a move_to)
Sourcepub fn curve_to(
&mut self,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x: f64,
y: f64,
) -> &mut Path
pub fn curve_to( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64, ) -> &mut Path
a cubic Bézier curve with control points (x1, y1) and (x2, y2) to (x, y)
Sourcepub fn quad_to(&mut self, x1: f64, y1: f64, x: f64, y: f64) -> &mut Path
pub fn quad_to(&mut self, x1: f64, y1: f64, x: f64, y: f64) -> &mut Path
a quadratic Bézier curve (written as the same cubic)
Sourcepub fn rect(&mut self, x: f64, y: f64, w: f64, h: f64) -> &mut Path
pub fn rect(&mut self, x: f64, y: f64, w: f64, h: f64) -> &mut Path
a closed rectangle as its own subpath (PDF re)
Sourcepub fn ellipse(&mut self, cx: f64, cy: f64, rx: f64, ry: f64) -> &mut Path
pub fn ellipse(&mut self, cx: f64, cy: f64, rx: f64, ry: f64) -> &mut Path
a closed ellipse around (cx, cy) as four cubic curves
pub fn circle(&mut self, cx: f64, cy: f64, r: f64) -> &mut Path
Sourcepub fn rounded_rect(
&mut self,
x: f64,
y: f64,
w: f64,
h: f64,
r: f64,
) -> &mut Path
pub fn rounded_rect( &mut self, x: f64, y: f64, w: f64, h: f64, r: f64, ) -> &mut Path
a closed rectangle with corners rounded by r (at most half the shorter side)
Sourcepub fn arc(
&mut self,
cx: f64,
cy: f64,
rx: f64,
ry: f64,
start: f64,
sweep: f64,
) -> &mut Path
pub fn arc( &mut self, cx: f64, cy: f64, rx: f64, ry: f64, start: f64, sweep: f64, ) -> &mut Path
an elliptical arc around (cx, cy) from angle start over sweep radians (positive:
from +x towards +y), as cubic curves of at most 90 degrees; it continues the subpath
with a line to its start, or starts one