private IEnumerable <IPath> Clip(IPath shape, params IPath[] hole) { var clipper = new Clipper(); clipper.AddPath(shape, ClippingType.Subject); if (hole != null) { foreach (IPath s in hole) { clipper.AddPath(s, ClippingType.Clip); } } return(clipper.GenerateClippedShapes()); }
/// <summary> /// Clips the specified holes. /// </summary> /// <param name="shape">The shape.</param> /// <param name="holes">The holes.</param> /// <returns>Returns a new shape with the holes cliped out out the shape.</returns> public static IPath Clip(this IPath shape, IEnumerable <IPath> holes) { Clipper clipper = new PolygonClipper.Clipper(); clipper.AddPath(shape, ClippingType.Subject); clipper.AddPaths(holes, ClippingType.Clip); IEnumerable <IPath> result = clipper.GenerateClippedShapes(); return(new ComplexPolygon(result)); }