當前位置: 首頁>>代碼示例>>C#>>正文


C# GraphicsPath.Clone方法代碼示例

本文整理匯總了C#中System.Drawing.Drawing2D.GraphicsPath.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# GraphicsPath.Clone方法的具體用法?C# GraphicsPath.Clone怎麽用?C# GraphicsPath.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Drawing2D.GraphicsPath的用法示例。


在下文中一共展示了GraphicsPath.Clone方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetRegionImage

        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;
        }
開發者ID:TreeSeed,項目名稱:ShareX,代碼行數:32,代碼來源:ShapeCaptureHelpers.cs

示例2: Read

 ///<summary>
 /// Converts a <see cref="GraphicsPath"/> to a Geometry, flattening it first.
 ///</summary>
 /// <param name="shp">The <see cref="GraphicsPath"/></param>
 /// <param name="flatness">The flatness parameter to use</param>
 /// <param name="geomFact">The GeometryFactory to use</param>
 /// <returns>A Geometry representing the shape</returns>
 public static IGeometry Read(GraphicsPath shp, double flatness, IGeometryFactory geomFact)
 {
     var path = (GraphicsPath)shp.Clone();
     path.Flatten(InvertY, (float)flatness);
     var pathIt = new GraphicsPathIterator(path);
     return Read(pathIt, geomFact);
 }
開發者ID:russcam,項目名稱:Nhibernate.Spatial,代碼行數:14,代碼來源:GraphicsPathReader.cs

示例3: ApplyRegionPathToImage

        public static Image ApplyRegionPathToImage(Image backgroundImage, GraphicsPath regionFillPath, RegionCaptureOptions options)
        {
            if (backgroundImage != null && 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())
                {
                    using (Matrix matrix = new Matrix())
                    {
                        gp.CloseFigure();
                        matrix.Translate(-Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y));
                        gp.Transform(matrix);
                    }

                    img = ImageHelpers.CropImage(backgroundImage, newRegionArea, gp);
                }

                return img;
            }

            return null;
        }
開發者ID:RailTracker,項目名稱:ShareX,代碼行數:27,代碼來源:RegionCaptureHelpers.cs

示例4: ClipPath

        public static GraphicsPath ClipPath(GraphicsPath subjectPath, CombineMode combineMode, GraphicsPath clipPath)
        {
            GpcWrapper.Polygon.Validate(combineMode);

            GpcWrapper.Polygon basePoly = new GpcWrapper.Polygon(subjectPath);

            GraphicsPath clipClone = (GraphicsPath)clipPath.Clone();
            clipClone.CloseAllFigures();
            GpcWrapper.Polygon clipPoly = new GpcWrapper.Polygon(clipClone);
            clipClone.Dispose();

            GpcWrapper.Polygon clippedPoly = GpcWrapper.Polygon.Clip(combineMode, basePoly, clipPoly);

            GraphicsPath returnPath = clippedPoly.ToGraphicsPath();
            returnPath.CloseAllFigures();
            return returnPath;
        }
開發者ID:metadeta96,項目名稱:openpdn,代碼行數:17,代碼來源:PdnGraphics.cs

示例5: DrawBwShape

        protected void DrawBwShape(Graphics g, GraphicsPath gpPass, float flOpacity, float flOutlineWidth, Color clBackground, Color clForecolour) {
            if (flOpacity > 0.0F) {
                GraphicsPath gp = (GraphicsPath)gpPass.Clone();

                Matrix m = new Matrix();
                m.Translate(this.m_pntDrawOffset.X, this.m_pntDrawOffset.Y);
                gp.Transform(m);

                Pen pen = new Pen(Color.FromArgb((int)(255.0F * flOpacity), clBackground), flOutlineWidth);
                pen.LineJoin = LineJoin.Round;
                g.DrawPath(pen, gp);
                SolidBrush brush = new SolidBrush(Color.FromArgb((int)(255.0F * flOpacity), clForecolour));
                g.FillPath(brush, gp);

                brush.Dispose();
                pen.Dispose();
                m.Dispose();
                gp.Dispose();
            }
        }
開發者ID:EBassie,項目名稱:Procon-1,代碼行數:20,代碼來源:MapObject.cs

