pub struct Path { /* private fields */ }Expand description
Represents a geometric path, composed of one or more subpaths.
A Path can be created from an SVG path string and can be iterated over
to process its individual subpaths. It also provides utilities for
analyzing path properties, such as finding the outermost contour.
Implementations§
Source§impl Path
impl Path
Sourcepub fn iter(&self) -> impl Iterator<Item = Path> + '_
pub fn iter(&self) -> impl Iterator<Item = Path> + '_
Returns an iterator over the subpaths of this path.
Each item in the iterator is a Path representing a single subpath.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the path is closed.
A path is considered closed if it ends with a Close event.
Sourcepub fn find_outer_shell(&self) -> Option<Path>
pub fn find_outer_shell(&self) -> Option<Path>
Find and return the subpath that represents the outermost shell.
This method first attempts to use a fast “largest area” heuristic. If that fails to produce a result, it falls back to a more accurate but slower “geometric containment” algorithm.
§Returns
An Option<Path> containing the outermost shell if found, otherwise None.
Trait Implementations§
Source§impl From<&(Coord2, Vec<(Coord2, Coord2, Coord2)>)> for Path
Converts a flo_curves::SimpleBezierPath back into a Path.
impl From<&(Coord2, Vec<(Coord2, Coord2, Coord2)>)> for Path
Converts a flo_curves::SimpleBezierPath back into a Path.
This reconstructs a lyon path from the flo_curves representation. It handles
both lines and cubic curves. The resulting path is explicitly closed by adding a
line segment back to the start point and calling close().
Source§fn from(value: &SimpleBezierPath) -> Self
fn from(value: &SimpleBezierPath) -> Self
Source§impl From<&Path> for SimpleBezierPath
Converts a reference to a Path into a flo_curves::SimpleBezierPath.
impl From<&Path> for SimpleBezierPath
Converts a reference to a Path into a flo_curves::SimpleBezierPath.
This conversion processes the lyon::path::Event stream of the input path:
Event::Line,Event::Cubic: Translated directly toflo_curvesequivalents.Event::Quadratic: Mathematically converted into a cubic Bézier curve, asflo_curvesprimarily works with cubic curves.Event::End: If the path is not marked as closed bylyon, a closing line segment is added to ensure theflo_curvespath is properly closed, which is often a requirement for path algorithms.
Source§fn from(path: &Path) -> SimpleBezierPath
fn from(path: &Path) -> SimpleBezierPath
Source§impl From<&Vec<Curve<Coord2>>> for Path
Converts a vector of flo_curves::Curves into a Path.
impl From<&Vec<Curve<Coord2>>> for Path
Converts a vector of flo_curves::Curves into a Path.
Each Curve is assumed to be a cubic Bézier segment. The conversion creates a
new Path where each curve becomes a separate, unclosed subpath consisting of a
single cubic Bézier segment.
Source§impl From<Path> for Path
Converts a lyon::path::Path into this crate’s Path type.
impl From<Path> for Path
Converts a lyon::path::Path into this crate’s Path type.
Since crate::path::Path is a wrapper around lyon::path::Path, this is a
straightforward conversion.
Source§impl FromStr for Path
Parses a Path from an SVG path data string.
impl FromStr for Path
Parses a Path from an SVG path data string.
§Errors
Returns a PathError if the SVG path data is invalid.
Source§impl<'a> IntoIterator for &'a Path
Implements the IntoIterator trait for references to our Path type.
impl<'a> IntoIterator for &'a Path
Implements the IntoIterator trait for references to our Path type.
This is what allows a &Path to be used directly in a for loop,
transparently creating a SubpathIter to drive the iteration.
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
impl UnwindSafe for Path
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more