当前位置: 首页>>代码示例>>C#>>正文


C# CGPath.CloseSubpath方法代码示例

本文整理汇总了C#中CGPath.CloseSubpath方法的典型用法代码示例。如果您正苦于以下问题:C# CGPath.CloseSubpath方法的具体用法?C# CGPath.CloseSubpath怎么用?C# CGPath.CloseSubpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGPath的用法示例。


在下文中一共展示了CGPath.CloseSubpath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

		public override void Draw (CGRect rect)
		{
			base.Draw (rect);

			var gctx = UIGraphics.GetCurrentContext ();

			// setting blend mode to clear and filling with
			// a clear color results in a transparent fill
			gctx.SetFillColor (UIColor.Clear.CGColor);
			gctx.FillRect (rect);

			//gctx.SetBlendMode (CGBlendMode.Clear);
			UIColor.Black.SetColor ();

			// create some cutout geometry
			var path = new CGPath ();   
			path.AddLines(new CGPoint[]{
				new CGPoint(0,rect.Height * (1.0/4.0)),
				new CGPoint(rect.Width * (3.0/5.0),rect.Height * (1.0/4.0)),
				new CGPoint(rect.Width * (3.0/5.0),0),
				new CGPoint(rect.Width,rect.Height / 2),
				new CGPoint(rect.Width * (3.0/5.0), rect.Height),
				new CGPoint(rect.Width * (3.0/5.0),rect.Height * (3.0/4.0)),
				new CGPoint(0, rect.Height * (3.0/4.0))
			}); 
			path.CloseSubpath();

			gctx.AddPath(path);
			gctx.DrawPath(CGPathDrawingMode.Fill);  
		}
开发者ID:ytechie,项目名称:BandPowerPointRemote.iOS,代码行数:30,代码来源:Arrow.cs

