PathBuilder Class

Builds a PathData.

public sealed class PathBuilder

Constructors

NameDescription
PathBuilder()

PathBuilder()

PathBuilder.cs
public PathBuilder()

No documentation is available.

Properties

NameDescription
IsEmptyGets a value that indicates whether no command was added.

Gets a value that indicates whether no command was added.

public bool IsEmpty { get; }

Property value

bool

Methods

NameDescription
AddCircle(double, double, double)Adds a circle, as two half arcs, clockwise.
AddEllipse(double, double, double, double)Adds an ellipse, as four cubic Bézier curves, clockwise from its rightmost point.
AddPolygon(ReadOnlySpan<(double X, double Y)>)Adds a closed polygon through points, in order. Nothing is added when there are no points.
AddRectangle(double, double, double, double)Adds a rectangle, clockwise.
AddRoundedRectangle(double, double, double, double, double)Adds a rectangle with rounded corners, clockwise. The corners are quarters of a circle, as cubic Bézier curves.
Append(PathData)Adds the commands of a path, unchanged.
ArcTo(double, double, double, bool, bool, double, double)Draws an elliptical arc, as the SVG A command.
Build()Creates the path.
Close()Closes the current contour.
CubicTo(double, double, double, double, double, double)Draws a cubic Bézier curve.
LineTo(double, double)Draws a straight line.
MoveTo(double, double)Starts a new contour.
QuadraticTo(double, double, double, double)Draws a quadratic Bézier curve.

AddCircle(double, double, double)

PathBuilder.cs

Adds a circle, as two half arcs, clockwise.

public PathBuilder AddCircle(double centerX, double centerY, double radius)

Parameters

centerX double
The x coordinate of the center.
centerY double
The y coordinate of the center.
radius double
The radius.

Returns

PathBuilder The builder.

AddEllipse(double, double, double, double)

PathBuilder.cs

Adds an ellipse, as four cubic Bézier curves, clockwise from its rightmost point.

public PathBuilder AddEllipse(double centerX, double centerY, double radiusX, double radiusY)

Parameters

centerX double
The x coordinate of the center.
centerY double
The y coordinate of the center.
radiusX double
The x radius.
radiusY double
The y radius.

Returns

PathBuilder The builder.

AddPolygon(ReadOnlySpan<(double X, double Y)>)

PathBuilder.cs

Adds a closed polygon through points, in order. Nothing is added when there are no points.

public PathBuilder AddPolygon(params scoped ReadOnlySpan<(double X, double Y)> points)

Parameters

points ReadOnlySpan<(double X, double Y)>
The vertices of the polygon.

Returns

PathBuilder The builder.

AddRectangle(double, double, double, double)

PathBuilder.cs

Adds a rectangle, clockwise.

public PathBuilder AddRectangle(double x, double y, double width, double height)

Parameters

x double
The left edge.
y double
The top edge.
width double
The width.
height double
The height.

Returns

PathBuilder The builder.

AddRoundedRectangle(double, double, double, double, double)

PathBuilder.cs

Adds a rectangle with rounded corners, clockwise. The corners are quarters of a circle, as cubic Bézier curves.

public PathBuilder AddRoundedRectangle(double x, double y, double width, double height, double radius)

Parameters

x double
The left edge.
y double
The top edge.
width double
The width.
height double
The height.
radius double
The radius of the corners, limited to half the smaller side. When it is not positive, the rectangle is the same as PathBuilder.AddRectangle.

Returns

PathBuilder The builder.

Append(PathData)

PathBuilder.cs

Adds the commands of a path, unchanged.

public PathBuilder Append(PathData path)

Parameters

path PathData
The path.

Returns

PathBuilder The builder.

ArcTo(double, double, double, bool, bool, double, double)

PathBuilder.cs

Draws an elliptical arc, as the SVG A command.

public PathBuilder ArcTo(double radiusX, double radiusY, double rotation, bool largeArc, bool sweep, double x, double y)

Parameters

radiusX double
The x radius.
radiusY double
The y radius.
rotation double
The rotation of the ellipse, in degrees.
largeArc bool
Whether the arc is the larger of the two candidate arcs.
sweep bool
Whether the arc is drawn clockwise.
x double
The x coordinate of the end.
y double
The y coordinate of the end.

Returns

PathBuilder The builder.

Creates the path.

public PathData Build()

Returns

PathData The path.

Closes the current contour.

public PathBuilder Close()

Returns

PathBuilder The builder.

CubicTo(double, double, double, double, double, double)

PathBuilder.cs

Draws a cubic Bézier curve.

public PathBuilder CubicTo(double x1, double y1, double x2, double y2, double x, double y)

Parameters

x1 double
The x coordinate of the first control point.
y1 double
The y coordinate of the first control point.
x2 double
The x coordinate of the second control point.
y2 double
The y coordinate of the second control point.
x double
The x coordinate of the end.
y double
The y coordinate of the end.

Returns

PathBuilder The builder.

LineTo(double, double)

PathBuilder.cs

Draws a straight line.

public PathBuilder LineTo(double x, double y)

Parameters

x double
The x coordinate of the end.
y double
The y coordinate of the end.

Returns

PathBuilder The builder.

MoveTo(double, double)

PathBuilder.cs

Starts a new contour.

public PathBuilder MoveTo(double x, double y)

Parameters

x double
The x coordinate of the start.
y double
The y coordinate of the start.

Returns

PathBuilder The builder.

QuadraticTo(double, double, double, double)

PathBuilder.cs

Draws a quadratic Bézier curve.

public PathBuilder QuadraticTo(double x1, double y1, double x, double y)

Parameters

x1 double
The x coordinate of the control point.
y1 double
The y coordinate of the control point.
x double
The x coordinate of the end.
y double
The y coordinate of the end.

Returns

PathBuilder The builder.