Edit

SKPathBuilder Class

Definition

A mutable builder for constructing SKPath objects incrementally.

public class SKPathBuilder : SkiaSharp.SKObject
Inheritance

Examples

Building a triangle path:

using var builder = new SKPathBuilder();
builder.MoveTo(0, 0);
builder.LineTo(100, 0);
builder.LineTo(50, 100);
builder.Close();
using var path = builder.Detach();

Remarks

`SKPathBuilder` provides a mutable API for assembling path contours before producing an <xref:SkiaSharp.SKPath>. Unlike `SKPath`, which is a sealed, immutable representation, `SKPathBuilder` is designed for incremental construction.

Use <xref:SkiaSharp.SKPathBuilder.Snapshot> to obtain a read-only copy of the current path without resetting the builder, or <xref:SkiaSharp.SKPathBuilder.Detach> to transfer ownership of the path to the caller and reset the builder.

`SKPathBuilder` extends <xref:SkiaSharp.SKObject> and must be disposed when no longer needed.

Constructors

Name Description
SKPathBuilder()

Initializes a new, empty instance of the SKPathBuilder class.

SKPathBuilder(SKPath)

Initializes a new instance of the SKPathBuilder class with the contours of the specified path.

Properties

Name Description
FillType

Gets or sets the fill type rule used when the path is converted to an SKPath.

Handle

Gets or sets the handle to the underlying native object.

(Inherited from SKObject)
IgnorePublicDispose

Gets a value indicating whether the call the public Dispose() should be no-op.

(Inherited from SKNativeObject)
IsDisposed

Gets a value indicating whether the object has already been disposed.

(Inherited from SKNativeObject)
OwnsHandle

Gets or sets a value indicating whether this object owns its handle and should destroy the native object when it is disposed.

(Inherited from SKNativeObject)

Methods

Name Description
AddArc(SKRect, Single, Single)

Appends an arc of the specified oval as a new contour.

AddCircle(Single, Single, Single, SKPathDirection)

Appends a circle contour to the path.

AddOval(SKRect, SKPathDirection)

Appends an oval contour to the path.

AddPath(SKPath, Single, Single, SKPathAddMode)

Appends the contours from another path, translated by the specified offset, to this builder.

AddPath(SKPath, SKMatrix, SKPathAddMode)

Appends the contours from another path, transformed by a matrix, to this builder.

AddPath(SKPath, SKPathAddMode)

Appends the contours from another path to this builder.

AddPoly(ReadOnlySpan<SKPoint>, Boolean)

Appends a polygon contour defined by the specified span of points.

AddPoly(SKPoint[], Boolean)

Appends a polygon contour defined by the specified points.

AddRect(SKRect, SKPathDirection, UInt32)

Appends a rectangle contour to the path, starting at the specified corner.

AddRect(SKRect, SKPathDirection)

Appends a rectangle contour to the path.

AddRoundRect(SKRect, Single, Single, SKPathDirection)

Appends a round rectangle contour with the specified corner radii to the path.

AddRoundRect(SKRoundRect, SKPathDirection, UInt32)

Appends a round rectangle contour to the path, starting at the specified point index.

AddRoundRect(SKRoundRect, SKPathDirection)

Appends a round rectangle contour to the path.

ArcTo(Single, Single, Single, Single, Single)

Appends a circular arc to the current contour using two tangent points specified as coordinates.

ArcTo(Single, Single, Single, SKPathArcSize, SKPathDirection, Single, Single)

Appends an SVG-style elliptical arc to the current contour using separate radius and endpoint coordinates.

ArcTo(SKPoint, Single, SKPathArcSize, SKPathDirection, SKPoint)

Appends an SVG-style elliptical arc to the current contour.

ArcTo(SKPoint, SKPoint, Single)

Appends a circular arc to the current contour using two tangent points.

ArcTo(SKRect, Single, Single, Boolean)

Appends an arc of the specified oval to the current contour.

Close()

Closes the current contour by appending a line to its starting point.

ConicTo(Single, Single, Single, Single, Single)

Appends a weighted conic curve to the current contour using coordinate values.

ConicTo(SKPoint, SKPoint, Single)

Appends a weighted conic curve to the current contour.

CubicTo(Single, Single, Single, Single, Single, Single)

Appends a cubic Bézier curve to the current contour using coordinate values.

CubicTo(SKPoint, SKPoint, SKPoint)

Appends a cubic Bézier curve to the current contour.

Detach()

Returns the built path and resets this builder to an empty state.

Dispose()

Releases all resources used by this SKNativeObject.

(Inherited from SKNativeObject)
Dispose(Boolean)

Releases the resources used by this SKPathBuilder.

DisposeInternal()

Triggers a dispose, ignoring the value of IgnorePublicDispose.

(Inherited from SKNativeObject)
DisposeManaged()

Implemented by derived SKObject types to destroy any managed objects.

(Inherited from SKObject)
DisposeNative()

Releases the native resources held by this SKPathBuilder.

DisposeUnownedManaged()

Implemented by derived SKObject types to dispose managed objects that are not owned by this instance.

(Inherited from SKObject)
LineTo(Single, Single)

Appends a straight line segment from the current point to the specified coordinates.

LineTo(SKPoint)

Appends a straight line segment from the current point to the specified point.

MoveTo(Single, Single)

Begins a new contour at the specified coordinates.

MoveTo(SKPoint)

Begins a new contour at the specified point.

QuadTo(Single, Single, Single, Single)

Appends a quadratic Bézier curve to the current contour using coordinate values.

QuadTo(SKPoint, SKPoint)

Appends a quadratic Bézier curve to the current contour.

RArcTo(Single, Single, Single, SKPathArcSize, SKPathDirection, Single, Single)

Appends a relative SVG-style elliptical arc to the current contour using separate radius and offset coordinates.

RArcTo(SKPoint, Single, SKPathArcSize, SKPathDirection, SKPoint)

Appends a relative SVG-style elliptical arc to the current contour.

RConicTo(Single, Single, Single, Single, Single)

Appends a relative weighted conic curve to the current contour using offset coordinates.

RConicTo(SKPoint, SKPoint, Single)

Appends a relative weighted conic curve to the current contour.

RCubicTo(Single, Single, Single, Single, Single, Single)

Appends a relative cubic Bézier curve to the current contour using offset coordinates.

RCubicTo(SKPoint, SKPoint, SKPoint)

Appends a relative cubic Bézier curve to the current contour.

Reset()

Resets this builder to an empty state, discarding all contours and resetting the fill type to the default.

ReverseAddPath(SKPath)

Appends the contours from another path in reverse order.

RLineTo(Single, Single)

Appends a relative straight line segment from the current point using the specified offset coordinates.

RLineTo(SKPoint)

Appends a relative straight line segment from the current point using the specified offset.

RMoveTo(Single, Single)

Begins a new contour at a position offset from the current point by the specified coordinates.

RMoveTo(SKPoint)

Begins a new contour at a point offset from the current point.

RQuadTo(Single, Single, Single, Single)

Appends a relative quadratic Bézier curve to the current contour using offset coordinates.

RQuadTo(SKPoint, SKPoint)

Appends a relative quadratic Bézier curve to the current contour.

Snapshot()

Returns a snapshot of the current path without modifying this builder.

Applies to