Share via


PathF Class

Definition

Represents a geometric path consisting of lines, curves, and shapes using single-precision floating-point coordinates.

public ref class PathF : IDisposable
public class PathF : IDisposable
type PathF = class
    interface IDisposable
Public Class PathF
Implements IDisposable
Inheritance
PathF
Implements

Remarks

A path is composed of one or more sub-paths, each beginning with a Move operation and consisting of connected line segments, curves, and arcs. For fill operations to work reliably, paths should typically be closed using the Close() method or by explicitly connecting the end point back to the starting point.

When creating paths for filling, ensure proper path construction to avoid exceptions during rendering. Paths that start with LineTo(PointF) operations will automatically create an initial MoveTo operation.

Constructors

PathF()

Initializes an empty path with no segments.

PathF(PathF)

Initializes a new path by copying the segments, points, and arc metadata of another PathF.

PathF(PointF)

Initializes a new path whose first (move) point is the specified point.

PathF(Single, Single)

Initializes a new path whose first (move) point is at the specified coordinates.

Properties

Bounds

Gets the axis-aligned bounding box of the path (cached until modified).

Closed

Gets a value indicating whether the last sub-path has been explicitly closed with Close().

Count

Gets the total number of points in the path.

FirstPoint

Gets the first point in the path, or the default value if the path is empty.

Item[Int32]

Gets the point at the specified index, or the default value if the index is out of range.

LastPoint

Gets the last point in the path, or the default value if the path is empty.

LastPointIndex

Gets the index of the last point, or -1 if the path is empty.

OperationCount

Gets the number of segment operations (including move and close) in the path.

PlatformPath

Gets or sets a platform-specific native path object associated with this path. Setting a new value disposes the previous one if disposable.

Points

Enumerates all points used by the path's segments in logical order.

SegmentCountExcludingOpenAndClose

Gets the count of segment operations excluding a leading Move and a trailing Close, if present.

SegmentTypes

Enumerates the sequence of segment operations composing the path.

SubPathCount

Gets the number of sub-paths (contiguous sequences beginning with Move) in the path.

Methods

AddArc(PointF, PointF, Single, Single, Boolean)

Adds an elliptical arc segment to the current sub-path.

AddArc(Single, Single, Single, Single, Single, Single, Boolean)

Adds an elliptical arc segment using coordinate values instead of points.

AppendCircle(PointF, Single)

Appends an approximated circle path centered at the specified point.

AppendCircle(Single, Single, Single)

Appends an approximated circle path centered at the specified point.

AppendEllipse(RectF)

Appends an approximated ellipse path inside the specified rectangle.

AppendEllipse(Single, Single, Single, Single)

Appends an approximated ellipse path (using 4 cubic curves) inside the specified rectangle.

AppendRectangle(RectF, Boolean)

Appends a rectangle path using the specified rectangle bounds.

AppendRectangle(Single, Single, Single, Single, Boolean)

Appends a rectangle path.

AppendRoundedRectangle(RectF, Single, Boolean)

Appends a rounded rectangle using the specified rectangle bounds and uniform corner radius.

AppendRoundedRectangle(RectF, Single, Single, Single, Single, Boolean)

Appends a rounded rectangle using the specified rectangle bounds and individual corner radii.

AppendRoundedRectangle(RectF, Single, Single)

Appends a rounded rectangle using distinct horizontal and vertical radii (elliptical corners).

AppendRoundedRectangle(Single, Single, Single, Single, Single, Boolean)

Appends a rounded rectangle where all four corners share the same radius.

AppendRoundedRectangle(Single, Single, Single, Single, Single, Single, Single, Single, Boolean)

Appends a rounded rectangle specifying individual corner radii.

Close()

Closes the current sub-path by appending a close segment if it is not already closed.

CurveTo(PointF, PointF, PointF)

Adds a cubic Bézier curve segment defined by two control points and an end point.

CurveTo(Single, Single, Single, Single, Single, Single)

Adds a cubic Bézier curve segment using coordinate values.

Dispose()

Releases native resources associated with the path.

Equals(Object, Single)

Determines whether this path and another have equivalent geometry within a tolerance.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetArcAngle(Int32)

Gets an arc angle value at the specified index (stored as degrees).

GetArcClockwise(Int32)

Gets the stored clockwise flag for an arc segment at the specified index.

GetBoundsByFlattening(Single)

