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
| Edit this page 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
| Edit this page View SourceAddArc(Point, int, int, int, int, int)
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 Point of the ellipse from which the arc is taken. |
int | radiusX | The x-radius of the ellipsis. |
int | radiusY | The y-radius of the ellipsis. |
int | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
int | 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). |
int | sweepAngle | The angle between |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddArc(PointF, float, float, float, bool, bool, 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. |
float | radiusX | The x-radius of the ellipsis. |
float | radiusY | The y-radius of the ellipsis. |
float | rotation | The rotation along the X-axis; measured in degrees clockwise. |
bool | 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. |
bool | 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, float, float, float, float, float)
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 PointF of the ellipse from which the arc is taken. |
float | radiusX | The x-radius of the ellipsis. |
float | radiusY | The y-radius of the ellipsis. |
float | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
float | 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). |
float | sweepAngle | The angle between |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddArc(Rectangle, int, int, int)
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 Rectangle that represents the rectangular bounds of the ellipse from which the arc is taken. |
int | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
int | 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). |
int | sweepAngle | The angle between |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddArc(RectangleF, float, float, float)
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 RectangleF that represents the rectangular bounds of the ellipse from which the arc is taken. |
float | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
float | 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). |
float | sweepAngle | The angle between |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddArc(int, int, int, int, int, int, int)
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 |
---|---|---|
int | x | The x-coordinate of the center point of the ellipse from which the arc is taken. |
int | y | The y-coordinate of the center point of the ellipse from which the arc is taken. |
int | radiusX | The x-radius of the ellipsis. |
int | radiusY | The y-radius of the ellipsis. |
int | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
int | 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). |
int | sweepAngle | The angle between |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddArc(float, float, float, float, float, float, float)
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 |
---|---|---|
float | x | The x-coordinate of the center point of the ellipse from which the arc is taken. |
float | y | The y-coordinate of the center point of the ellipse from which the arc is taken. |
float | radiusX | The x-radius of the ellipsis. |
float | radiusY | The y-radius of the ellipsis. |
float | rotation | The angle, in degrees, from the x-axis of the current coordinate system to the x-axis of the ellipse. |
float | 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). |
float | 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(float, float, float, float)
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 |
---|---|---|
float | x1 | The x1. |
float | y1 | The y1. |
float | x2 | The x2. |
float | y2 | The y2. |
Returns
Type | Description |
---|---|
PathBuilder | The PathBuilder. |
AddLines(params 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(float, float, float, bool, bool, 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 |
---|---|---|
float | radiusX | The x-radius of the ellipsis. |
float | radiusY | The y-radius of the ellipsis. |
float | rotation | The rotation along the X-axis; measured in degrees clockwise. |
bool | 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. |
bool | 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 quadratic 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(float, float)
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 |
---|---|---|
float | x | The x. |
float | 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 quadratic 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 resetting 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 transform 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 transform)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | transform | The transform. |
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. |