cosmic::widget::canvas::path::lyon_path

Type Alias Builder

source
pub type Builder = NoAttributes<BuilderImpl>;

Aliased Type§

struct Builder { /* private fields */ }

Implementations

source§

impl<B> NoAttributes<B>
where B: PathBuilder,

source

pub fn wrap(inner: B) -> NoAttributes<B>

source

pub fn new() -> NoAttributes<B>
where B: Default,

source

pub fn with_capacity(endpoints: usize, ctrl_points: usize) -> NoAttributes<B>
where B: Default,

source

pub fn begin(&mut self, at: Point2D<f32, UnknownUnit>) -> EndpointId

Starts a new sub-path at a given position.

There must be no sub-path in progress when this method is called. at becomes the current position of the sub-path.

source

pub fn end(&mut self, close: bool)

Ends the current sub path.

A sub-path must be in progress when this method is called. After this method is called, there is no sub-path in progress until begin is called again.

source

pub fn close(&mut self)

Closes the current sub path.

Shorthand for builder.end(true).

source

pub fn line_to(&mut self, to: Point2D<f32, UnknownUnit>) -> EndpointId

Adds a line segment to the current sub-path.

A sub-path must be in progress when this method is called.

source

pub fn quadratic_bezier_to( &mut self, ctrl: Point2D<f32, UnknownUnit>, to: Point2D<f32, UnknownUnit>, ) -> EndpointId

Adds a quadratic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

source

pub fn cubic_bezier_to( &mut self, ctrl1: Point2D<f32, UnknownUnit>, ctrl2: Point2D<f32, UnknownUnit>, to: Point2D<f32, UnknownUnit>, ) -> EndpointId

Adds a cubic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

source

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

The Builder implementation may use this information to pre-allocate memory as an optimization.

source

pub fn path_event( &mut self, event: Event<Point2D<f32, UnknownUnit>, Point2D<f32, UnknownUnit>>, )

Applies the provided path event.

By default this calls one of begin, end, line, quadratic_bezier_segment, or cubic_bezier_segment according to the path event.

The requirements for each method apply to the corresponding event.

source

