pub struct NoAttributes<B: PathBuilder> { /* private fields */ }
Expand description
A convenience wrapper for PathBuilder
without custom attributes.
See the PathBuilder trait.
This simply forwards to an underlying PathBuilder
implementation,
using no attributes.
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 moresource§impl<B: Debug + PathBuilder> Debug for NoAttributes<B>
impl<B: Debug + PathBuilder> Debug for NoAttributes<B>
source§impl<B: PathBuilder + Default> Default for NoAttributes<B>
impl<B: PathBuilder + Default> Default for NoAttributes<B>
source§impl<B: Hash + PathBuilder> Hash for NoAttributes<B>
impl<B: Hash + PathBuilder> Hash for NoAttributes<B>
source§impl<B: PartialEq + PathBuilder> PartialEq for NoAttributes<B>
impl<B: PartialEq + PathBuilder> PartialEq for NoAttributes<B>
source§impl<B: PathBuilder> PathBuilder for NoAttributes<B>
impl<B: PathBuilder> PathBuilder for NoAttributes<B>
fn num_attributes(&self) -> usize
source§fn begin(&mut self, at: Point, _attributes: Attributes<'_>) -> EndpointId
fn begin(&mut self, at: Point, _attributes: Attributes<'_>) -> EndpointId
source§fn line_to(&mut self, to: Point, _attributes: Attributes<'_>) -> EndpointId
fn line_to(&mut self, to: Point, _attributes: Attributes<'_>) -> EndpointId
source§fn quadratic_bezier_to(
&mut self,
ctrl: Point,
to: Point,
_attributes: Attributes<'_>,
) -> EndpointId
fn quadratic_bezier_to( &mut self, ctrl: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId
source§fn cubic_bezier_to(
&mut self,
ctrl1: Point,
ctrl2: Point,
to: Point,
_attributes: Attributes<'_>,
) -> EndpointId
fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId
source§fn reserve(&mut self, endpoints: usize, ctrl_points: usize)
fn reserve(&mut self, endpoints: usize, ctrl_points: usize)
source§fn path_event(&mut self, event: PathEvent, attributes: Attributes<'_>)
fn path_event(&mut self, event: PathEvent, attributes: Attributes<'_>)
fn event(&mut self, event: Event<(Point, Attributes<'_>), Point>)
source§fn add_polygon(
&mut self,
polygon: Polygon<'_, Point>,
attributes: Attributes<'_>,
)
fn add_polygon( &mut self, polygon: Polygon<'_, Point>, attributes: Attributes<'_>, )
source§fn add_point(&mut self, at: Point, attributes: Attributes<'_>) -> EndpointId
fn add_point(&mut self, at: Point, attributes: Attributes<'_>) -> EndpointId
source§fn add_line_segment(
&mut self,
line: &LineSegment<f32>,
attributes: Attributes<'_>,
) -> (EndpointId, EndpointId)
fn add_line_segment( &mut self, line: &LineSegment<f32>, attributes: Attributes<'_>, ) -> (EndpointId, EndpointId)
source§fn add_ellipse(
&mut self,
center: Point,
radii: Vector,
x_rotation: Angle,
winding: Winding,
attributes: Attributes<'_>,
)
fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, winding: Winding, attributes: Attributes<'_>, )
source§fn add_circle(
&mut self,
center: Point,
radius: f32,
winding: Winding,
attributes: Attributes<'_>,
)where
Self: Sized,
fn add_circle(
&mut self,
center: Point,
radius: f32,
winding: Winding,
attributes: Attributes<'_>,
)where
Self: Sized,
source§fn add_rectangle(
&mut self,
rect: &Box2D,
winding: Winding,
attributes: Attributes<'_>,
)
fn add_rectangle( &mut self, rect: &Box2D, winding: Winding, attributes: Attributes<'_>, )
source§fn add_rounded_rectangle(
&mut self,
rect: &Box2D,
radii: &BorderRadii,
winding: Winding,
custom_attributes: Attributes<'_>,
)where
Self: Sized,
fn add_rounded_rectangle(
&mut self,
rect: &Box2D,
radii: &BorderRadii,
winding: Winding,
custom_attributes: Attributes<'_>,
)where
Self: Sized,
source§fn flattened(self, tolerance: f32) -> Flattened<Self>where
Self: Sized,
fn flattened(self, tolerance: f32) -> Flattened<Self>where
Self: Sized,
source§fn transformed<Transform>(
self,
transform: Transform,
) -> Transformed<Self, Transform>
fn transformed<Transform>( self, transform: Transform, ) -> Transformed<Self, Transform>
impl<B: PathBuilder> StructuralPartialEq for NoAttributes<B>
Auto Trait Implementations§
impl<B> Freeze for NoAttributes<B>where
B: Freeze,
impl<B> RefUnwindSafe for NoAttributes<B>where
B: RefUnwindSafe,
impl<B> Send for NoAttributes<B>where
B: Send,
impl<B> Sync for NoAttributes<B>where
B: Sync,
impl<B> Unpin for NoAttributes<B>where
B: Unpin,
impl<B> UnwindSafe for NoAttributes<B>where
B: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)