PeachDrawing.Core
PeachDrawing.Core.Geometry.PathOperations
PathOperations.Combine(GraphicsPath, GraphicsPath, PathOperation, GraphicsPath) Method
Adds to destination the outline of the area produced by combining two shapes. Each input is read as a filled area under its own FillMode, with every subpath treated as closed, so an input may have holes and may cross itself. The result is one or more closed subpaths, and destination is set to Nonzero: outer boundaries and holes wind in opposite directions, so filling it reproduces the combined area.
public static void Combine(PeachDrawing.Core.GraphicsPath first, PeachDrawing.Core.GraphicsPath second, PeachDrawing.Core.Geometry.PathOperation operation, PeachDrawing.Core.GraphicsPath destination);
Parameters
first GraphicsPath
the first shape
second GraphicsPath
the second shape
operation PathOperation
how to combine them
destination GraphicsPath
the path the result is added to; create it with GetGraphicsPath() to draw it with that canvas
Exceptions
System.ArgumentNullException
an argument is null
System.ArgumentException
a path has a coordinate that is NaN or infinite
Remarks
A shape may cross itself where <em>different</em> curves of it meet; a single cubic that loops back across itself is not cut at that crossing. Two curves that run along each other for a stretch are handled, but a very long overlap is approximated. Two pieces of an outline are told apart from each other, and from a neighbouring shape’s, at a precision of about a millionth of the inputs’ overall size. Boundaries that come closer than that are treated as touching, and a sliver thinner than that may be lost.