pub type Builder = NoAttributes<BuilderImpl>;
Aliased Type§
struct Builder { /* private fields */ }
Implementations
Source§impl<B: PathBuilder> NoAttributes<B>
impl<B: PathBuilder> NoAttributes<B>
pub fn wrap(inner: B) -> Self
pub fn new() -> Selfwhere
B: Default,
pub fn with_capacity(endpoints: usize, ctrl_points: usize) -> Selfwhere
B: Default,
Sourcepub fn begin(&mut self, at: Point) -> EndpointId
pub fn begin(&mut self, at: Point) -> 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.
Sourcepub fn end(&mut self, close: bool)
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.
Sourcepub fn line_to(&mut self, to: Point) -> EndpointId
pub fn line_to(&mut self, to: Point) -> EndpointId
Adds a line segment to the current sub-path.
A sub-path must be in progress when this method is called.
Sourcepub fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point) -> EndpointId
pub fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point) -> EndpointId
Adds a quadratic bézier curve to the current sub-path.
A sub-path must be in progress when this method is called.
Sourcepub fn cubic_bezier_to(
&mut self,
ctrl1: Point,
ctrl2: Point,
to: Point,
) -> EndpointId
pub fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, ) -> EndpointId
Adds a cubic bézier curve to the current sub-path.
A sub-path must be in progress when this method is called.
Sourcepub fn reserve(&mut self, endpoints: usize, ctrl_points: usize)
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.
Sourcepub fn path_event(&mut self, event: PathEvent)
pub fn path_event(&mut self, event: PathEvent)
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.
Sourcepub fn add_polygon(&mut self, polygon: Polygon<'_, Point>)
pub fn add_polygon(&mut self, polygon: Polygon<'_, Point>)
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.
Sourcepub fn add_point(&mut self, at: Point) -> EndpointId
pub fn add_point(&mut self, at: Point) -> 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.
Sourcepub fn add_line_segment(
&mut self,
line: &LineSegment<f32>,
) -> (EndpointId, EndpointId)
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.
Sourcepub fn add_ellipse(
&mut self,
center: Point,
radii: Vector,
x_rotation: Angle,
winding: Winding,
)
pub fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, 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.
Sourcepub fn add_circle(&mut self, center: Point, radius: f32, winding: Winding)where
B: Sized,
pub fn add_circle(&mut self, center: Point, radius: f32, winding: Winding)where
B: Sized,
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.
Sourcepub fn add_rectangle(&mut self, rect: &Box2D, winding: Winding)
pub fn add_rectangle(&mut self, rect: &Box2D, 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.
Sourcepub fn add_rounded_rectangle(
&mut self,
rect: &Box2D,
radii: &BorderRadii,
winding: Winding,
)where
B: Sized,
pub fn add_rounded_rectangle(
&mut self,
rect: &Box2D,
radii: &BorderRadii,
winding: Winding,
)where
B: Sized,
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.
Sourcepub fn flattened(self, tolerance: f32) -> NoAttributes<Flattened<B>>where
B: Sized,
pub fn flattened(self, tolerance: f32) -> NoAttributes<Flattened<B>>where
B: Sized,
Returns a builder that approximates all curves with sequences of line segments.
Sourcepub fn transformed<Transform>(
self,
transform: Transform,
) -> NoAttributes<Transformed<B, Transform>>
pub fn transformed<Transform>( self, transform: Transform, ) -> NoAttributes<Transformed<B, Transform>>
Returns a builder that applies the given transformation to all positions.
Sourcepub fn with_svg(self) -> WithSvg<B>where
B: Sized,
pub fn with_svg(self) -> WithSvg<B>where
B: Sized,
Returns a builder that support SVG commands.
This must be called before starting to add any sub-path.
Sourcepub fn build<P>(self) -> Pwhere
B: Build<PathType = P>,
pub fn build<P>(self) -> Pwhere
B: Build<PathType = P>,
Builds a path object, consuming the builder.
pub fn inner(&self) -> &B
pub fn inner_mut(&mut self) -> &mut B
pub fn into_inner(self) -> B
Source§impl NoAttributes<BuilderImpl>
impl NoAttributes<BuilderImpl>
pub fn extend_from_paths(&mut self, paths: &[PathSlice<'_>])
Trait Implementations
Source§impl<B: PathBuilder + Build> Build for NoAttributes<B>
impl<B: PathBuilder + Build> Build for NoAttributes<B>
Source§impl<B: Clone + PathBuilder> Clone for NoAttributes<B>
impl<B: Clone + PathBuilder> Clone for NoAttributes<B>
Source§fn clone(&self) -> NoAttributes<B>
fn clone(&self) -> NoAttributes<B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more