expand

fun ShapeContour.expand(weight: Double, join: SegmentJoin = SegmentJoin.MITER, cap: LineCap = LineCap.SQUARE, errorTolerance: Double = 0.05, sampleDistance: Double = 1.0): Shape(source)

Expands this contour into the filled outline of a stroke of width weight.

An open contour is offset by half the weight to both sides, the two offsets are connected at the ends with caps of type cap and the resulting closed outline is resolved with ShapeContour.removeSelfIntersections, such that stretches where the stroke overlaps itself are merged. A closed contour expands to the ring between its outward and inward offsets, cap is not used then.

Parameters

weight

the width of the stroke

join

how the offsets are joined at sharp corners of the contour

cap

how the stroke is closed at the ends of an open contour

errorTolerance

maximum fit error of the offset curves

sampleDistance

distance along the contour between samples used for fitting the offset curves