System.Drawing.Drawing2D.GraphicsPath.Clone C# (CSharp) Method

Clone() public method

public Clone ( ) : object
return object
        public object Clone()
        {
            var copy = new GraphicsPath (fillMode);
            copy.points = new List<PointF> (points);
            copy.types = new List<byte> (types);
            copy.start_new_fig = start_new_fig;

            return copy;
        }

Usage Example

Exemplo n.º 1
0
        public static Image GetRegionImage(Image surfaceImage, GraphicsPath regionFillPath, GraphicsPath regionDrawPath, SurfaceOptions options)
        {
            if (regionFillPath != null)
            {
                Image img;

                Rectangle regionArea = Rectangle.Round(regionFillPath.GetBounds());
                Rectangle screenRectangle = CaptureHelpers.GetScreenBounds0Based();
                Rectangle newRegionArea = Rectangle.Intersect(regionArea, screenRectangle);

                using (GraphicsPath gp = (GraphicsPath)regionFillPath.Clone())
                {
                    MoveGraphicsPath(gp, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y));
                    img = ImageHelpers.CropImage(surfaceImage, newRegionArea, gp);

                    if (options.DrawBorder)
                    {
                        GraphicsPath gpOutline = regionDrawPath ?? regionFillPath;

                        using (GraphicsPath gp2 = (GraphicsPath)gpOutline.Clone())
                        {
                            MoveGraphicsPath(gp2, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y));
                            img = ImageHelpers.DrawOutline(img, gp2);
                        }
                    }
                }

                return img;
            }

            return null;
        }
All Usage Examples Of System.Drawing.Drawing2D.GraphicsPath::Clone