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


C# Path.SetFillType方法代码示例

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


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

示例1: 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

示例2: DrawTriangle

        private void DrawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds)
        {
            if (mShowArrow)
            {
                if (mArrow == null)
                {
                    mArrow = new Path();
                    mArrow.SetFillType(Path.FillType.EvenOdd);
                }
                else
                {
                    mArrow.Reset();
                }

                float x = (float)(RingCenterRadius * Math.Cos(0) + bounds.ExactCenterX());
                float y = (float)(RingCenterRadius * Math.Sin(0) + bounds.ExactCenterY());

                mArrow.MoveTo(0, 0);
                mArrow.LineTo((mArrowWidth) * mArrowScale, 0);
                mArrow.LineTo(((mArrowWidth) * mArrowScale / 2), (mArrowHeight * mArrowScale));
                mArrow.Offset(x - ((mArrowWidth) * mArrowScale / 2), y);
                mArrow.Close();

                mArrowPaint.Color = mColors[mColorIndex];
                c.Rotate(startAngle + (sweepAngle < 0 ? 0 : sweepAngle) - ARROW_OFFSET_ANGLE, bounds.ExactCenterX(), bounds.ExactCenterY());
                c.DrawPath(mArrow, mArrowPaint);
            }
        }
开发者ID:devxiaruwei,项目名称:MaterialProgressbar,代码行数:28,代码来源:Ring.cs


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