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:
- Expand each source contour into one or two stroke-side outlines with joins/caps.
- 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
optionsStrokeOptionsThe 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
optionsis 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
LineCap
Gets the line cap style used for open path ends.
public LineCap LineCap { get; }
Property Value
LineJoin
Gets the outer line join style used for stroking corners.
public LineJoin LineJoin { get; }
Property Value
MiterLimit
Gets the miter limit used to clamp outer miter joins.
public double MiterLimit { get; }
Property Value
NormalizeOutput
Gets a value indicating whether generated contours should be normalized by resolving self-intersections and overlaps.
public bool NormalizeOutput { get; }
Property Value
Width
Gets or sets the stroke width.
public double Width { get; set; }
Property Value
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
polygonPolygonInput polygon to stroke.
Returns
- Polygon
The stroked polygon contours.
Remarks
Instance execution is not thread-safe for concurrent use.
Exceptions
- ArgumentNullException
Thrown when
polygonis null.
Stroke(Polygon, double)
Strokes polygon after setting the current stroke width.
public Polygon Stroke(Polygon polygon, double width)
Parameters
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
polygonPolygonInput polygon to stroke.
widthdoubleStroke width.
optionsStrokeOptionsStroke 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
polygonis null.