Skip to main content

PathBuilder

Struct PathBuilder 

Source
pub struct PathBuilder { /* private fields */ }
Expand description

PathBuilder records commands used to create an immutable Path.

Implementations§

Source§

impl PathBuilder

Source

pub fn new() -> Self

new creates an empty path builder.

Source

pub fn move_to(&mut self, p: impl Into<Point>) -> &mut Self

move_to starts a new contour at p.

Source

pub fn line_to(&mut self, p: impl Into<Point>) -> &mut Self

line_to adds a straight segment to p.

Source

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.

Source

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.

Source

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.

Source

pub fn rect(&mut self, r: Rect) -> &mut Self

rect adds a closed rectangular contour.

Source

pub fn rrect(&mut self, r: Rect, radius: f32) -> &mut Self

rrect adds a closed rounded rectangle with one corner radius.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn circle(&mut self, center: impl Into<Point>, radius: f32) -> &mut Self

circle adds a closed circular contour.

Source

pub fn append(&mut self, path: &Path, transform: &Matrix) -> &mut Self

append adds a transformed copy of another path.

The appended path’s final contour becomes the current contour for subsequent commands.

Source

pub fn build(self) -> Arc<Path>

build consumes the builder and returns a shared immutable path.

Trait Implementations§

Source§

impl Clone for PathBuilder

Source§

fn clone(&self) -> PathBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for PathBuilder

Source§

fn default() -> PathBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.