pub struct Path { /* private fields */ }Expand description
A 2D geometric path.
Implementations§
Source§impl Path
impl Path
Sourcepub fn set_fill_type(&mut self, fill_type: FillType)
pub fn set_fill_type(&mut self, fill_type: FillType)
Set the fill type.
Sourcepub fn verb_count(&self) -> usize
pub fn verb_count(&self) -> usize
Get the number of verbs.
Sourcepub fn point_count(&self) -> usize
pub fn point_count(&self) -> usize
Get the number of points.
Sourcepub fn last_point(&self) -> Option<Point>
pub fn last_point(&self) -> Option<Point>
Get the last point in the path.
Sourcepub fn contour_count(&self) -> usize
pub fn contour_count(&self) -> usize
Get the number of contours in the path.
Sourcepub fn is_oval(&self) -> bool
pub fn is_oval(&self) -> bool
Returns true if this path is a simple oval (ellipse).
Verifies both verb structure (Move, 4 curves, Close) AND that the curve endpoints lie on the cardinal points of the bounding ellipse (left, right, top, bottom). This rejects 4-cubic paths that share the verb pattern but have arbitrary geometry.
Sourcepub fn convexity(&self) -> PathConvexity
pub fn convexity(&self) -> PathConvexity
Get the convexity of the path.
Sourcepub fn direction(&self) -> Option<PathDirection>
pub fn direction(&self) -> Option<PathDirection>
Get the direction of the first contour.
Sourcepub fn transformed(&self, matrix: &Matrix) -> Self
pub fn transformed(&self, matrix: &Matrix) -> Self
Create a transformed copy of the path.
Sourcepub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
Check if a point is inside the path (using fill rule).
Sourcepub fn tight_bounds(&self) -> Rect
pub fn tight_bounds(&self) -> Rect
Returns the tight bounding rectangle of this path.
Unlike bounds(), this computes the bounds from the actual curve
extents, not the control-point bounding box. For cubic and quadratic
Bezier curves with control points outside the actual curve range,
tight_bounds() may be significantly smaller than bounds().
Conics fall back to control-polygon bounds (exact extrema for rational curves would require solving a quartic).
Trait Implementations§
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