pub fn add_polygon(&mut self, polygon: Polygon<'_, Point2D<f32, UnknownUnit>>)

Adds a sub-path from a polygon.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_point(&mut self, at: Point2D<f32, UnknownUnit>) -> EndpointId

Adds a sub-path containing a single point.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_line_segment( &mut self, line: &LineSegment<f32>, ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_ellipse( &mut self, center: Point2D<f32, UnknownUnit>, radii: Vector2D<f32, UnknownUnit>, x_rotation: Angle<f32>, winding: Winding, )

Adds a sub-path containing an ellipse.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_circle( &mut self, center: Point2D<f32, UnknownUnit>, radius: f32, winding: Winding, )

Adds a sub-path containing a circle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_rectangle( &mut self, rect: &Box2D<f32, UnknownUnit>, winding: Winding, )

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn add_rounded_rectangle( &mut self, rect: &Box2D<f32, UnknownUnit>, radii: &BorderRadii, winding: Winding, )

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

source

pub fn flattened(self, tolerance: f32) -> NoAttributes<Flattened<B>>

Returns a builder that approximates all curves with sequences of line segments.

source

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

Returns a builder that applies the given transformation to all positions.

source

pub fn with_svg(self) -> WithSvg<B>

Returns a builder that support SVG commands.

This must be called before starting to add any sub-path.

source

pub fn build<P>(self) -> P
where B: Build<PathType = P>,

Builds a path object, consuming the builder.

source

pub fn inner(&self) -> &B

source

pub fn inner_mut(&mut self) -> &mut B

source

pub fn into_inner(self) -> B

source§

impl NoAttributes<BuilderImpl>

source

pub fn extend_from_paths(&mut self, paths: &[PathSlice<'_>])

Trait Implementations

source§

impl<B> Build for NoAttributes<B>
where B: PathBuilder + Build,

source§

type PathType = <B as Build>::PathType

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

fn build(self) -> <B as Build>::PathType

Builds a path object, consuming the builder.
source§

impl<B> Clone for NoAttributes<B>
where B: Clone + PathBuilder,

source§

fn clone(&self) -> NoAttributes<B>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<B> Debug for NoAttributes<B>
where B: Debug + PathBuilder,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<B> Default for NoAttributes<B>
where B: PathBuilder + Default,

source§

fn default() -> NoAttributes<B>

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

impl<B> Hash for NoAttributes<B>
where B: Hash + PathBuilder,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<B> PartialEq for NoAttributes<B>

source§

fn eq(&self, other: &NoAttributes<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<B> PathBuilder for NoAttributes<B>
where B: PathBuilder,

source§

fn num_attributes(&self) -> usize

source§

fn begin( &mut self, at: Point2D<f32, UnknownUnit>, _attributes: &[f32], ) -> EndpointId

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

fn end(&mut self, close: bool)

Ends the current sub path. Read more
source§

fn line_to( &mut self, to: Point2D<f32, UnknownUnit>, _attributes: &[f32], ) -> EndpointId

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

fn quadratic_bezier_to( &mut self, ctrl: Point2D<f32, UnknownUnit>, to: Point2D<f32, UnknownUnit>, _attributes: &[f32], ) -> EndpointId

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

fn cubic_bezier_to( &mut self, ctrl1: Point2D<f32, UnknownUnit>, ctrl2: Point2D<f32, UnknownUnit>, to: Point2D<f32, UnknownUnit>, _attributes: &[f32], ) -> EndpointId

Adds a cubic bézier curve to the current sub-path. 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 close(&mut self)

Closes the current sub path. Read more
source§

fn path_event( &mut self, event: Event<Point2D<f32, UnknownUnit>, Point2D<f32, UnknownUnit>>, attributes: &[f32], )

Applies the provided path event. Read more
source§

fn event( &mut self, event: Event<(Point2D<f32, UnknownUnit>, &[f32]), Point2D<f32, UnknownUnit>>, )

source§

fn add_polygon( &mut self, polygon: Polygon<'_, Point2D<f32, UnknownUnit>>, attributes: &[f32], )

Adds a sub-path from a polygon. Read more
source§

fn add_point( &mut self, at: Point2D<f32, UnknownUnit>, attributes: &[f32], ) -> EndpointId

Adds a sub-path containing a single point. Read more
source§

fn add_line_segment( &mut self, line: &LineSegment<f32>, attributes: &[f32], ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment. Read more
source§

fn add_ellipse( &mut self, center: Point2D<f32, UnknownUnit>, radii: Vector2D<f32, UnknownUnit>, x_rotation: Angle<f32>, winding: Winding, attributes: &[f32], )

Adds a sub-path containing an ellipse. Read more
source§

fn add_circle( &mut self, center: Point2D<f32, UnknownUnit>, radius: f32, winding: Winding, attributes: &[f32], )
where Self: Sized,

Adds a sub-path containing a circle. Read more
source§

fn add_rectangle( &mut self, rect: &Box2D<f32, UnknownUnit>, winding: Winding, attributes: &[f32], )

Adds a sub-path containing a rectangle. Read more
source§

fn add_rounded_rectangle( &mut self, rect: &Box2D<f32, UnknownUnit>, radii: &BorderRadii, winding: Winding, custom_attributes: &[f32], )
where Self: Sized,

Adds a sub-path containing a rectangle. Read more
source§

fn flattened(self, tolerance: f32) -> Flattened<Self>
where Self: Sized,

Returns a builder that approximates all curves with sequences of line segments.
source§

fn transformed<Transform>( self, transform: Transform, ) -> Transformed<Self, Transform>
where Self: Sized, Transform: Transformation<f32>,

Returns a builder that applies the given transformation to all positions.
source§

fn with_svg(self) -> WithSvg<Self>
where Self: Sized,

Returns a builder that support SVG commands. Read more
source§

impl<B> StructuralPartialEq for NoAttributes<B>
where B: PathBuilder,