public override void DrawInContext (CGContext context) { base.DrawInContext (context); context.AddEllipseInRect (Bounds); context.SetFillColor (ClockColor); context.FillPath (); }
public static void FillEllipsis(CGContext context, RectangleF rect, CGColor color, float lineWidth) { context.SaveState(); context.SetFillColor(color); context.AddEllipseInRect(rect); context.FillPath(); context.RestoreState(); }
public static void FillPath(CGContext context, CGPath path, CGColor color) { context.SaveState(); context.SetFillColor(color); context.AddPath(path); context.FillPath(); context.RestoreState(); }
void drawBackground(CGContext context, Color color, float width, float height) { context.SetFillColor(color.ToCGColor()); context.FillRect(new RectangleF(HALF_PIXEL_X, HALF_PIXEL_Y, width+HALF_PIXEL_X, height+HALF_PIXEL_Y)); context.FillPath(); }
void HatchSolidDiamond(CGContext context) { var hatchWidth = getHatchWidth (hatchStyle); var hatchHeight = getHatchHeight (hatchStyle); var lineWidth = getLineWidth (hatchStyle); initializeContext(context, hatchHeight, false); /* draw background */ drawBackground (context, backColor, hatchWidth, hatchHeight); /* draw lines in the foreground color */ context.SetFillColor(foreColor.ToCGColor()); context.SetStrokeColor(foreColor.ToCGColor()); context.SetLineWidth(lineWidth); context.SetLineCap(CGLineCap.Square); float halfMe = hatchWidth / 2.0f; // We will paint two triangles from corners meeting in the middle // make sure to offset by half pixels so that the point is actually a point. context.MoveTo(-HALF_PIXEL_X,HALF_PIXEL_Y); context.AddLineToPoint(2+HALF_PIXEL_X, halfMe - HALF_PIXEL_Y); context.AddLineToPoint(-HALF_PIXEL_X, hatchHeight- (1.0f + HALF_PIXEL_Y)); context.ClosePath(); context.FillPath(); // now we do the right one context.MoveTo(hatchWidth,HALF_PIXEL_Y); context.AddLineToPoint(halfMe+HALF_PIXEL_X, halfMe - HALF_PIXEL_Y); context.AddLineToPoint(hatchWidth, hatchHeight - (1.0f + HALF_PIXEL_Y)); context.ClosePath(); context.FillPath(); }