Table of Contents

Class Path

Namespace
SixLabors.ImageSharp.Drawing
Assembly
SixLabors.ImageSharp.Drawing.dll

A aggregate of ILineSegments making a single logical path.

public class Path : ISimplePath, IPath
Inheritance
Path
Implements
Derived
Inherited Members
Extension Methods

Constructors

Path(params ILineSegment[])

Initializes a new instance of the Path class.

public Path(params ILineSegment[] segments)

Parameters

segments ILineSegment[]

The segments.

Path(Path)

Initializes a new instance of the Path class.

public Path(Path path)

Parameters

path Path

The path.

Path(PointF[])

Initializes a new instance of the Path class.

public Path(PointF[] points)

Parameters

points PointF[]

The collection of points; processed as a series of linear line segments.

Path(IEnumerable<ILineSegment>)

Initializes a new instance of the Path class.

public Path(IEnumerable<ILineSegment> segments)

Parameters

segments IEnumerable<ILineSegment>

The segments.

Properties

Bounds

Gets the bounds enclosing the path.

public RectangleF Bounds { get; }

Property Value

RectangleF

Empty

Gets the default empty path.

public static IPath Empty { get; }

Property Value

IPath

IsClosed

Gets a value indicating whether this instance is a closed path.

public virtual bool IsClosed { get; }

Property Value

bool

LineSegments

Gets readonly collection of line segments.

public IReadOnlyList<ILineSegment> LineSegments { get; }

Property Value

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.

public PathTypes PathType { get; }

Property Value

PathTypes

Points

Gets the points that make this up as a simple linear path.

public ReadOnlyMemory<PointF> Points { get; }

Property Value

ReadOnlyMemory<PointF>

Methods

AsClosedPath()

Returns this path with all figures closed.

public IPath AsClosedPath()

Returns

IPath

A new close IPath.

Flatten()

Converts the IPath into a simple linear path.

public IEnumerable<ISimplePath> Flatten()

Returns

IEnumerable<ISimplePath>

Returns the current IPath as simple linear path.

ToLinearGeometry(Vector2)

Converts this path into a retained LinearGeometry, flattening curves at the precision of the supplied device-space scale.

public virtual LinearGeometry ToLinearGeometry(Vector2 scale)

Parameters

scale Vector2

The X/Y scale at which curves are flattened.

Returns

LinearGeometry

The retained linear geometry.

Transform(Matrix4x4)

Transforms the path using the specified matrix.

public virtual IPath Transform(Matrix4x4 matrix)

Parameters

matrix Matrix4x4

The matrix.

Returns

IPath

A new path with the matrix applied to it.

TryParseSvgPath(ReadOnlySpan<char>, out IPath?)

Converts an SVG path string into an IPath.

public static bool TryParseSvgPath(ReadOnlySpan<char> svgPath, out IPath? value)

Parameters

svgPath ReadOnlySpan<char>

The string containing the SVG path data.

value IPath

When this method returns, contains the logic path converted from the given SVG path string; otherwise, null. This parameter is passed uninitialized.

Returns

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.

public static bool TryParseSvgPath(string svgPath, out IPath? value)

Parameters

svgPath string

The string containing the SVG path data.

value IPath

When this method returns, contains the logic path converted from the given SVG path string; otherwise, null. This parameter is passed uninitialized.

Returns

bool

true if the input value can be parsed and converted; otherwise, false.

See Also