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


C# Path.Close方法代码示例

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


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

示例1: DrawShape

 protected void DrawShape(Canvas canvas)
 {
   Paint paint = new Paint();
   paint.Color = Color;
   switch (Shape)
   {
     case ShapeEnum.RectangleShape:
       canvas.DrawRect(0, 0, ShapeWidth, ShapeHeight, paint);
       break;
     case ShapeEnum.OvalShape:
       canvas.DrawOval(new RectF(0, 0, ShapeWidth, ShapeHeight), paint);
       break;
     case ShapeEnum.TriangleShape:
         Path path = new Path();
         path.MoveTo(ShapeWidth / 2, 0);
         path.LineTo(ShapeWidth, ShapeHeight);
         path.LineTo(0,ShapeHeight);
         path.Close();
       canvas.DrawPath(path, paint);
       break;
     default:
       canvas.DrawCircle(ShapeWidth / 2, ShapeHeight / 2, ShapeWidth / 2, paint); 
       break;
   }
 }
开发者ID:rfcclub,项目名称:dot42,代码行数:25,代码来源:ShapeView.cs

示例2: Draw

        public override void Draw(Android.Graphics.Canvas canvas)
        {
            base.Draw(canvas);

            var rect = new RectF(0,0,300,300);
            switch (TheShape)
            {
                case Shape.Circle:
                    canvas.DrawOval(rect, new Paint() { Color = Color.Aqua });
                    break;
                case Shape.Square:
                    canvas.DrawRect(rect, new Paint() { Color = Color.Red });
                    break;
                case Shape.Triangle:
                    var path = new Path();
                    path.MoveTo(rect.CenterX(), 0);
                    path.LineTo(0, rect.Height());
                    path.LineTo(rect.Width(), rect.Height());
                    path.Close();

                    var paint = new Paint() {Color = Color.Magenta};
                    paint.SetStyle(Paint.Style.Fill);
                    canvas.DrawPath(path, paint);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:29,代码来源:CustomDrawShapeView.cs

示例3: OnDraw

        protected override void OnDraw(Android.Graphics.Canvas canvas)
        {
            var rect = new RectF(0, 0, 300, 300);
            switch (Shape)
            {
                case Shape.Circle:
                    canvas.DrawOval(rect, new Paint() { Color = Color.CornflowerBlue });
                    break;
                case Shape.Square:
                    canvas.DrawRect(rect, new Paint() { Color = Color.Crimson });
                    break;
                case Shape.Triangle:

                    var path = new Path();
                    path.MoveTo(rect.CenterX(), rect.Top);
                    path.LineTo(rect.Left, rect.Bottom);
                    path.LineTo(rect.Right, rect.Bottom);
                    path.Close();
                    var paint = new Paint() {Color = Color.Crimson};
                    paint.Color = Color.Gold;
                    paint.SetStyle(Paint.Style.Fill);
                    canvas.DrawPath(path, paint);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:Coolerhino,项目名称:MvvmCross-Tutorials,代码行数:27,代码来源:ShapeView.cs

示例4: Initialize

        public void Initialize()
        {
            _minuteHand = new Path();
            _minuteHand.MoveTo(0, 10);
            _minuteHand.LineTo(0, -55);
            _minuteHand.Close();

            _secondHand = new Path();
            _secondHand.MoveTo(0, -80);
            _secondHand.LineTo(0, 15);
            _secondHand.Close();
        }
开发者ID:adolfo7x,项目名称:Play.Stopwatch,代码行数:12,代码来源:StopwatchView.cs

示例5: Draw

		/// <Docs>The Canvas to which the View is rendered.</Docs>
		/// <summary>
		/// BoxViewのカスタマイズはDrawで行う
		/// </summary>
		/// <param name="canvas">Canvas.</param>
		public override void Draw(Android.Graphics.Canvas canvas)
		{
			// 2重に描画してしまうので、baseは描画しない
			//base.Draw(canvas);

			// ElementをキャストしてFormsで定義したCustomBoxViewを取得
			var formsBox = (CustomBoxView)Element;

			// Androidの描画はPaintを使用
			using (var paint = new Paint()) 
			{
				// 塗りつぶし色の設定
				paint.Color = formsBox.FillColor.ToAndroid();

				// 吹き出し部分の設定
				// パスの生成
				var path = new Path();

				// スタート地点の設定
				path.MoveTo(0, 0);

				// 経由地点の設定
				path.LineTo(100, 10);
				path.LineTo(100, 100);

				// パスを繋げる
				path.Close();

				// 描画
				canvas.DrawPath(path, paint);


				// 角の丸い四角の設定
				// 角丸の直径を決める
				// widthとheightを比較して小さい方を基準にする
				var minSize = Math.Min(Width, Height);

				// 指定するのは直径なので、指定半径を2倍する
				var diameter = formsBox.Radius * 2;
				// 角丸の直径はminSize以下でなければならない
				if (diameter > minSize)
					diameter = minSize;

				// 描画領域の設定
				var rect = new RectF(0, 0, (float)Width, (float)Height);

				//四角形描画
				canvas.DrawRoundRect(rect, diameter, diameter, paint);
			}
		}
开发者ID:mattsuDev,项目名称:Xamarin.Forms.CustomBox,代码行数:55,代码来源:CustomBoxViewRenderer.cs

示例6: Initialize

		void Initialize ()
		{
			// Create Paint for all drawing
			paint = new Paint ();

			// All paths are based on 100-unit clock radius
			//		centered at (0, 0).

			// Define circle for tick marks.
			tickMarks = new Path ();
			tickMarks.AddCircle (0, 0, 90, Path.Direction.Cw);

			// Hour, minute, second hands defined to point straight up.

			// Define hour hand.
			hourHand = new Path ();
			hourHand.MoveTo (0, -60);
			hourHand.CubicTo (0, -30, 20, -30, 5, -20);
			hourHand.LineTo (5, 0);
			hourHand.CubicTo (5, 7.5f, -5, 7.5f, -5, 0);
			hourHand.LineTo (-5, -20);
			hourHand.CubicTo (-20, -30, 0, -30, 0, -60);
			hourHand.Close ();

			// Define minute hand.
			minuteHand = new Path ();
			minuteHand.MoveTo (0, -80);
			minuteHand.CubicTo (0, -75, 0, -70, 2.5f, -60);
			minuteHand.LineTo (2.5f, 0);
			minuteHand.CubicTo (2.5f, 5, -2.5f, 5, -2.5f, 0);
			minuteHand.LineTo (-2.5f, -60);
			minuteHand.CubicTo (0, -70, 0, -75, 0, -80);
			minuteHand.Close ();

			// Define second hand.
			secondHand = new Path ();
			secondHand.MoveTo (0, 10);
			secondHand.LineTo (0, -80);
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:39,代码来源:ClockView.cs

示例7: DrawPath

        public void DrawPath(IEnumerable<PathOperation> ops, Pen pen = null, BaseBrush brush = null)
        {
            using (var path = new Path())
              {
            var bb = new BoundingBoxBuilder();

            foreach (var op in ops)
            {
              var moveTo = op as MoveTo;
              if (moveTo != null)
              {
            var start = moveTo.Start;
            var end = moveTo.End;

            path.MoveTo((float) start.X, (float) start.Y);

            bb.Add(start);
            bb.Add(end);
            continue;
              }
              var lineTo = op as LineTo;
              if (lineTo != null)
              {
            var start = lineTo.Start;
            var end = lineTo.End;
            path.LineTo((float) start.X, (float) start.Y);
            path.LineTo((float) end.X, (float) end.Y);
            bb.Add(start);
            bb.Add(end);
            continue;
              }
              var at = op as ArcTo;
              if (at != null)
              {
            var p = at.Point;
            path.LineTo((float) p.X, (float) p.Y);
            bb.Add(p);
            continue;
              }
              var curveTo = op as CurveTo;
              if (curveTo != null)
              {
            var end = curveTo.End;
            var firstControlPoint = curveTo.FirstControlPoint;
            var secondControlPoint = curveTo.SecondControlPoint;

            path.CubicTo((float) firstControlPoint.X, (float) firstControlPoint.Y, (float) secondControlPoint.X,
              (float) secondControlPoint.Y, (float) end.X, (float) end.Y);

            bb.Add(firstControlPoint);
            bb.Add(secondControlPoint);
            bb.Add(end);
            continue;
              }
              var cp = op as ClosePath;
              if (cp != null)
              {
            path.Close();
            continue;
              }

              throw new NotSupportedException("Path Op " + op);
            }

            var frame = bb.BoundingBox;

            if (brush != null)
            {
              var solidBrush = brush as SolidBrush;

              if (solidBrush != null)
              {
            path.SetFillType(GetPathFillType(((SolidBrush)brush).FillMode));
              }

              var brushPaint = GetBrushPaint(brush, frame);
              graphics.DrawPath(path, brushPaint);
            }
            if (pen != null)
            {
              var penPaint = GetPenPaint(pen);
              graphics.DrawPath(path, penPaint);
            }
              }
        }
开发者ID:yard,项目名称:NGraphics,代码行数:85,代码来源:AndroidPlatform.cs

示例8: DrawWater

 void DrawWater(Canvas canvas)
 {
     canvas.Save ();
     var circle = new Path ();
     circle.AddCircle (Width / 2, Height / 2, Height / 2, Path.Direction.Ccw);
     circle.Close ();
     canvas.ClipPath (circle);
     wavy.Draw (canvas);
     canvas.Restore ();
 }
开发者ID:modulexcite,项目名称:bikr,代码行数:10,代码来源:CircleBadge.cs

示例9: ToTransformedCorners


//.........这里部分代码省略.........
			else if (currentRatio < desiredRatio)
			{
				desiredHeight = (cropHeightRatio * sourceWidth / cropWidthRatio);
			}

			topLeftCornerSize = topLeftCornerSize * (desiredWidth + desiredHeight) / 2 / 100;
			topRightCornerSize = topRightCornerSize * (desiredWidth + desiredHeight) / 2 / 100;
			bottomLeftCornerSize = bottomLeftCornerSize * (desiredWidth + desiredHeight) / 2 / 100;
			bottomRightCornerSize = bottomRightCornerSize * (desiredWidth + desiredHeight) / 2 / 100;

			float cropX = (float)((sourceWidth - desiredWidth) / 2);
			float cropY = (float)((sourceHeight - desiredHeight) / 2);

			Bitmap bitmap = Bitmap.CreateBitmap((int)desiredWidth, (int)desiredHeight, Bitmap.Config.Argb8888);

			using (Canvas canvas = new Canvas(bitmap))
			using (Paint paint = new Paint())
			using (BitmapShader shader = new BitmapShader(source, Shader.TileMode.Clamp, Shader.TileMode.Clamp))
			using (Matrix matrix = new Matrix())
			using (var path = new Path())
			{
				if (cropX != 0 || cropY != 0)
				{
					matrix.SetTranslate(-cropX, -cropY);
					shader.SetLocalMatrix(matrix);
				}

				paint.SetShader(shader);
				paint.AntiAlias = true;

				// TopLeft
				if (cornersTransformType.HasFlag(CornerTransformType.TopLeftCut)) 
				{
					path.MoveTo(0, (float)topLeftCornerSize);
					path.LineTo((float)topLeftCornerSize, 0);
				}
				else if (cornersTransformType.HasFlag(CornerTransformType.TopLeftRounded)) 
				{
					path.MoveTo(0, (float)topLeftCornerSize);
					path.QuadTo(0, 0, (float)topLeftCornerSize, 0);
				}
				else
				{
					path.MoveTo(0, 0);
				}

				// TopRight
				if (cornersTransformType.HasFlag(CornerTransformType.TopRightCut)) 
				{
					path.LineTo((float)(desiredWidth - topRightCornerSize), 0);
					path.LineTo((float)desiredWidth, (float)topRightCornerSize);
				}
				else if (cornersTransformType.HasFlag(CornerTransformType.TopRightRounded))
				{
					path.LineTo((float)(desiredWidth - topRightCornerSize), 0);
					path.QuadTo((float)desiredWidth, 0, (float)desiredWidth, (float)topRightCornerSize);
				}
				else
				{
					path.LineTo((float)desiredWidth ,0);
				}

				// BottomRight
				if (cornersTransformType.HasFlag(CornerTransformType.BottomRightCut)) 
				{
					path.LineTo((float)desiredWidth, (float)(desiredHeight - bottomRightCornerSize));
					path.LineTo((float)(desiredWidth - bottomRightCornerSize), (float)desiredHeight);
				}
				else if (cornersTransformType.HasFlag(CornerTransformType.BottomRightRounded))
				{
					path.LineTo((float)desiredWidth, (float)(desiredHeight - bottomRightCornerSize));
					path.QuadTo((float)desiredWidth, (float)desiredHeight, (float)(desiredWidth - bottomRightCornerSize), (float)desiredHeight);
				}
				else
				{
					path.LineTo((float)desiredWidth, (float)desiredHeight);
				}

				// BottomLeft
				if (cornersTransformType.HasFlag(CornerTransformType.BottomLeftCut)) 
				{
					path.LineTo((float)bottomLeftCornerSize, (float)desiredHeight);
					path.LineTo(0, (float)(desiredHeight - bottomLeftCornerSize));
				}
				else if (cornersTransformType.HasFlag(CornerTransformType.BottomLeftRounded)) 
				{
					path.LineTo((float)bottomLeftCornerSize, (float)desiredHeight);
					path.QuadTo(0, (float)desiredHeight, 0, (float)(desiredHeight - bottomLeftCornerSize));
				}
				else
				{
					path.LineTo(0, (float)desiredHeight);
				}

				path.Close();
				canvas.DrawPath(path, paint);

				return bitmap;				
			}
		}
开发者ID:CaLxCyMru,项目名称:FFImageLoading,代码行数:101,代码来源:CornersTransformation.cs

示例10: OnDraw

		protected override void OnDraw(Canvas canvas)  {
			canvas.DrawColor(Color.Transparent);
			paint.Reset();
			paint.AntiAlias = true;
			float midX, midY, radius, innerRadius;
			path.Reset();

			float currentAngle = 270;
			float currentSweep;
			float totalValue = 0;
			float padding = 2;

			midX = Width / 2;
			midY = Height/2;
			if (midX < midY){
				radius = midX;
			} else {
				radius = midY;
			}
			radius -= padding;
			innerRadius = radius - thickness;

			foreach (PieSlice slice in slices) {
				totalValue += slice.getValue();
			}

			int count = 0;
			foreach (PieSlice slice in slices) {
				Path p = new Path();
				paint.Color = slice.getColor ();
				currentSweep = (slice.getValue()/totalValue)*(360);
				p.ArcTo(new RectF(midX-radius, midY-radius, midX+radius, midY+radius), currentAngle+padding, currentSweep - padding);
				p.ArcTo(new RectF(midX-innerRadius, midY-innerRadius, midX+innerRadius, midY+innerRadius), (currentAngle+padding) + (currentSweep - padding), -(currentSweep-padding));
				p.Close ();

				slice.setPath(p);
				slice.setRegion(new Region((int)(midX-radius), (int)(midY-radius), (int)(midX+radius), (int)(midY+radius)));
				canvas.DrawPath(p, paint);

				if (indexSelected == count && listener != null){
					path.Reset();
					paint.Color = slice.getColor ();
					paint.Color = Color.ParseColor ("#33B5E5");
					paint.Alpha=100;

					if (slices.Count > 1) {
						path.ArcTo(new RectF(midX-radius-(padding*2), midY-radius-(padding*2), midX+radius+(padding*2), midY+radius+(padding*2)), currentAngle, currentSweep+padding);
						path.ArcTo(new RectF(midX-innerRadius+(padding*2), midY-innerRadius+(padding*2), midX+innerRadius-(padding*2), midY+innerRadius-(padding*2)), currentAngle + currentSweep + padding, -(currentSweep + padding));
						path.Close();
					} else {
						path.AddCircle(midX, midY, radius+padding, Android.Graphics.Path.Direction.Cw);
					}

					canvas.DrawPath(path, paint);
					paint.Alpha=255;
				}

				currentAngle = currentAngle+currentSweep;

				count++;
			}
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:62,代码来源:PieGraph.cs

示例11: OnDraw


//.........这里部分代码省略.........
                    //Is left side is outside the screen
                    if (bound.Left < leftClip) {
                        float w = bound.Right - bound.Left;
                        //Try to clip to the screen (left side)
                        ClipViewOnTheLeft(bound, w, left);
                        //Except if there's an intersection with the right view
                        RectF rightBound = bounds[i + 1];
                        //Intersection
                        if (bound.Right + mTitlePadding > rightBound.Left) {
                            bound.Left = rightBound.Left - w - mTitlePadding;
                            bound.Right = bound.Left + w;
                        }
                    }
                }
            }
            //Right views starting from the current position
            if (mCurrentPage < countMinusOne) {
                for (int i = mCurrentPage + 1 ; i < count; i++) {
                    RectF bound = bounds[i];
                    //If right side is outside the screen
                    if (bound.Right > rightClip) {
                        float w = bound.Right - bound.Left;
                        //Try to clip to the screen (right side)
                        ClipViewOnTheRight(bound, w, right);
                        //Except if there's an intersection with the left view
                        RectF leftBound = bounds[i - 1];
                        //Intersection
                        if (bound.Left - mTitlePadding < leftBound.Right) {
                            bound.Left = leftBound.Right + mTitlePadding;
                            bound.Right = bound.Left + w;
                        }
                    }
                }
            }

            //Now draw views
            //int colorTextAlpha = mColorText >>> 24;
            int colorTextAlpha = mColorText >> 24;
            for (int i = 0; i < count; i++) {
                //Get the title
                RectF bound = bounds[i];
                //Only if one side is visible
                if ((bound.Left > left && bound.Left < right) || (bound.Right > left && bound.Right < right)) {
                    bool currentPage = (i == page);
                    //Only set bold if we are within bounds
                    mPaintText.FakeBoldText = (currentPage && currentBold && mBoldText);

                    //Draw text as unselected
                    mPaintText.Color = (mColorText);
                    if(currentPage && currentSelected) {
                        //Fade out/in unselected text as the selected text fades in/out
                        mPaintText.Alpha = (colorTextAlpha - (int)(colorTextAlpha * selectedPercent));
                    }
                    canvas.DrawText(mTitleProvider.GetTitle(i), bound.Left, bound.Bottom + mTopPadding, mPaintText);

                    //If we are within the selected bounds draw the selected text
                    if (currentPage && currentSelected) {
                        mPaintText.Color = mColorSelected;
                        mPaintText.Alpha = ((int)((mColorSelected >> 24) * selectedPercent));
                        canvas.DrawText(mTitleProvider.GetTitle(i), bound.Left, bound.Bottom + mTopPadding, mPaintText);
                    }
                }
            }

            //Draw the footer line
            mPath = new Path();
            mPath.MoveTo(0, height - mFooterLineHeight / 2f);
            mPath.LineTo(width, height - mFooterLineHeight / 2f);
            mPath.Close();
            canvas.DrawPath(mPath, mPaintFooterLine);

            switch (mFooterIndicatorStyle) {
                case IndicatorStyle.Triangle:
                    mPath = new Path();
                    mPath.MoveTo(halfWidth, height - mFooterLineHeight - mFooterIndicatorHeight);
                    mPath.LineTo(halfWidth + mFooterIndicatorHeight, height - mFooterLineHeight);
                    mPath.LineTo(halfWidth - mFooterIndicatorHeight, height - mFooterLineHeight);
                    mPath.Close();
                    canvas.DrawPath(mPath, mPaintFooterIndicator);
                    break;

                case IndicatorStyle.Underline:
                    if (!currentSelected || page >= boundsSize) {
                        break;
                    }

                    RectF underlineBounds = bounds[page];
                    mPath = new Path();
                    mPath.MoveTo(underlineBounds.Left  - mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
                    mPath.LineTo(underlineBounds.Right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight);
                    mPath.LineTo(underlineBounds.Right + mFooterIndicatorUnderlinePadding, height - mFooterLineHeight - mFooterIndicatorHeight);
                    mPath.LineTo(underlineBounds.Left  - mFooterIndicatorUnderlinePadding, height - mFooterLineHeight - mFooterIndicatorHeight);
                    mPath.Close();

                    mPaintFooterIndicator.Alpha = ((int)(0xFF * selectedPercent));
                    canvas.DrawPath(mPath, mPaintFooterIndicator);
                    mPaintFooterIndicator.Alpha = (0xFF);
                    break;
            }
        }
开发者ID:4ndr01d,项目名称:monodroid-samples,代码行数:101,代码来源:TitlePageIndicator.cs

示例12: OnDraw

		protected override void OnDraw(Canvas ca)  {
			if (fullImage == null || shouldUpdate) {
				fullImage = Bitmap.CreateBitmap (Width, Height, Bitmap.Config.Argb8888);
				Canvas canvas = new Canvas(fullImage);
				String max = (int)maxY+"";// used to display max
				String min = (int)minY+"";// used to display min
				paint.Reset ();
				Path path = new Path();

				float bottomPadding = 1, topPadding = 0;
				float sidePadding = 10;
				if (this.showMinAndMax)
					sidePadding = txtPaint.MeasureText(max);

				float usableHeight = Height - bottomPadding - topPadding;
				float usableWidth = Width - sidePadding*2;
				float lineSpace = usableHeight/10;

				int lineCount = 0;
				foreach (Line line in lines) {
					int count = 0;
					float lastXPixels = 0, newYPixels;
					float lastYPixels = 0, newXPixels;
					float maxYd = getMaxY ();
					float minYd = getMinY();
					float maxXd = getMaxX();
					float minXd = getMinX();

					if (lineCount == lineToFill){
						paint.Color = Color.White;
						paint.Alpha = 30;	
						paint.StrokeWidth = 2;
						for (int i = 10; i-Width < Height; i = i+20){
							canvas.DrawLine(i, Height-bottomPadding, 0, Height-bottomPadding-i, paint);
						}

						paint.Reset();

						paint.SetXfermode (new PorterDuffXfermode (Android.Graphics.PorterDuff.Mode.Clear));
						foreach (LinePoint p  in line.getPoints()) {
							float yPercent = (p.getY()-minY)/(maxYd - minYd);
							float xPercent = (p.getX()-minX)/(maxXd - minXd);
							if (count == 0){
								lastXPixels = sidePadding + (xPercent*usableWidth);
								lastYPixels = Height - bottomPadding - (usableHeight*yPercent);
								path.MoveTo(lastXPixels, lastYPixels);
							} else {
								newXPixels = sidePadding + (xPercent*usableWidth);
								newYPixels = Height - bottomPadding - (usableHeight*yPercent);
								path.LineTo(newXPixels, newYPixels);
								Path pa = new Path();
								pa.MoveTo(lastXPixels, lastYPixels);
								pa.LineTo(newXPixels, newYPixels);
								pa.LineTo(newXPixels, 0);
								pa.LineTo(lastXPixels, 0);
								pa.Close();
								canvas.DrawPath(pa, paint);
								lastXPixels = newXPixels;
								lastYPixels = newYPixels;
							}
							count++;
						}

						path.Reset();

						path.MoveTo(0, Height-bottomPadding);
						path.LineTo(sidePadding, Height-bottomPadding);
						path.LineTo(sidePadding, 0);
						path.LineTo(0, 0);
						path.Close();
						canvas.DrawPath(path, paint);

						path.Reset();

						path.MoveTo(Width, Height-bottomPadding);
						path.LineTo(Width-sidePadding, Height-bottomPadding);
						path.LineTo(Width-sidePadding, 0);
						path.LineTo(Width, 0);
						path.Close();

						canvas.DrawPath(path, paint);

					}

					lineCount++;
				}

				paint.Reset();

				paint.Color = Color.White;
				//paint.setColor(this.gridColor);
				paint.Alpha = 50;
				paint.AntiAlias = true;
				canvas.DrawLine(sidePadding, Height - bottomPadding, Width, Height-bottomPadding, paint);
				if(this.showHorizontalGrid1)
					for(int i=1;i<=10;i++)
					{
						canvas.DrawLine(sidePadding, Height - bottomPadding-(i*lineSpace), Width, Height-bottomPadding-(i*lineSpace), paint);
					}
				paint.Alpha = 255;
//.........这里部分代码省略.........
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:101,代码来源:LineGraph.cs

示例13: Draw

        public override void Draw(Canvas canvas)
        {
            var w = width / (Count - 2);

            var path = new Path ();
            path.MoveTo (0, height - u1 [0]);
            for (int i = 1; i < Count; i += 3) {
                path.CubicTo (i * w, height - u1 [Math.Min (Count - 1, i)],
                              (i + 1) * w, height - u1 [Math.Min (Count - 1, i + 1)],
                              (i + 2) * w, height - u1 [Math.Min (Count - 1, i + 2)]);
            }

            path.LineTo (width, height);
            path.LineTo (0, height);
            path.Close ();
            canvas.DrawPath (path, paint);
            if (bubblesEnabled)
                DrawBubbles (canvas, w);
        }
开发者ID:modulexcite,项目名称:bikr,代码行数:19,代码来源:WaveDrawable.cs

示例14: OnDraw

        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);
            switch(mShape)
            {
                case Shape.TRIANGLE:
                    {
                        if (mIsLoading)
                        {
                            mAnimPercent += 0.1611113f;
                            Path path = new Path();
                            path.MoveTo(RelativeXFromView(0.5f),
                                RelativeYFromView(0.5f));

                            if (mAnimPercent >= 1)
                            {
                                mShape = Shape.CIRCLE;
                                mIsLoading = false;
                                mAnimPercent = 1;
                            }
                            float controlX = mControlX - RelativeXFromView(mAnimPercent * triangle2Circle) * genhao3;
                            float controlY = mControlY - RelativeYFromView(mAnimPercent * triangle2Circle);
                            path.QuadTo(RelativeXFromView(1) - controlX, controlY, RelativeXFromView(0.5f + genhao3 / 4),
                                RelativeYFromView(0.75f));
                            path.QuadTo(RelativeXFromView(0.5f), RelativeYFromView(0.75f + 2 * mAnimPercent * triangle2Circle),
                                RelativeXFromView(0.5f - genhao3 / 4), RelativeYFromView(0.75f));
                            path.QuadTo(controlX, controlY, RelativeXFromView(0.5f), RelativeYFromView(0f));
                            path.Close();
                            canvas.DrawPath(path, mPaint);
                            Invalidate();
                        }
                        else
                        {
                            Path path = new Path();
                            mPaint.Color = Resources.GetColor(Resource.Color.triangle);
                            path.MoveTo(RelativeXFromView(0.5f), RelativeYFromView(0f));
                            path.LineTo(RelativeXFromView(1), RelativeYFromView(genhao3 / 2f));
                            path.LineTo(RelativeXFromView(0), RelativeYFromView(genhao3 / 2f));

                            mControlX = RelativeXFromView(0.5f - genhao3 / 8f);
                            mControlY = RelativeYFromView(3 / 8f);
                            mAnimPercent = 0;
                            path.Close();
                            canvas.DrawPath(path, mPaint);
                        }
                    }
                    break;
                case Shape.CIRCLE:
                    {
                        if(mIsLoading)
                        {
                            float magicNumber = mMagicNumber + mAnimPercent;
                            mAnimPercent += 0.12f;
                            if(magicNumber + mAnimPercent > 1.9f)
                            {
                                mShape = Shape.RECT;
                                mIsLoading = false;
                            }
                            Path path = new Path();
                            path.MoveTo(RelativeXFromView(0.5f), RelativeYFromView(0f));
                            path.CubicTo(RelativeXFromView(0.5f + magicNumber / 2), RelativeYFromView(0f),
                                RelativeXFromView(1), RelativeYFromView(0.5f - magicNumber / 2),
                                RelativeXFromView(1f), RelativeYFromView(0.5f));
                            path.CubicTo(RelativeXFromView(1), RelativeXFromView(0.5f + magicNumber / 2),
                                RelativeXFromView(0.5f + mMagicNumber / 2), RelativeYFromView(1f),
                                RelativeXFromView(0.5f), RelativeYFromView(1f));
                            path.CubicTo(RelativeXFromView(0.5f - magicNumber / 2), RelativeXFromView(1f),
                                RelativeXFromView(0), RelativeYFromView(0.5f + magicNumber / 2),
                                RelativeXFromView(0f), RelativeYFromView(0.5f));
                            path.CubicTo(RelativeXFromView(0f), RelativeXFromView(0.5f - magicNumber / 2),
                                RelativeXFromView(0.5f - magicNumber / 2), RelativeYFromView(0),
                                RelativeXFromView(0.5f), RelativeYFromView(0f));
                            path.Close();
                            canvas.DrawPath(path, mPaint);
                            Invalidate();
                        }
                        else
                        {
                            mPaint.Color = Resources.GetColor(Resource.Color.circle);
                            Path path = new Path();
                            float magicNumber = mMagicNumber;
                            path.MoveTo(RelativeXFromView(0.5f), RelativeYFromView(0f));
                            path.CubicTo(RelativeXFromView(0.5f + magicNumber / 2), 0,
                                    RelativeXFromView(1), RelativeYFromView(magicNumber / 2),
                                    RelativeXFromView(1f), RelativeYFromView(0.5f));
                            path.CubicTo(
                                    RelativeXFromView(1), RelativeXFromView(0.5f + magicNumber / 2),
                                    RelativeXFromView(0.5f + magicNumber / 2), RelativeYFromView(1f),
                                    RelativeXFromView(0.5f), RelativeYFromView(1f));
                            path.CubicTo(RelativeXFromView(0.5f - magicNumber / 2), RelativeXFromView(1f),
                                    RelativeXFromView(0), RelativeYFromView(0.5f + magicNumber / 2),
                                    RelativeXFromView(0f), RelativeYFromView(0.5f));
                            path.CubicTo(RelativeXFromView(0f), RelativeXFromView(0.5f - magicNumber / 2),
                                    RelativeXFromView(0.5f - magicNumber / 2), RelativeYFromView(0),
                                    RelativeXFromView(0.5f), RelativeYFromView(0f));
                            mAnimPercent = 0;
                            path.Close();
                            canvas.DrawPath(path, mPaint);
                        }
                    }
//.........这里部分代码省略.........
开发者ID:huguodong,项目名称:XamandroidSupportDesign22.2.0.0,代码行数:101,代码来源:ShapeLoadingView.cs

示例15: triangle

 public void triangle(double x1, double y1, double x2, double y2, double x3, double y3)
 {
     var path = new Path ();
     path.MoveTo ((float) x3, (float) y3);
     path.LineTo ((float) x1, (float) y1);
     path.LineTo ((float) x2, (float) y2);
     path.LineTo ((float) x3, (float) y3);
     path.Close ();
     Host.DrawPath (path, HostPaint);
 }
开发者ID:atsushieno,项目名称:tsukimi,代码行数:10,代码来源:StandardLibrary.Shapes.cs


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