示例6: Flatten_Arc

		public void Flatten_Arc ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddArc (0f, 0f, 100f, 100f, 30, 30);
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			path.Flatten ();
			CompareFlats (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:8,代碼來源:GraphicsPathTest.cs

示例7: Flatten_Curve

		public void Flatten_Curve ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddCurve (new Point[4] { 
				new Point (0, 0), new Point (40, 20),
				new Point (20, 40), new Point (40, 40)
				});
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			path.Flatten ();
			CompareFlats (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:11,代碼來源:GraphicsPathTest.cs

示例8: Flatten_Empty

		public void Flatten_Empty ()
		{
			GraphicsPath path = new GraphicsPath ();
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			// this is a no-op as there's nothing in the path
			path.Flatten ();
			ComparePaths (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:8,代碼來源:GraphicsPathTest.cs

示例9: Flatten_NullFloat

		public void Flatten_NullFloat ()
		{
			GraphicsPath path = new GraphicsPath ();
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			// this is a no-op as there's nothing in the path
			// an no matrix to apply
			path.Flatten (null, 1f);
			ComparePaths (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:9,代碼來源:GraphicsPathTest.cs

示例10: Flatten_Rectangle

		public void Flatten_Rectangle ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddRectangle (new Rectangle (0, 0, 100, 100));
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			path.Flatten ();
			ComparePaths (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:8,代碼來源:GraphicsPathTest.cs

示例11: IsOutlineVisible1

        public void IsOutlineVisible1(Graphics g)
        {
            GraphicsPath myPath = new GraphicsPath();
            Rectangle rect = new Rectangle(20, 20, 100, 100);
            myPath.AddRectangle(rect);
            Pen testPen = new Pen(Color.AliceBlue, 20);
            var widePath = (GraphicsPath)myPath.Clone();
            widePath.Widen(testPen);
            g.FillPath(Brushes.Wheat, widePath);
            g.DrawPath(Pens.Black, myPath);

            var point = new PointF(100, 50);

            bool visible = myPath.IsOutlineVisible(point, testPen, g);
            g.FillRectangle(Brushes.Red, new RectangleF(point.X, point.Y, 2, 2));
            // Show the result.
            g.DrawString("Visible = " + visible, new Font("Arial", 12), Brushes.Red, point.X + 10, point.Y);

            point.X = 115;
            point.Y = 80;

            visible = myPath.IsOutlineVisible(point, testPen, g);
            g.FillRectangle(Brushes.Green, new RectangleF(point.X, point.Y, 2, 2));
            // Show the result.
            g.DrawString("Visible = " + visible, new Font("Arial", 12), Brushes.Green, point.X + 10, point.Y);
        }
開發者ID:mono,項目名稱:sysdrawing-coregraphics,代碼行數:26,代碼來源:DrawingView.cs

示例12: TransformPath

 public GraphicsPath TransformPath(GraphicsPath path)
 {
     var p = (GraphicsPath)path.Clone();
     p.Flatten(_Transform, 0.1f);
     return p;
 }
開發者ID:sr480,項目名稱:ImageToGCode,代碼行數:6,代碼來源:SvgTransformator.cs

示例13: Flatten_Pie

		public void Flatten_Pie ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddPie (0, 0, 100, 100, 30, 30);
			GraphicsPath clone = (GraphicsPath) path.Clone ();
			path.Flatten ();
			CompareFlats (path, clone);
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:8,代碼來源:GraphicsPathTest.cs

示例14: Paint

        public void Paint(GraphicsPath path, Graphics g, int time, float opacity)
        {
            int num1 = 0;
            int num2 = 0;
            AnimFunc.CreateAnimateValues(this, time, out num1, out num2);
            path.FillMode = FillMode.Alternate;
            g.SmoothingMode = base.OwnerDocument.SmoothingMode;
            SpreadMethods methods1 = this.SpreadMethod;
            bool flag1 = this.Units == Units.UserSpaceOnUse;
            float single1 = this.CX;
            float single2 = this.CY;
            float single3 = this.R;
            float single4 = this.FX;
            float single5 = this.FY;
            PointF[] tfArray2 = new PointF[7] { new PointF(single1, single2), new PointF(single1 + single3, single2), new PointF(single1 + (single3 * ((float) Math.Sin(1.8325957145940459))), single2 + (single3 * ((float) Math.Cos(1.8325957145940459)))), new PointF(single1 + (single3 * ((float) Math.Sin(1.3089969389957472))), single2 + (single3 * ((float) Math.Cos(1.3089969389957472)))), new PointF(single1, single2 + single3), PointF.Empty, PointF.Empty } ;
            this.boundsPoints = tfArray2;
            GraphicsPath path1 = this.gradientpath;
            path1.Reset();
            path1.AddEllipse((float) (single1 - single3), (float) (single2 - single3), (float) (2f * single3), (float) (2f * single3));
            RectangleF ef1 = RectangleF.Empty;
            RectangleF ef2 = PathFunc.GetBounds(path);
            RectangleF ef3 = RectangleF.Empty;
            this.coord.Reset();
            if (flag1)
            {
                ef3 = ((SVG) base.OwnerDocument.DocumentElement).ViewPort;
            }
            else
            {
                ef2 = new RectangleF(0f, 0f, 1f, 1f);
                ef3 = ef2;
                ef1 = PathFunc.GetBounds(path);
                this.coord.Translate(ef1.X, ef1.Y);
                this.coord.Scale(ef1.Width, ef1.Height);
            }
            //if (this.stops.Count==0)return;

            ColorBlend blend1 = new ColorBlend(this.Stops.Count);
            Color[] colorArray1 = new Color[this.Stops.Count];
            float[] singleArray1 = new float[this.Stops.Count];
            SvgElementCollection collection1 = this.Stops;
            for (int num3 = 0; num3 < collection1.Count; num3++)
            {
                GradientStop stop1 = (GradientStop) collection1[num3];
                AnimFunc.CreateAnimateValues(stop1, time, out num1, out num2);
                int num4 = 0xff;
                if ((stop1.Opacity >= 0f) && (stop1.Opacity <= 255f))
                {
                    if (stop1.Opacity <= 1f)
                    {
                        num4 = (int) (stop1.Opacity * 255f);
                    }
                    else
                    {
                        num4 = (int) stop1.Opacity;
                    }
                }
                num4 = (int) Math.Min((float) (opacity * 255f), (float) num4);
                Color color1 = stop1.Color;
                float single6 = Math.Min((float) 1f, Math.Max((float) 0f, stop1.ColorOffset));
                colorArray1[num3] = Color.FromArgb(num4, color1.R, color1.G, color1.B);
                singleArray1[num3] = single6;
            }
            float[] singleArray2 = (float[]) singleArray1.Clone();
            Color[] colorArray2 = (Color[]) colorArray1.Clone();
            Array.Sort(singleArray2, colorArray2);
            Color color2 = colorArray2[0];
            Color color3 = colorArray2[colorArray2.Length - 1];
            if (singleArray2[0] != 0f)
            {
                float[] singleArray3 = (float[]) singleArray2.Clone();
                Color[] colorArray3 = (Color[]) colorArray2.Clone();
                singleArray2 = new float[singleArray2.Length + 1];
                colorArray2 = new Color[colorArray2.Length + 1];
                colorArray3.CopyTo(colorArray2, 1);
                singleArray3.CopyTo(singleArray2, 1);
                singleArray2[0] = 0f;
                colorArray2[0] = color2;
            }
            if (singleArray2[singleArray2.Length - 1] != 1f)
            {
                float[] singleArray4 = (float[]) singleArray2.Clone();
                Color[] colorArray4 = (Color[]) colorArray2.Clone();
                singleArray2 = new float[singleArray2.Length + 1];
                singleArray4.CopyTo(singleArray2, 0);
                singleArray2[singleArray2.Length - 1] = 1f;
                colorArray2 = new Color[colorArray2.Length + 1];
                colorArray4.CopyTo(colorArray2, 0);
                colorArray2[colorArray2.Length - 1] = color3;
            }
            if (methods1 == SpreadMethods.Pad)
            {
                float single7 = Math.Min((float) (single1 - single3), ef2.X);
                float single8 = Math.Min((float) (single2 - single3), ef2.Y);
                float single9 = Math.Max(single3, (float) (ef2.Width / 2f));
                float single10 = this.cx - single3;
                float single11 = this.r;
                for (int num5 = 0; num5 < singleArray2.Length; num5++)
                {
                    singleArray2[num5] = ((single10 + (single11 * singleArray2[num5])) - single7) / single9;
//.........這裏部分代碼省略.........
開發者ID:EdgarEDT,項目名稱:myitoppsp,代碼行數:101,代碼來源:RadialGradients.cs

示例15: PPath

		/// <summary>
		/// Constructs a new PPath wrapping the given
		/// <see cref="System.Drawing.Drawing2D.GraphicsPath">
		/// System.Drawing.Drawing2D.GraphicsPath</see>.
		/// </summary>
		/// <param name="path">The path to wrap.</param>
		public PPath(GraphicsPath path) {
			pen = DEFAULT_PEN;
			this.path = (GraphicsPath)path.Clone();
			UpdateBoundsFromPath();
		}
開發者ID:CreeperLava,項目名稱:ME3Explorer,代碼行數:11,代碼來源:PPath.cs


注:本文中的System.Drawing.Drawing2D.GraphicsPath.Clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。