示例#1
0
        /// <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));
        }
示例#2
0
        /// <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 IShape Clip(this IShape shape, IEnumerable <IShape> holes)
        {
            var clipper = new PolygonClipper.Clipper();

            clipper.AddShape(shape, ClippingType.Subject);
            clipper.AddShapes(holes, ClippingType.Clip);
            var result = clipper.GenerateClippedShapes();

            return(new ComplexPolygon(result));
        }
示例#3
0
        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());
        }