Class LinearGeometry
- Namespace
- SixLabors.ImageSharp.Drawing
- Assembly
- SixLabors.ImageSharp.Drawing.dll
Represents retained linearized geometry that can be consumed directly by drawing backends.
public sealed class LinearGeometry
- Inheritance
-
LinearGeometry
- Inherited Members
Remarks
A LinearGeometry instance stores contour-local point data plus the metadata required to interpret those points as a sequence of final linear segments.
Closed contours do not duplicate their first point at the end of the stored point run. Closure is represented by IsClosed, and the closing segment is derived by GetSegments().
The retained storage model is:
Constructors
LinearGeometry(LinearGeometryInfo, IReadOnlyList<LinearContour>, IReadOnlyList<PointF>)
Initializes a new instance of the LinearGeometry class.
public LinearGeometry(LinearGeometryInfo info, IReadOnlyList<LinearContour> contours, IReadOnlyList<PointF> points)
Parameters
infoLinearGeometryInfoThe geometry metadata.
contoursIReadOnlyList<LinearContour>The contour metadata.
pointsIReadOnlyList<PointF>The point storage.
Properties
Contours
Gets the contour metadata describing how Points is partitioned.
public IReadOnlyList<LinearContour> Contours { get; }
Property Value
Remarks
Each entry defines one contour's point run and the corresponding segment range in the derived segment stream.
Info
Gets geometry-wide metadata for this retained result.
public LinearGeometryInfo Info { get; }
Property Value
Points
Gets the retained point storage for all contours in this geometry.
public IReadOnlyList<PointF> Points { get; }
Property Value
Remarks
Points are stored per contour in contour order. A closed contour does not repeat its first point at the end of its stored point run.
Methods
CreateOpenPolyline(PointF[])
Creates retained geometry for one open polyline.
public static LinearGeometry CreateOpenPolyline(PointF[] points)
Parameters
pointsPointF[]The polyline points.
Returns
- LinearGeometry
The retained open polyline geometry.
CreateOpenPolyline(PointF[], Vector2)
Creates retained geometry for one open polyline, baked under the supplied device-space scale.
public static LinearGeometry CreateOpenPolyline(PointF[] points, Vector2 scale)
Parameters
Returns
- LinearGeometry
The retained open polyline geometry.
GetSegments()
public SegmentEnumerator GetSegments()
Returns
- SegmentEnumerator
A zero-allocation enumerator that yields the final linear segments in contour order.