Class Path
Represents a graphical path
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public class Path : IEquatable<Path>, IDisposable
Constructors
| Edit this page View SourcePath()
Represents a graphical path with various drawing commands.
Declaration
public Path()
Path(SKPath)
Initializes a new instance of the Path class with the specified SKPath object.
Declaration
public Path(SKPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| SKPath | path | The SKPath object to initialize the Path with. |
Properties
| Edit this page View SourceBoundingBox
Declaration
public BoundingBox BoundingBox { get; }
Property Value
| Type | Description |
|---|---|
| BoundingBox |
ConvexHull
Declaration
public ConvexHull ConvexHull { get; }
Property Value
| Type | Description |
|---|---|
| ConvexHull |
Methods
| Edit this page View SourceApproximatePathToPolygons(int)
Approximates the path to a collection of polygons.
Declaration
public IEnumerable<Polygon> ApproximatePathToPolygons(int segments)
Parameters
| Type | Name | Description |
|---|---|---|
| int | segments | The number of segments for approximating curves. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Polygon> | An enumerable of polygons approximating the path. |
Remarks
This method approximates the path to a collection of polygons.
ApproximateToMultiPolygon(int)
Approximates the path to a collection of polygons.
Declaration
public MultiPolygon ApproximateToMultiPolygon(int segments)
Parameters
| Type | Name | Description |
|---|---|---|
| int | segments | The number of segments for approximating curves. |
Returns
| Type | Description |
|---|---|
| MultiPolygon | An enumerable of polygons approximating the path. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Equals(Path?)
Compares two paths for equality.
Declaration
public bool Equals(Path? other)
Parameters
| Type | Name | Description |
|---|---|---|
| Path | other |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Paths equality must not change from serialization and deserialization. SKPath can apply some optimizations (e.g. remove redundant commands) when converting to string representation, so we want to avoid performing comparisons on the raw commands from the iterator. Comparisons are instead performed by comparing the precomputed string representations of the paths.
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Edit this page View SourceFromXmlString(string)
Initializes a new instance of the Path class from an XML string.
Declaration
public static Path FromXmlString(string xmlString)
Parameters
| Type | Name | Description |
|---|---|---|
| string | xmlString | The XML string to initialize the instance with. |
Returns
| Type | Description |
|---|---|
| Path |
Remarks
This method initializes a new instance of the Path class from an XML string.
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
| Edit this page View SourceToSvgPath()
Declaration
public SvgPath ToSvgPath()
Returns
| Type | Description |
|---|---|
| SvgPath |
ToXmlString()
Converts the path to an XML string.
Declaration
public string ToXmlString()
Returns
| Type | Description |
|---|---|
| string | The path as an XML string. |
Remarks
This method converts the path to an XML string.
TryConvertToPoints(out PointList?)
Declaration
public bool TryConvertToPoints(out PointList? pointList)
Parameters
| Type | Name | Description |
|---|---|---|
| PointList | pointList |
Returns
| Type | Description |
|---|---|
| bool |
Operators
| Edit this page View Sourceoperator ==(Path?, Path?)
Implements the equality operator.
Declaration
public static bool operator ==(Path? left, Path? right)
Parameters
| Type | Name | Description |
|---|---|---|
| Path | left | The left path to compare. |
| Path | right | The right path to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if the paths are equal, false otherwise. |
operator !=(Path?, Path?)
Implements the inequality operator.
Declaration
public static bool operator !=(Path? left, Path? right)
Parameters
| Type | Name | Description |
|---|---|---|
| Path | left | The left path to compare. |
| Path | right | The right path to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if the paths are not equal, false otherwise. |