Clipper (gb.clipper)
This static class implements the clipping methods.
This class is static.
Constants
CapButt
|
Line ends are squared off without any extension.
|
CapJoined
|
Line ends are joined and the path treated as a polyline.
|
CapPolygon
|
The path is treated as a polygon.
|
CapRound
|
Line ends extend the offset amount while being rounded off.
|
CapSquare
|
Line ends extend the offset amount while being squared off.
|
FillEvenOdd
|
Constant that represents the "Even-odd" polygon fill rule.
|
FillNegative
|
Constant that represents the "Negative" polygon fill rule.
|
FillNonZero
|
Constant that represents the "Non-Zero" or "Winding" polygon fill rule.
|
FillPositive
|
Constant that represents the "Positive" polygon fill rule.
|
FillWinding
|
Constant that represents the "Non-Zero" or "Winding" polygon fill rule.
|
JoinBevel
|
Bevelled joins are similar to squared joins except that squaring won't occur at a fixed distance. While bevelled joins may not be as pretty as squared joins, bevelling is much easier (i.e. faster) than squaring. And perhaps this is why bevelling rather than squaring is preferred in numerous graphics display formats (including SVG and PDF document formats).
|
JoinMiter
|
Edges are first offset a specified distance away from and parallel to their original (i.e. starting) edge positions. These offset edges are then extended to points where they intersect with adjacent edge offsets. However a limit must be imposed on how far mitered vertices can be from their original positions to avoid very convex joins producing unreasonably long and narrow spikes). To avoid unsightly spikes, joins will be squared wherever distances between original vertices and their calculated offsets exceeds a specified value (expressed as a ratio relative to the offset distance).
|
JoinRound
|
Rounding is applied to all convex joins with the arc radius being the offset distance, and the original join vertex the arc center.
|
JoinSquare
|
Convex joins will be truncated using a squaring edge. And the mid-points of these squaring edges will be exactly the offset distance away from their original (or starting) vertices.
|
Static methods
Clean
|
Removes vertices:
|
Difference
|
Compute the difference between Polygons and Clip and return it.
|
ExclusiveOr
|
Compute the exclusive or between Polygons and Clip and return it.
|
Inflate
|
Expand or shrink closed polygons, or inflate opened polylines.
|
Intersection
|
Compute the intersection between Polygons and Clip and return it.
|
Offset
|
This function offsets the Polygons parameter by the Delta amount. Positive delta values expand outer polygons and contract inner 'hole' polygons. Negative deltas do the reverse.
|
Simplify
|
Removes self-intersections from the supplied Polygons (by performing a boolean union operation using the nominated Fill type).
|
Trim
|
Remove the vertices between adjacent collinear segments of each polygon.
|
Union
|
Compute the union between Polygons and Clip and return it.
|
Polygon fill rule
Each polygon or array of polygons must have a fill rule specified when calling
one of the clipping methods:
Difference,
Union,
Intersection,
ExclusiveOr.
That fill rule is a value among one of the following constant:
See this link for more details:
Polygon fill types on the Clipper Library web site.