本文整理汇总了C#中CGContext.EOFillPath方法的典型用法代码示例。如果您正苦于以下问题:C# CGContext.EOFillPath方法的具体用法?C# CGContext.EOFillPath怎么用?C# CGContext.EOFillPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGContext
的用法示例。
在下文中一共展示了CGContext.EOFillPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EOFillPath
public static void EOFillPath(CGContext context, CGPath path, CGColor color)
{
context.SaveState();
context.SetFillColor(color);
context.AddPath(path);
context.EOFillPath();
context.RestoreState();
}
示例2: DrawInContext
public override void DrawInContext (CGContext context)
{
base.DrawInContext (context);
// Console.WriteLine ("DrawInContext Radius: {0} Thickness: {1} Color: {2}", Radius, Thickness, Color);
PointF centerPoint = new PointF (this.Bounds.Width / 2, this.Bounds.Height / 2);
CGColor glowColor = new UIColor (Color).ColorWithAlpha (0.85f).CGColor;
double innerRadius = (Radius - Thickness) > 0 ? Radius - Thickness : 0;
// Outer circle
context.AddEllipseInRect (new RectangleF (centerPoint.X - (float) Radius,
centerPoint.Y - (float) Radius,
(float) Radius * 2,
(float) Radius * 2));
// Inner circle
context.AddEllipseInRect (new RectangleF (centerPoint.X - (float) innerRadius,
centerPoint.Y - (float) innerRadius,
(float) innerRadius * 2,
(float) innerRadius * 2));
// Fill in circle
context.SetFillColor (Color);
context.SetShadowWithColor (SizeF.Empty, 10.0f, glowColor);
context.EOFillPath();
}
示例3: DrawInContext
public override void DrawInContext (CGContext context)
{
// Drawing with a white stroke color
context.SetStrokeColor (1, 1, 1, 1);
// Drawing with a blue fill color
context.SetFillColor (0, 0, 1, 1);
// Draw them with a 2 stroke width so they are a bit more visible.
context.SetLineWidth (2);
CGPoint center;
// Draw a Star stroked
center = new CGPoint (90, 90);
context.MoveTo (center.X, center.Y + 60);
for (int i = 1; i < 5; ++i) {
float x = (float)(60 * Math.Sin (i * 4 * Math.PI / 5));
float y = (float)(60 * Math.Cos (i * 4 * Math.PI / 5));
context.AddLineToPoint (center.X + x, center.Y + y);
}
// Closing the path connects the current point to the start of the current path.
context.ClosePath ();
// And stroke the path
context.StrokePath ();
// Draw a Star filled
center = new CGPoint (90, 210);
context.MoveTo (center.X, center.Y + 60);
for (int i = 1; i < 5; ++i) {
float x = (float)(60 * Math.Sin (i * 4 * Math.PI / 5));
float y = (float)(60 * Math.Cos (i * 4 * Math.PI / 5));
context.AddLineToPoint (center.X + x, center.Y + y);
}
// Closing the path connects the current point to the start of the current path.
context.ClosePath ();
// Use the winding-rule fill mode.
context.FillPath ();
// Draw a Star filled
center = new CGPoint (90, 330);
context.MoveTo (center.X, center.Y + 60);
for (int i = 1; i < 5; ++i) {
float x = (float)(60 * Math.Sin (i * 4 * Math.PI / 5));
float y = (float)(60 * Math.Cos (i * 4 * Math.PI / 5));
context.AddLineToPoint (center.X + x, center.Y + y);
}
// Closing the path connects the current point to the start of the current path.
context.ClosePath ();
// Use the even-odd fill mode.
context.EOFillPath ();
// Draw a Hexagon stroked
center = new CGPoint (210, 90);
context.MoveTo (center.X, center.Y + 60);
for (int i = 1; i < 6; ++i) {
float x = (float)(60 * Math.Sin (i * 2 * Math.PI / 6));
float y = (float)(60 * Math.Cos (i * 2 * Math.PI / 6));
context.AddLineToPoint (center.X + x, center.Y + y);
}
// Closing the path connects the current point to the start of the current path.
context.ClosePath ();
// And stroke the path
context.StrokePath ();
// Draw a Hexagon stroked & filled
center = new CGPoint (210, 240);
context.MoveTo (center.X, center.Y + 60);
for (int i = 1; i < 6; ++i) {
float x = (float)(60 * Math.Sin (i * 2 * Math.PI / 6));
float y = (float)(60 * Math.Cos (i * 2 * Math.PI / 6));
context.AddLineToPoint (center.X + x, center.Y + y);
}
// Closing the path connects the current point to the start of the current path.
context.ClosePath ();
// Use the winding-rule fill mode, and stroke the path after.
context.DrawPath (CGPathDrawingMode.FillStroke);
}