Table of Contents

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:

  • Points stores the concatenated point data for every contour.
  • Contours maps each contour to its point run and derived segment range.
  • Info exposes geometry-wide metadata such as bounds and total segment count.

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

info LinearGeometryInfo

The geometry metadata.

contours IReadOnlyList<LinearContour>

The contour metadata.

points IReadOnlyList<PointF>

The point storage.

Properties

Contours

Gets the contour metadata describing how Points is partitioned.

public IReadOnlyList<LinearContour> Contours { get; }

Property Value

IReadOnlyList<LinearContour>

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

LinearGeometryInfo

Points

Gets the retained point storage for all contours in this geometry.

public IReadOnlyList<PointF> Points { get; }

Property Value

IReadOnlyList<PointF>

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

points PointF[]

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

points PointF[]

The polyline points.

scale Vector2

The X/Y scale at which the polyline is baked.

Returns

LinearGeometry

The retained open polyline geometry.

GetSegments()

Gets an enumerator for the derived linear segments represented by Points and Contours.

public SegmentEnumerator GetSegments()

Returns

SegmentEnumerator

A zero-allocation enumerator that yields the final linear segments in contour order.