示例2: Draw

        public override void Draw(CGRect rect)
        {
            base.Draw(rect);
            this.BackgroundColor = UIColor.Clear;

            //get graphics context
            using (CGContext g = UIGraphics.GetCurrentContext())
            {

                //set up drawing attributes
                g.SetLineWidth(_lineWidth);
                _color.SetFill();
                //_color.SetStroke();
                UIColor.Clear.SetStroke();
                g.SetAlpha(_transparancy);

                //create geometry
                var path = new CGPath();

                path.AddLines(new CGPoint[]{
					new CGPoint (rect.X + rect.Width, rect.Y),
					new CGPoint (rect.X + rect.Width, rect.Y + rect.Height), 
					new CGPoint (rect.X, rect.Y + rect.Height)});

                path.CloseSubpath();

                //add geometry to graphics context and draw it
                g.AddPath(path);
                g.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }
开发者ID:nielscup,项目名称:ImageCrop,代码行数:31,代码来源:CropperResizerView.cs

示例3: Draw

        public override void Draw(CGRect rect)
        {
            //get graphics context
            using (CGContext g = UIGraphics.GetCurrentContext())
            {                
                g.SetLineWidth(_lineWidth);
                //set up drawing attributes
                UIColor.Clear.SetFill();

                if (_isRound)
                {
                    var circle = new CGPath();
                    var circleSize = rect.Size.Width / 2;
                    circle.AddArc(circleSize, circleSize, circleSize, 0, endangle, true);
                    Console.WriteLine("circleSize: {0}", circleSize);
                    g.AddPath(circle);
                }
                else
                {
                    //create geometry
                    var rectangle = new CGPath();
                    rectangle.AddRect(new RectangleF(0f, 0f, (float)rect.Size.Width, (float)rect.Size.Height));
                    rectangle.CloseSubpath();
                    //add geometry to graphics context and draw it
                    g.AddPath(rectangle);
                }

                g.SetStrokeColor(_color.CGColor);
                g.SetAlpha(_transparancy);
                
                g.DrawPath(CGPathDrawingMode.Stroke);
            }
        }
开发者ID:nielscup,项目名称:ImageCrop,代码行数:33,代码来源:CropperView.cs

示例4: Draw

        public override void Draw(CGRect rect)
        {
            base.Draw (rect);

            var gctx = UIGraphics.GetCurrentContext ();

            // setting blend mode to clear and filling with
            // a clear color results in a transparent fill
            gctx.SetFillColor (UIColor.Purple.CGColor);
            gctx.FillRect (rect);

            gctx.SetBlendMode (CGBlendMode.Clear);
            UIColor.Clear.SetColor ();

            // create some cutout geometry
            var path = new CGPath ();
            path.AddLines(new CGPoint[]{
                new CGPoint(100,200),
                new CGPoint(160,100),
                new CGPoint(220,200)});
            path.CloseSubpath();

            gctx.AddPath(path);
            gctx.DrawPath(CGPathDrawingMode.Fill);
        }
开发者ID:yofanana,项目名称:recipes,代码行数:25,代码来源:TransparentRegionView.cs

示例5: Draw

        public override void Draw(RectangleF rect)
        {
            var element = Element as CircleView;

            if (element == null) {
                throw new InvalidOperationException ("Element must be a Circle View type");
            }

            //get graphics context
            using(CGContext context = UIGraphics.GetCurrentContext ()){

                context.SetFillColor(element.FillColor.ToCGColor());
                context.SetStrokeColor(element.StrokeColor.ToCGColor());
                context.SetLineWidth(element.StrokeThickness);

                if (element.StrokeDash > 1.0f) {
                        context.SetLineDash (
                        0,
                        new float[] { element.StrokeDash, element.StrokeDash });
                }

                //create geometry
                var path = new CGPath ();

                path.AddEllipseInRect (rect);

                path.CloseSubpath();

                //add geometry to graphics context and draw it
                context.AddPath(path);
                context.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }
开发者ID:pragmaticlogic,项目名称:athena,代码行数:33,代码来源:CircleViewRenderer.cs

示例6: Draw

 public override void Draw (RectangleF rect)
 {
     base.Draw (rect);
     
     //get graphics context
     CGContext gctx = UIGraphics.GetCurrentContext ();
     
     //set up drawing attributes
     gctx.SetLineWidth (2);
     UIColor.Gray.SetFill ();
     UIColor.Black.SetStroke ();
     
     //create geometry
     _path = new CGPath ();
     
     _path.AddLines (new PointF[] { new PointF (110, 100), new PointF (210, 100), new PointF (210, 200), new PointF (110, 200) });
     
     _path.CloseSubpath ();
     
     //add geometry to graphics context and draw it
     gctx.AddPath (_path);
     gctx.DrawPath (CGPathDrawingMode.FillStroke);
     
     _titleLabel.Frame = new RectangleF (5, 5, Bounds.Width - 10, 25);
     this.AddSubview (_titleLabel);
 }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:26,代码来源:SecondView.cs

示例7: CreateShape

        public override void CreateShape(CGPath path, CGContext gctx)
        {
            path.AddLines (new PointF[] { _origin, new PointF (_origin.X + 50, _origin.Y + 100), new PointF (_origin.X - 50, _origin.Y + 100) });

            path.CloseSubpath ();

            gctx.AddPath (path);

            gctx.DrawPath (CGPathDrawingMode.FillStroke);
        }
开发者ID:martinbowling,项目名称:iBabySmash,代码行数:10,代码来源:TriangleView.cs

示例8: Draw

        public override void Draw (RectangleF rect)
        {
            base.Draw (rect);
            
            // get graphics context
            CGContext gctx = UIGraphics.GetCurrentContext ();
            
            // set up drawing attributes
            gctx.SetLineWidth (4);
            UIColor.Yellow.SetStroke ();
            
            // stroke with a dashed line
            gctx.SetLineDash (3, new float[] {6,2});     
            
            // create geometry
            var path = new CGPath ();
            
            PointF origin = new PointF (Bounds.GetMidX (), 
                                        Bounds.GetMinY () + 10);
            
            path.AddLines (new PointF[] { 
                origin, 
                new PointF (origin.X + 35, origin.Y + 80), 
                new PointF (origin.X - 50, origin.Y + 30), 
                new PointF (origin.X + 50, origin.Y + 30), 
                new PointF (origin.X - 35, origin.Y + 80) });
            
            path.CloseSubpath ();
            
            // add geometry to graphics context and draw it
            gctx.AddPath (path);
         
            gctx.DrawPath (CGPathDrawingMode.Stroke);

            // fill the star with a gradient          
            gctx.AddPath (path);          
            gctx.Clip ();
                 
            RectangleF starBoundingBox = path.BoundingBox;
            
            float[] locations = { 0.0f, 1.0f };
            float[] components = { 1.0f, 0.0f, 0.0f, 1.0f,
                                   0.0f, 0.0f, 1.0f, 1.0f };
            
            using (var rgb = CGColorSpace.CreateDeviceRGB()) {
                CGGradient gradient = new CGGradient (rgb, components, locations);  
 
                PointF gradientStart = new PointF (starBoundingBox.Left, starBoundingBox.Top);
                PointF gradientEnd = new PointF (starBoundingBox.Right, starBoundingBox.Bottom);
                gctx.DrawLinearGradient (gradient, gradientStart, gradientEnd, CGGradientDrawingOptions.DrawsBeforeStartLocation);
            }
        }
开发者ID:GSerjo,项目名称:Seminars,代码行数:52,代码来源:StarView.cs

示例9: AddAnchorDotToSprite

		void AddAnchorDotToSprite (SKSpriteNode sprite)
		{
			CGPath myPath = new CGPath ();
			myPath.AddArc (0, 0, 10, 0, (float) Math.PI * 2, true);
			myPath.CloseSubpath ();

			SKShapeNode dot = new SKShapeNode () {
				Path = myPath,
				FillColor = UIColor.Green,
				LineWidth = 0.0f
			};
			sprite.AddChild (dot);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:13,代码来源:AnchorsSpritesViewController.cs

示例10: MakeRoundedPath

        internal static CGPath MakeRoundedPath(float size)
        {
            float hsize = size/2;

            var path = new CGPath ();
            path.MoveToPoint (size, hsize);
            path.AddArcToPoint (size, size, hsize, size, 4);
            path.AddArcToPoint (0, size, 0, hsize, 4);
            path.AddArcToPoint (0, 0, hsize, 0, 4);
            path.AddArcToPoint (size, 0, size, hsize, 4);
            path.CloseSubpath ();

            return path;
        }
开发者ID:kangaroo,项目名称:TweetStation,代码行数:14,代码来源:Graphics.cs

示例11: MakeRoundedPath

        public static CGPath MakeRoundedPath(float size, float radius)
        {
            float hsize = size / 2;

            var path = new CGPath();
            path.MoveToPoint(size, hsize);
            path.AddArcToPoint(size, size, hsize, size, radius);
            path.AddArcToPoint(0, size, 0, hsize, radius);
            path.AddArcToPoint(0, 0, hsize, 0, radius);
            path.AddArcToPoint(size, 0, size, hsize, radius);
            path.CloseSubpath();

            return path;
        }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:14,代码来源:Graphics.cs

示例12: Draw

		public override void Draw (CGRect rect)
		{
			base.Draw (rect);

			//get graphics context
			using (CGContext g = UIGraphics.GetCurrentContext ()) {

				//set up drawing attributes
				g.SetLineWidth (10);
				UIColor.Blue.SetFill ();
				UIColor.Red.SetStroke ();

				//create geometry
				var path = new CGPath ();

				path.AddLines (new CGPoint[]{
				new CGPoint (100, 200),
				new CGPoint (160, 100),
				new CGPoint (220, 200)});

				path.CloseSubpath ();

				//use a dashed line
				g.SetLineDash (0, new nfloat[]{10, 4});

				//add geometry to graphics context and draw it
				g.AddPath (path);
				g.DrawPath (CGPathDrawingMode.FillStroke);

				// add the path back to the graphics context so that it is the current path
				g.AddPath (path);
				// set the current path to be the clipping path
				g.Clip ();

				// the color space determines how Core Graphics interprets color information
				using (CGColorSpace rgb = CGColorSpace.CreateDeviceRGB()) {
					CGGradient gradient = new CGGradient (rgb, new CGColor[] {
					UIColor.Blue.CGColor,
					UIColor.Yellow.CGColor
				});

					// draw a linear gradient
					g.DrawLinearGradient (
					gradient,
					new CGPoint (path.BoundingBox.Left, path.BoundingBox.Top),
					new CGPoint (path.BoundingBox.Right, path.BoundingBox.Bottom),
					CGGradientDrawingOptions.DrawsBeforeStartLocation);
				}
			}
		}
开发者ID:g7steve,项目名称:monotouch-samples,代码行数:50,代码来源:TriangleView.cs

示例13: GetCurrentWavePath

    CGPath GetCurrentWavePath ()
    {
      var path = new CGPath ();
      path.MoveToPoint (0, waterWaveHeight);
      nfloat y = 0.0f;
      for (float x = 0.0f; x <= waterWaveWidth; x++) {
        y = WaveAmplitude * (float)Math.Sin ((360 / waterWaveWidth) * (x * Math.PI / 180) - offsetX * Math.PI / 180) + waterWaveHeight;
        path.AddLineToPoint (x, y);
      }

      path.AddLineToPoint (waterWaveWidth, Frame.Height);
      path.AddLineToPoint (0, Frame.Height);
      path.CloseSubpath ();

      return path;
    }
开发者ID:DarthRamone,项目名称:WaveView,代码行数:16,代码来源:WaveView.cs

示例14: Draw

        public override void Draw(RectangleF rect)
        {
            base.Draw (rect);

            using (CGContext gctx = UIGraphics.GetCurrentContext()) {
                gctx.SetLineWidth(3);
                UIColor.Clear.SetFill();
                StrokeColor.SetStroke();

                path = new CGPath ();
                path.AddRect(rect);
                path.CloseSubpath();

                gctx.AddPath(path);
                gctx.DrawPath(CGPathDrawingMode.FillStroke);
            }
        }
开发者ID:fdibartolo,项目名称:boletamovil,代码行数:17,代码来源:FrameView.cs

示例15: Draw

        public override void Draw(RectangleF rect)
        {
            using (var g = UIGraphics.GetCurrentContext())
            {
                g.SetLineWidth(10);
                UIColor.FromRGB(64,30,168).SetStroke ();
                UIColor.Clear.SetFill ();

                //create geometry
                var path = new CGPath ();
                path.AddRect (rect);
                path.CloseSubpath();

                //add geometry to graphics context and draw it
                g.AddPath(path);
                g.DrawPath(CGPathDrawingMode.Stroke);
            }
        }
开发者ID:rmarinho,项目名称:AnirolaC-Toolkit,代码行数:18,代码来源:GridViewItemCell.cs


注:本文中的CGPath.CloseSubpath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。