Class Path
A aggregate of ILineSegments making a single logical path.
Inherited Members
Namespace: SixLabors.ImageSharp.Drawing
Assembly: SixLabors.ImageSharp.Drawing.dll
Syntax
public class Path : ISimplePath, IPath
Constructors
| Edit this page View SourcePath(params ILineSegment[])
Initializes a new instance of the Path class.
Declaration
public Path(params ILineSegment[] segments)
Parameters
Type | Name | Description |
---|---|---|
ILineSegment[] | segments | The segments. |
Path(Path)
Initializes a new instance of the Path class.
Declaration
public Path(Path path)
Parameters
Type | Name | Description |
---|---|---|
Path | path | The path. |
Path(PointF[])
Initializes a new instance of the Path class.
Declaration
public Path(PointF[] points)
Parameters
Type | Name | Description |
---|---|---|
PointF[] | points | The collection of points; processed as a series of linear line segments. |
Path(IEnumerable<ILineSegment>)
Initializes a new instance of the Path class.
Declaration
public Path(IEnumerable<ILineSegment> segments)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ILineSegment> | segments | The segments. |
Properties
| Edit this page View SourceBounds
Gets the bounds enclosing the path.
Declaration
public RectangleF Bounds { get; }
Property Value
Type | Description |
---|---|
RectangleF |
Empty
Gets the default empty path.
Declaration
public static IPath Empty { get; }
Property Value
Type | Description |
---|---|
IPath |
IsClosed
Gets a value indicating whether this instance is a closed path.
Declaration
public virtual bool IsClosed { get; }
Property Value
Type | Description |
---|---|
bool |
LineSegments
Gets readonly collection of line segments.
Declaration
public IReadOnlyList<ILineSegment> LineSegments { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ILineSegment> |
PathType
Gets a value indicating whether this instance is closed, open or a composite path with a mixture of open and closed figures.
Declaration
public PathTypes PathType { get; }
Property Value
Type | Description |
---|---|
PathTypes |
Points
Gets the points that make this up as a simple linear path.
Declaration
public ReadOnlyMemory<PointF> Points { get; }
Property Value
Type | Description |
---|---|
ReadOnlyMemory<PointF> |
Methods
| Edit this page View SourceAsClosedPath()
Returns this path with all figures closed.
Declaration
public IPath AsClosedPath()
Returns
Type | Description |
---|---|
IPath | A new close IPath. |
Flatten()
Converts the IPath into a simple linear path.
Declaration
public IEnumerable<ISimplePath> Flatten()
Returns
Type | Description |
---|---|
IEnumerable<ISimplePath> | Returns the current IPath as simple linear path. |
Transform(Matrix3x2)
Transforms the path using the specified matrix.
Declaration
public virtual IPath Transform(Matrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix3x2 | matrix | The matrix. |
Returns
Type | Description |
---|---|
IPath | A new path with the matrix applied to it. |
TryParseSvgPath(ReadOnlySpan<char>, out IPath?)
Converts an SVG path string into an IPath.
Declaration
public static bool TryParseSvgPath(ReadOnlySpan<char> svgPath, out IPath? value)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<char> | svgPath | The string containing the SVG path data. |
IPath | value | When this method returns, contains the logic path converted from the given SVG path string; otherwise, null. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
bool | true if the input value can be parsed and converted; otherwise, false. |
TryParseSvgPath(string, out IPath?)
Converts an SVG path string into an IPath.
Declaration
public static bool TryParseSvgPath(string svgPath, out IPath? value)
Parameters
Type | Name | Description |
---|---|---|
string | svgPath | The string containing the SVG path data. |
IPath | value | When this method returns, contains the logic path converted from the given SVG path string; otherwise, null. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
bool | true if the input value can be parsed and converted; otherwise, false. |