本文整理汇总了C#中Brush.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# Brush.Apply方法的具体用法?C# Brush.Apply怎么用?C# Brush.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brush
的用法示例。
在下文中一共展示了Brush.Apply方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillPath
public void FillPath(Brush brush, IGraphicsPath path)
{
StartDrawing();
Control.TranslateCTM(inverseoffset, inverseoffset);
Control.BeginPath();
Control.AddPath(path.ToCG());
Control.ClosePath();
brush.Apply(this);
switch (path.FillMode)
{
case FillMode.Alternate:
Control.EOFillPath();
break;
case FillMode.Winding:
Control.FillPath();
break;
default:
throw new NotSupportedException();
}
EndDrawing();
}
示例2: FillEllipse
public void FillEllipse(Brush brush, float x, float y, float width, float height)
{
StartDrawing();
/* if (width == 1 || height == 1)
{
DrawLine(color, x, y, x+width-1, y+height-1);
return;
}*/
brush.Apply(this);
Control.FillEllipseInRect(TranslateView(new CGRect(x, y, width, height), true, true));
EndDrawing();
}
示例3: FillPie
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
{
StartDrawing();
var rect = TranslateView(new CGRect(x, y, width, height), true, true);
brush.Apply(this);
var yscale = rect.Height / rect.Width;
var centerY = rect.GetMidY();
var centerX = rect.GetMidX();
Control.ConcatCTM(new CGAffineTransform(1.0f, 0, 0, yscale, 0, centerY - centerY * yscale));
Control.MoveTo(centerX, centerY);
Control.AddArc(centerX, centerY, rect.Width / 2, Conversions.DegreesToRadians(startAngle), Conversions.DegreesToRadians(startAngle + sweepAngle), sweepAngle < 0);
Control.AddLineToPoint(centerX, centerY);
Control.ClosePath();
Control.FillPath();
EndDrawing();
}
示例4: FillRectangle
public void FillRectangle(Brush brush, float x, float y, float width, float height)
{
StartDrawing();
brush.Apply(this);
Control.FillRect(TranslateView(new CGRect(x, y, width, height), width > 1 || height > 1, true));
EndDrawing();
}