Struct raqote::PathBuilder

source ·
pub struct PathBuilder {
    path: Path,
}
Expand description

A helper struct used for constructing a Path.

Fields§

§path: Path

Implementations§

source§

impl PathBuilder

source

pub fn new() -> PathBuilder

source

pub fn move_to(&mut self, x: f32, y: f32)

Moves the current point to x, y

source

pub fn line_to(&mut self, x: f32, y: f32)

Adds a line segment from the current point to x, y

source

pub fn quad_to(&mut self, cx: f32, cy: f32, x: f32, y: f32)

Adds a quadratic bezier from the current point to x, y, using a control point of cx, cy

source

pub fn rect(&mut self, x: f32, y: f32, width: f32, height: f32)

Adds a rect to the path

source

pub fn cubic_to( &mut self, cx1: f32, cy1: f32, cx2: f32, cy2: f32, x: f32, y: f32, )

Adds a cubic bezier from the current point to x, y, using control points cx1, cy1 and cx2, cy2

source

pub fn close(&mut self)

Closes the current subpath

source

pub fn arc( &mut self, x: f32, y: f32, r: f32, start_angle: f32, sweep_angle: f32, )

Adds an arc approximated by quadratic beziers with center x, y and radius r starting at start_angle and sweeping by sweep_angle. For a positive sweep_angle the sweep is done clockwise, for a negative sweep_angle the sweep is done counterclockwise.

source

pub fn finish(self) -> Path

Completes the current path

Trait Implementations§

source§

impl From<Path> for PathBuilder

source§

fn from(path: Path) -> Self

Converts to this type from the input type.

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> 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, 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.