Table of Contents

Class PolygonStroker

Namespace
SixLabors.PolygonClipper
Assembly
SixLabors.PolygonClipper.dll

Generates polygonal stroke geometry for contours with configurable joins and caps.

public sealed class PolygonStroker
Inheritance
PolygonStroker
Inherited Members

Remarks

This type performs two phases:

  1. Expand each source contour into one or two stroke-side outlines with joins/caps.
  2. Optionally resolve generated overlaps/self-intersections using Normalize(Polygon) with positive fill semantics.

The emitted contours are implicitly closed (first vertex is not duplicated at the end).

The static Stroke(Polygon, double, StrokeOptions?) method is the recommended entry point. It routes calls through an internal thread-local pool of reusable stroker instances and automatically resets temporary state between calls.

Instance members are not thread-safe for concurrent use.

Constructors

PolygonStroker(StrokeOptions)

Initializes a new instance of the PolygonStroker class with the specified stroke options.

public PolygonStroker(StrokeOptions options)

Parameters

options StrokeOptions

The stroke options.

Remarks

This constructor is intended for advanced/manual usage. For typical call patterns, prefer the static Stroke(Polygon, double, StrokeOptions?) method to use internal pooling automatically.

Exceptions

ArgumentNullException

Thrown when options is null.

Properties

ArcDetailScale

Gets the tessellation detail scale used for round joins and round caps. Higher values produce more vertices and smoother curves.

public double ArcDetailScale { get; }

Property Value

double

LineCap

Gets the line cap style used for open path ends.

public LineCap LineCap { get; }

Property Value

LineCap

LineJoin

Gets the outer line join style used for stroking corners.

public LineJoin LineJoin { get; }

Property Value

LineJoin

MiterLimit

Gets the miter limit used to clamp outer miter joins.

public double MiterLimit { get; }

Property Value

double

NormalizeOutput

Gets a value indicating whether generated contours should be normalized by resolving self-intersections and overlaps.

public bool NormalizeOutput { get; }

Property Value

bool

Width

Gets or sets the stroke width.

public double Width { get; set; }

Property Value

double

Remarks

Positive values produce conventional outward stroking. Negative values are supported and flip the side orientation while preserving magnitude.

Methods

Stroke(Polygon)

Strokes polygon using this instance's configured options and width.

public Polygon Stroke(Polygon polygon)

Parameters

polygon Polygon

Input polygon to stroke.

Returns

Polygon

The stroked polygon contours.

Remarks

Instance execution is not thread-safe for concurrent use.

Exceptions

ArgumentNullException

Thrown when polygon is null.

Stroke(Polygon, double)

Strokes polygon after setting the current stroke width.

public Polygon Stroke(Polygon polygon, double width)

Parameters

polygon Polygon

Input polygon to stroke.

width double

Stroke width.

Returns

Polygon

The stroked polygon contours.

Remarks

Instance execution is not thread-safe for concurrent use.

Stroke(Polygon, double, StrokeOptions?)

Strokes polygon with width using optional options.

public static Polygon Stroke(Polygon polygon, double width, StrokeOptions? options = null)

Parameters

polygon Polygon

Input polygon to stroke.

width double

Stroke width.

options StrokeOptions

Stroke options controlling joins, caps and approximation behavior. When null, default StrokeOptions are used.

Returns

Polygon

The stroked polygon contours.

Remarks

Preferred entry point. Uses internal thread-local reusable instances.

Exceptions

ArgumentNullException

Thrown when polygon is null.