本文整理汇总了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);
}
}
}
示例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);
}
}