lyon_path::builder

Struct WithSvg

source
pub struct WithSvg<Builder: PathBuilder> { /* private fields */ }
Expand description

Implements an SVG-like building interface on top of a PathBuilder.

Implementations§

source§

impl<Builder: PathBuilder> WithSvg<Builder>

source

pub fn new(builder: Builder) -> Self

source

pub fn build(self) -> Builder::PathType
where Builder: Build,

source

pub fn flattened(self, tolerance: f32) -> WithSvg<Flattened<Builder>>

source

pub fn transformed<Transform>( self, transform: Transform, ) -> WithSvg<Transformed<Builder, Transform>>
where Transform: Transformation<f32>,

source

pub fn move_to(&mut self, to: Point) -> EndpointId

source

pub fn line_to(&mut self, to: Point) -> EndpointId

source

pub fn close(&mut self)

source

pub fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point) -> EndpointId

source

pub fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, ) -> EndpointId

source

pub fn arc( &mut self, center: Point, radii: Vector, sweep_angle: Angle, x_rotation: Angle, )

source

pub fn current_position(&self) -> Point

source

pub fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

source§

impl<Builder, Transform> WithSvg<Transformed<Builder, Transform>>
where Builder: PathBuilder, Transform: Transformation<f32>,

source

pub fn set_transform(&mut self, transform: Transform)

Trait Implementations§

source§

impl<Builder: PathBuilder + Build> Build for WithSvg<Builder>

source§

type PathType = <Builder as Build>::PathType

The type of object that is created by this builder.
source§

fn build(self) -> Builder::PathType

Builds a path object, consuming the builder.
source§

impl<Builder: PathBuilder> SvgPathBuilder for WithSvg<Builder>

source§

fn move_to(&mut self, to: Point)

Start a new sub-path at the given position. Read more
source§

fn close(&mut self)

Ends the current sub-path by connecting it back to its initial point. Read more
source§

fn line_to(&mut self, to: Point)

Adds a line segment to the current sub-path. Read more
source§

fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point)

Adds a quadratic bézier segment to the current sub-path. Read more
source§

fn cubic_bezier_to(&mut self, ctrl1: Point, ctrl2: Point, to: Point)

Adds a cubic bézier segment to the current sub-path. Read more
source§

fn relative_move_to(&mut self, to: Vector)

Equivalent to move_to in relative coordinates. Read more
source§

fn relative_line_to(&mut self, to: Vector)

Equivalent to line_to in relative coordinates. Read more
source§

fn relative_quadratic_bezier_to(&mut self, ctrl: Vector, to: Vector)

Equivalent to quadratic_bezier_to in relative coordinates. Read more
source§

fn relative_cubic_bezier_to(&mut self, ctrl1: Vector, ctrl2: Vector, to: Vector)

Equivalent to cubic_bezier_to in relative coordinates. Read more
source§

fn smooth_cubic_bezier_to(&mut self, ctrl2: Point, to: Point)

Equivalent to cubic_bezier_to with implicit first control point. Read more
source§

fn smooth_relative_cubic_bezier_to(&mut self, ctrl2: Vector, to: Vector)

Equivalent to smooth_cubic_bezier_to in relative coordinates. Read more
source§

fn smooth_quadratic_bezier_to(&mut self, to: Point)

Equivalent to quadratic_bezier_to with implicit control point. Read more
source§

fn smooth_relative_quadratic_bezier_to(&mut self, to: Vector)

Equivalent to smooth_quadratic_bezier_to in relative coordinates. Read more
source§

fn horizontal_line_to(&mut self, x: f32)

Adds an horizontal line segment. Read more
source§

fn relative_horizontal_line_to(&mut self, dx: f32)

Adds an horizontal line segment in relative coordinates. Read more
source§

fn vertical_line_to(&mut self, y: f32)

Adds a vertical line segment. Read more
source§

fn relative_vertical_line_to(&mut self, dy: f32)

Adds a vertical line segment in relative coordinates. Read more
source§

fn arc_to( &mut self, radii: Vector, x_rotation: Angle, flags: ArcFlags, to: Point, )

Adds an elliptical arc. Read more
source§

fn relative_arc_to( &mut self, radii: Vector, x_rotation: Angle, flags: ArcFlags, to: Vector, )

Equivalent to arc_to in relative coordinates. Read more
source§

fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

Hints at the builder that a certain number of endpoints and control points will be added. Read more
source§

fn add_polygon(&mut self, polygon: Polygon<'_, Point>)

Adds a sub-path from a polygon. Read more

Auto Trait Implementations§

§

impl<Builder> Freeze for WithSvg<Builder>
where Builder: Freeze,

§

impl<Builder> RefUnwindSafe for WithSvg<Builder>
where Builder: RefUnwindSafe,

§

impl<Builder> Send for WithSvg<Builder>
where Builder: Send,

§

impl<Builder> Sync for WithSvg<Builder>
where Builder: Sync,

§

impl<Builder> Unpin for WithSvg<Builder>
where Builder: Unpin,

§

impl<Builder> UnwindSafe for WithSvg<Builder>
where Builder: UnwindSafe,

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.