Computes bounds by flattening curves with the given flatness, updating the cache.

GetFlattenedPath(Single, Boolean)

Creates a new path consisting only of line segments approximating all curves and arcs.

GetHashCode()

Serves as the default hash function.

GetPointsForSegment(Int32)

Gets the points defining the segment at the specified index.

GetRotatedPoint(Int32, PointF, Single)

Computes the position of a point in the path after rotation about a pivot.

GetSegmentForPoint(Int32)

Determines which segment uses the point at a specified index.

GetSegmentInfo(Int32, Int32, Int32, Int32)

Retrieves segment metadata, returning the segment type and output indices pointing into internal collections.

GetSegmentPointIndex(Int32)

Computes the starting point index in the internal point list for a given segment index.

GetSegmentType(Int32)

Gets the segment operation type at the specified index.

InsertCurveTo(PointF, PointF, PointF, Int32)

Inserts a cubic Bézier segment at a specific segment index.

InsertLineTo(PointF, Int32)

Inserts a line segment at a specific segment index.

InsertQuadTo(PointF, PointF, Int32)

Inserts a quadratic Bézier segment at a specific segment index.

Invalidate()

Clears cached bounds and releases any native platform path.

IsSubPathClosed(Int32)

Indicates whether the specified sub-path is closed.

LineTo(PointF)

Adds a straight line segment to the specified end point (starting a new sub-path if the path is empty).

LineTo(Single, Single)

Adds a straight line segment to the specified coordinates.

Move(Single, Single)

Offsets every point in the path by the specified amounts.

MovePoint(Int32, Single, Single)

Offsets a single point by the specified deltas.

MoveTo(PointF)

Starts a new sub-path at the specified point.

MoveTo(Single, Single)

Starts a new sub-path at the specified coordinates.

Open()

Reopens a previously closed last sub-path by removing its closing segment.

QuadTo(PointF, PointF)

Adds a quadratic Bézier curve segment defined by a control point and an end point.

QuadTo(Single, Single, Single, Single)

Adds a quadratic Bézier curve segment using coordinate values.

RemoveAllSegmentsAfter(Int32)

Removes the specified segment and all segments that follow it.

RemoveSegment(Int32)

Removes a single segment, adjusting internal point and arc data accordingly.

Reverse()

Creates a new path with the segment and point order reversed.

Rotate(Single, PointF)

Creates a new PathF representing this path rotated by the specified angle about a pivot point.

Separate()

Splits the path into individual sub-path objects.

SetArcAngle(Int32, Single)

Sets an arc angle value (degrees) at the specified index.

SetArcClockwise(Int32, Boolean)

Sets the stored clockwise flag for an arc segment.

SetPoint(Int32, PointF)

Sets the point at the specified index.

SetPoint(Int32, Single, Single)

Sets the coordinates of the point at the specified index.

Transform(Matrix3x2)

Applies a 2D affine transformation matrix to all points in the path in place.

Extension Methods

DrawArc(PathF, Single, Single, Single, Single, Single, Single, Single)
SVGArcTo(PathF, Single, Single, Single, Boolean, Boolean, Single, Single, Single, Single)

Adds an SVG arc segment to the path.

AsScaledPath(PathF, Single, Single)

Creates a new path by scaling the target path with separate x and y scale factors.

AsScaledPath(PathF, Single)

Creates a new path by scaling the target path uniformly.

ToDefinitionString(PathF, Single)

Converts a path to an SVG-style path definition string.

AsRotatedAndroidPath(PathF, PointF, Single, Single, Single)

Converts a PathF to a SkiaSharp SKPath with a specified pixels-per-unit value, zoom level, and rotation angle.

AsSkiaPath(PathF, Single, Single, Single, Single, Single)

Converts a PathF to a SkiaSharp SKPath with specified transformation parameters.

AsSkiaPath(PathF, Single, Single)

Converts a PathF to a SkiaSharp SKPath with a specified pixels-per-unit value and zoom level.

AsSkiaPath(PathF, Single)

Converts a PathF to a SkiaSharp SKPath with a specified pixels-per-unit value.

AsSkiaPath(PathF)

Converts a PathF to a SkiaSharp SKPath.

AsSkiaPathFromSegment(PathF, Int32, Single, Single)

Converts a segment of a PathF to a SkiaSharp SKPath with a specified pixels-per-unit value and zoom level.

Applies to