Пример #1
0
        public DrawableMulti ToMultiPolygon(bool disposePath = true)
        {
            DrawableMulti multi = new DrawableMulti();

            if (Path == null)
            {
                return(null);
            }

            using (GraphicsPathIterator iterator = new GraphicsPathIterator(Path)) {
                GraphicsPath subpath = new GraphicsPath();
                bool         closed;
                while (iterator.NextSubpath(subpath, out closed) != 0)
                {
                    DrawablePolygon shape = new DrawablePolygon {
                        Points    = subpath.PathPoints,
                        Brush     = Brush,
                        Pen       = Pen,
                        PenClosed = closed
                    };
                    multi.Shapes.Add(shape);
                }
                subpath.Dispose();
            }

            if (disposePath)
            {
                Path?.Dispose();
            }

            return(multi);
        }
Пример #2
0
        public DrawablePolygon ToPolygon(bool disposePath = true)
        {
            DrawablePolygon shape = new DrawablePolygon {
                Points    = Path?.PathPoints,
                Brush     = Brush,
                Pen       = Pen,
                PenClosed = false
            };

            if (disposePath)
            {
                Path?.Dispose();
            }
            return(shape);
        }