Class PathBuilder
Allow you to derivatively build shapes and paths.
Inherited Members
Namespace: SixLabors.ImageSharp.Drawing
Assembly: SixLabors.ImageSharp.Drawing.dll
Syntax
public class PathBuilder
Constructors
| Improve this Doc View SourcePathBuilder()
Initializes a new instance of the PathBuilder class.
Declaration
public PathBuilder()
PathBuilder(Matrix3x2)
Initializes a new instance of the PathBuilder class.
Declaration
public PathBuilder(Matrix3x2 defaultTransform)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3x2 | defaultTransform | The default transform. |
Methods
| Improve this Doc View SourceAddArc(Point, Int32, Int32, Int32, Int32, Int32)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(Point center, int radiusX, int radiusY, int rotation, int startAngle, int sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | center | The center |
| Int32 | radiusX | The x-radius of the ellipsis. |
| Int32 | radiusY | The y-radius of the ellipsis. |
| Int32 | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Int32 | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Int32 | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(PointF, Single, Single, Single, Boolean, Boolean, PointF)
Adds an elliptical arc to the current figure. The arc curves from the startPoint to endPoint,
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
The arc sweep is always less than 360 degrees. The method appends a line
to the last point if either radii are zero, or if last point is equal to endPoint.
In addition the method scales the radii to fit last point and endPoint if both
are greater than zero but too small to describe an arc.
Declaration
public PathBuilder AddArc(PointF startPoint, float radiusX, float radiusY, float rotation, bool largeArc, bool sweep, PointF endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | startPoint | The start point of the arc. |
| Single | radiusX | The x-radius of the ellipsis. |
| Single | radiusY | The y-radius of the ellipsis. |
| Single | rotation | The rotation along the X-axis; measured in degrees clockwise. |
| Boolean | largeArc | The large arc flag, and is false if an arc spanning less than or equal to 180 degrees is chosen, or true if an arc spanning greater than 180 degrees is chosen. |
| Boolean | sweep | The sweep flag, and is false if the line joining center to arc sweeps through decreasing angles, or true if it sweeps through increasing angles. |
| PointF | endPoint | The end point of the arc. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(PointF, Single, Single, Single, Single, Single)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(PointF center, float radiusX, float radiusY, float rotation, float startAngle, float sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | center | The center |
| Single | radiusX | The x-radius of the ellipsis. |
| Single | radiusY | The y-radius of the ellipsis. |
| Single | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Single | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Single | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(Rectangle, Int32, Int32, Int32)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(Rectangle rectangle, int rotation, int startAngle, int sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| Rectangle | rectangle | A |
| Int32 | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Int32 | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Int32 | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(RectangleF, Single, Single, Single)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(RectangleF rectangle, float rotation, float startAngle, float sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| RectangleF | rectangle | A |
| Single | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Single | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Single | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(int x, int y, int radiusX, int radiusY, int rotation, int startAngle, int sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | x | The x-coordinate of the center point of the ellipse from which the arc is taken. |
| Int32 | y | The y-coordinate of the center point of the ellipse from which the arc is taken. |
| Int32 | radiusX | The x-radius of the ellipsis. |
| Int32 | radiusY | The y-radius of the ellipsis. |
| Int32 | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Int32 | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Int32 | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddArc(Single, Single, Single, Single, Single, Single, Single)
Adds an elliptical arc to the current figure.
Declaration
public PathBuilder AddArc(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float sweepAngle)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | The x-coordinate of the center point of the ellipse from which the arc is taken. |
| Single | y | The y-coordinate of the center point of the ellipse from which the arc is taken. |
| Single | radiusX | The x-radius of the ellipsis. |
| Single | radiusY | The y-radius of the ellipsis. |
| Single | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
| Single | startAngle | The start angle of the elliptical arc prior to the stretch and rotate operations. (0 is at the 3 o'clock position of the arc's circle). |
| Single | sweepAngle | The angle between |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddCubicBezier(PointF, PointF, PointF, PointF)
Adds a cubic bezier curve to the current figure joining the startPoint point to the endPoint.
Declaration
public PathBuilder AddCubicBezier(PointF startPoint, PointF controlPoint1, PointF controlPoint2, PointF endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | startPoint | The start point. |
| PointF | controlPoint1 | The control point1. |
| PointF | controlPoint2 | The control point2. |
| PointF | endPoint | The end point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddLine(PointF, PointF)
Adds the line connecting the current point to the new point.
Declaration
public PathBuilder AddLine(PointF start, PointF end)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | start | The start. |
| PointF | end | The end. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddLine(Single, Single, Single, Single)
Adds the line connecting the current point to the new point.
Declaration
public PathBuilder AddLine(float x1, float y1, float x2, float y2)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x1 | The x1. |
| Single | y1 | The y1. |
| Single | x2 | The x2. |
| Single | y2 | The y2. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddLines(PointF[])
Adds a series of line segments connecting the current point to the new points.
Declaration
public PathBuilder AddLines(params PointF[] points)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF[] | points | The points. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddLines(IEnumerable<PointF>)
Adds a series of line segments connecting the current point to the new points.
Declaration
public PathBuilder AddLines(IEnumerable<PointF> points)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<PointF> | points | The points. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddQuadraticBezier(PointF, PointF, PointF)
Adds a quadratic bezier curve to the current figure joining the startPoint point to the endPoint.
Declaration
public PathBuilder AddQuadraticBezier(PointF startPoint, PointF controlPoint, PointF endPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | startPoint | The start point. |
| PointF | controlPoint | The control point1. |
| PointF | endPoint | The end point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
AddSegment(ILineSegment)
Adds the segment.
Declaration
public PathBuilder AddSegment(ILineSegment segment)
Parameters
| Type | Name | Description |
|---|---|---|
| ILineSegment | segment | The segment. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
ArcTo(Single, Single, Single, Boolean, Boolean, PointF)
Adds an elliptical arc to the current figure. The arc curves from the last point to point,
choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
The arc sweep is always less than 360 degrees. The method appends a line
to the last point if either radii are zero, or if last point is equal to point.
In addition the method scales the radii to fit last point and point if both
are greater than zero but too small to describe an arc.
Declaration
public PathBuilder ArcTo(float radiusX, float radiusY, float rotation, bool largeArc, bool sweep, PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | radiusX | The x-radius of the ellipsis. |
| Single | radiusY | The y-radius of the ellipsis. |
| Single | rotation | The rotation along the X-axis; measured in degrees clockwise. |
| Boolean | largeArc | The large arc flag, and is false if an arc spanning less than or equal to 180 degrees is chosen, or true if an arc spanning greater than 180 degrees is chosen. |
| Boolean | sweep | The sweep flag, and is false if the line joining center to arc sweeps through decreasing angles, or true if it sweeps through increasing angles. |
| PointF | point | The end point of the arc. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
Build()
Builds a complex polygon from the current working set of working operations.
Declaration
public IPath Build()
Returns
| Type | Description |
|---|---|
| IPath | The current set of operations as a complex polygon |
Clear()
Clears all drawn paths, Leaving any applied transforms.
Declaration
public void Clear()
CloseAllFigures()
Closes the current figure.
Declaration
public PathBuilder CloseAllFigures()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
CloseFigure()
Closes the current figure.
Declaration
public PathBuilder CloseFigure()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
CubicBezierTo(Vector2, Vector2, Vector2)
Draws a quadratics bezier from the current point to the point
Declaration
public PathBuilder CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdControlPoint, Vector2 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | secondControlPoint | The second control point. |
| Vector2 | thirdControlPoint | The third control point. |
| Vector2 | point | The point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
LineTo(PointF)
Draws the line connecting the current the current point to the new point.
Declaration
public PathBuilder LineTo(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
LineTo(Single, Single)
Draws the line connecting the current the current point to the new point.
Declaration
public PathBuilder LineTo(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | x | The x. |
| Single | y | The y. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder |
MoveTo(PointF)
Moves to current point to the supplied vector.
Declaration
public PathBuilder MoveTo(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
QuadraticBezierTo(Vector2, Vector2)
Draws a quadratics bezier from the current point to the point
Declaration
public PathBuilder QuadraticBezierTo(Vector2 secondControlPoint, Vector2 point)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | secondControlPoint | The second control point. |
| Vector2 | point | The point. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
Reset()
Resets this instance, clearing any drawn paths and reseting any transforms.
Declaration
public PathBuilder Reset()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
ResetOrigin()
Resets the origin to the default.
Declaration
public PathBuilder ResetOrigin()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
ResetTransform()
Resets the translation to the default.
Declaration
public PathBuilder ResetTransform()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
SetOrigin(PointF)
Sets the origin all subsequent point should be relative to.
Declaration
public PathBuilder SetOrigin(PointF origin)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | origin | The origin. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
SetTransform(Matrix3x2)
Sets the translation to be applied to all items to follow being applied to the PathBuilder.
Declaration
public PathBuilder SetTransform(Matrix3x2 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3x2 | translation | The translation. |
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |
StartFigure()
Starts a new figure but leaves the previous one open.
Declaration
public PathBuilder StartFigure()
Returns
| Type | Description |
|---|---|
| PathBuilder | The PathBuilder. |