pub struct PathBuilder { /* private fields */ }Expand description
PathBuilder records commands used to create an immutable Path.
Implementations§
Source§impl PathBuilder
impl PathBuilder
Sourcepub fn line_to(&mut self, p: impl Into<Point>) -> &mut Self
pub fn line_to(&mut self, p: impl Into<Point>) -> &mut Self
line_to adds a straight segment to p.
Sourcepub fn quad_to(&mut self, c: impl Into<Point>, p: impl Into<Point>) -> &mut Self
pub fn quad_to(&mut self, c: impl Into<Point>, p: impl Into<Point>) -> &mut Self
quad_to adds a quadratic Bézier through control point c to p.
Sourcepub fn cubic_to(
&mut self,
c1: impl Into<Point>,
c2: impl Into<Point>,
p: impl Into<Point>,
) -> &mut Self
pub fn cubic_to( &mut self, c1: impl Into<Point>, c2: impl Into<Point>, p: impl Into<Point>, ) -> &mut Self
cubic_to adds a cubic Bézier through two control points to p.
Sourcepub fn close(&mut self) -> &mut Self
pub fn close(&mut self) -> &mut Self
close adds a segment back to the current contour’s starting point.
It has no effect when no contour is open.
Sourcepub fn rrect(&mut self, r: Rect, radius: f32) -> &mut Self
pub fn rrect(&mut self, r: Rect, radius: f32) -> &mut Self
rrect adds a closed rounded rectangle with one corner radius.
Sourcepub fn rrect_radii(&mut self, r: Rect, radii: [f32; 4]) -> &mut Self
pub fn rrect_radii(&mut self, r: Rect, radii: [f32; 4]) -> &mut Self
rrect_radii adds a rounded rectangle with circular corner radii.
radii is ordered clockwise from the top-left.
Sourcepub fn rrect_radii_elliptical(
&mut self,
r: impl Into<Rect>,
radii: [[f32; 2]; 4],
) -> &mut Self
pub fn rrect_radii_elliptical( &mut self, r: impl Into<Rect>, radii: [[f32; 2]; 4], ) -> &mut Self
rrect_radii_elliptical adds per-corner elliptical radii.
Each corner is [x_radius, y_radius], starting at the top-left. Radii
are proportionally reduced when adjacent corners would overlap.
Sourcepub fn rrect_radii_elliptical_wound(
&mut self,
r: impl Into<Rect>,
radii: [[f32; 2]; 4],
winding: Winding,
) -> &mut Self
pub fn rrect_radii_elliptical_wound( &mut self, r: impl Into<Rect>, radii: [[f32; 2]; 4], winding: Winding, ) -> &mut Self
rrect_radii_elliptical_wound adds a rounded rectangle with explicit winding.
Opposing contours cancel under FillRule::NonZero, and dashing follows
this traversal order.
Sourcepub fn arc(
&mut self,
center: impl Into<Point>,
radius: f32,
start_angle: f32,
sweep_angle: f32,
) -> &mut Self
pub fn arc( &mut self, center: impl Into<Point>, radius: f32, start_angle: f32, sweep_angle: f32, ) -> &mut Self
arc adds a circular arc.
Angles are radians clockwise from +x in Valo’s y-down coordinates. Sweeps are limited to one full turn.
Sourcepub fn ellipse(
&mut self,
center: impl Into<Point>,
radii: [f32; 2],
x_axis_rotation: f32,
start_angle: f32,
sweep_angle: f32,
) -> &mut Self
pub fn ellipse( &mut self, center: impl Into<Point>, radii: [f32; 2], x_axis_rotation: f32, start_angle: f32, sweep_angle: f32, ) -> &mut Self
ellipse adds an elliptical arc.
radii are the x and y half-extents, x_axis_rotation turns the
ellipse, and angles are radians clockwise from +x. An active contour is
connected to the arc’s first point. Sweeps are limited to one full turn.
Non-finite input is ignored. Negative radii trigger a debug assertion and are ignored in release builds.
Sourcepub fn arc_to(
&mut self,
corner: impl Into<Point>,
next: impl Into<Point>,
radius: f32,
) -> &mut Self
pub fn arc_to( &mut self, corner: impl Into<Point>, next: impl Into<Point>, radius: f32, ) -> &mut Self
arc_to rounds the corner between the current point, corner, and next.
Zero or negative radius, coincident points, and straight-through corners
fall back to a line ending at corner.
Sourcepub fn circle(&mut self, center: impl Into<Point>, radius: f32) -> &mut Self
pub fn circle(&mut self, center: impl Into<Point>, radius: f32) -> &mut Self
circle adds a closed circular contour.
Trait Implementations§
Source§impl Clone for PathBuilder
impl Clone for PathBuilder
Source§fn clone(&self) -> PathBuilder
fn clone(&self) -> PathBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more