private void FillRoundedRect(RectangleF rect, CGContext context) { float radius = 10.0f; context.BeginPath(); context.SetFillColor(0.0f, Opacity); context.MoveTo(rect.GetMinX() + radius, rect.GetMinY()); context.AddArc(rect.GetMaxX() - radius, rect.GetMinY() + radius, radius, (float)(3 * Math.PI / 2), 0f, false); context.AddArc(rect.GetMaxX() - radius, rect.GetMaxY() - radius, radius, 0, (float)(Math.PI / 2), false); context.AddArc(rect.GetMinX() + radius, rect.GetMaxY() - radius, radius, (float)(Math.PI / 2), (float)Math.PI, false); context.AddArc(rect.GetMinX() + radius, rect.GetMinY() + radius, radius, (float)Math.PI, (float)(3 * Math.PI / 2), false); context.ClosePath(); context.FillPath(); }
public void SSDrawRoundedRect(CGContext context, RectangleF rect, float cornerRadius) { var minx = rect.GetMinX(); var midx = rect.GetMidX(); var maxx = rect.GetMaxX(); var miny = rect.GetMinY(); var midy = rect.GetMidY(); var maxy = rect.GetMaxY(); context.MoveTo(minx, midy); context.AddArcToPoint(minx, miny, midx, miny, cornerRadius); context.AddArcToPoint(maxx, miny, maxx, midy, cornerRadius); context.AddArcToPoint(maxx, maxy, midx, maxy, cornerRadius); context.AddArcToPoint(minx, maxy, minx, midy, cornerRadius); context.ClosePath(); context.FillPath(); }
public override void Draw(CGRect rect) { base.Draw(rect); float margins = 4; CGRect drawRect = new CGRect(rect.X + margins, rect.Y + margins, rect.Width - margins * 2, rect.Height - margins * 2); CGContext context = UIGraphics.GetCurrentContext(); context.AddEllipseInRect(drawRect); context.AddEllipseInRect(drawRect.Inset(4, 4)); context.SetFillColor(UIColor.Black.CGColor); context.SetStrokeColor(UIColor.White.CGColor); context.SetLineWidth(0.5f); context.ClosePath(); context.SetShadow(new CGSize(1, 2), 4); context.DrawPath(CGPathDrawingMode.EOFillStroke); }
/// <summary> /// Draws a star at the bottom left of the context of the specified diameter /// </summary> protected void DrawStar (CGContext context, float starDiameter) { // declare vars // 144º float theta = 2 * (float)Math.PI * (2f / 5f); float radius = starDiameter / 2; // move up and over context.TranslateCTM (starDiameter / 2, starDiameter / 2); context.MoveTo (0, radius); for (int i = 1; i < 5; i++) { context.AddLineToPoint (radius * (float)Math.Sin (i * theta), radius * (float)Math.Cos (i * theta)); } //context.SetRGBFillColor (1, 1, 1, 1); context.ClosePath (); context.FillPath (); }
private static void PaintPath(CGContext canvas, CGPath path, SKPaint paint) { if (paint.IsStroke) { canvas.SetStrokeColor(CG.Color(paint.Color)); canvas.SetLineWidth(paint.StrokeWidth); canvas.SetLineCap(LineCap(paint.StrokeCap)); canvas.SetLineJoin(LineJoin(paint.StrokeJoin)); canvas.AddPath(path); canvas.StrokePath(); } else { canvas.SetFillColor(CG.Color(paint.Color)); canvas.AddPath(path); canvas.ClosePath(); canvas.FillPath(); } }
/// <summary> /// This is a slightly more complicated draw pattern, but using it is just /// as easy as the previous one. To use this one, simply change "DrawPolkaDotPattern" /// in line 54 above to "DrawStarPattern" /// </summary> protected void DrawStarPattern (CGContext context) { // declare vars float starDiameter = 16; // 144º float theta = 2 * (float)Math.PI * (2f / 5f); float radius = starDiameter / 2; // move up and over context.TranslateCTM (starDiameter / 2, starDiameter / 2); context.MoveTo (0, radius); for (int i = 1; i < 5; i++) { context.AddLineToPoint (radius * (float)Math.Sin (i * theta), radius * (float)Math.Cos (i * theta)); } // fill our star as dark gray context.ClosePath (); context.FillPath (); }
// Draws a star at the bottom left of the context of the specified diameter protected void DrawStar(CGContext context, float starDiameter) { // declare vars // 144º float theta = 2 * (float)Math.PI * (2f / 5f); float radius = starDiameter / 2; // move up and over context.TranslateCTM(starDiameter / 2, starDiameter / 2); context.MoveTo(0, radius); for (int i = 1; i < 5; i++) { context.AddLineToPoint(radius * (float)Math.Sin(i * theta), radius * (float)Math.Cos(i * theta)); } context.SetFillColor(1, 1, 1, 1); context.ClosePath(); context.FillPath(); }
public void DrawToContext(CGContext ctx) { if (_scale == 0) { return; } ctx.ScaleCTM(_scale, _scale); if (_scale != this.GetScaleToFit()) { ctx.TranslateCTM(((this.Width - (this.Width * _scale)) / 2), ((this.Height - (this.Height * _scale)) / 2)); } ctx.SaveState(); // float WIDTH = 22f; //pub HEIGHT = 14f; UIColor color = this.FillColor; if (color == null) { color = UIColor.Gray; } // triangle ctx.SaveState(); ctx.SetShouldAntialias(true); ctx.SetLineCap(CGLineCap.Butt); ctx.SetFillColor(color.CGColor); ctx.MoveTo(0, 14f); ctx.AddLineToPoint(11f, 0); ctx.AddLineToPoint(22f, 14f); ctx.ClosePath(); ctx.FillPath(); ctx.RestoreState(); ctx.RestoreState(); }
/// <summary> /// This is a slightly more complicated draw pattern, but using it is just /// as easy as the previous one. To use this one, simply change "DrawPolkaDotPattern" /// in line 54 above to "DrawStarPattern" /// </summary> protected void DrawStarPattern(CGContext context) { // declare vars float starDiameter = 16; // 144º float theta = 2 * (float)Math.PI * (2f / 5f); float radius = starDiameter / 2; // move up and over context.TranslateCTM(starDiameter / 2, starDiameter / 2); context.MoveTo(0, radius); for (int i = 1; i < 5; i++) { context.AddLineToPoint(radius * (float)Math.Sin(i * theta), radius * (float)Math.Cos(i * theta)); } // fill our star as dark gray context.ClosePath(); context.FillPath(); }
/// <summary> /// Draw the triangle /// </summary> /// <param name="rect">Rect.</param> public override void DrawRect(CGRect dirtyRect) { base.DrawRect(dirtyRect); NSGraphicsContext.GlobalSaveGraphicsState(); BackgroudColor.Set(); CGContext context = NSGraphicsContext.CurrentContext.GraphicsPort; context.BeginPath(); context.MoveTo(PUBLICATION_DOWN_WIDTH, PUBLICATION_DOWN_WIDTH); context.AddLineToPoint(PUBLICATION_DOWN_WIDTH, 0.0f); context.AddLineToPoint(0.0f, PUBLICATION_DOWN_WIDTH); context.AddLineToPoint(PUBLICATION_DOWN_WIDTH, PUBLICATION_DOWN_WIDTH); context.ClosePath(); context.DrawPath(CGPathDrawingMode.Fill); NSGraphicsContext.GlobalRestoreGraphicsState(); }
public static void AddRoundedRectToPath(CGContext context, RectangleF rect, float ovalWidth, float ovalHeight) { float fw, fh; if (ovalWidth == 0 || ovalHeight == 0) { context.AddRect(rect); return; } context.SaveState(); context.TranslateCTM(rect.GetMinX(), rect.GetMinY()); context.ScaleCTM(ovalWidth, ovalHeight); fw = rect.Width / ovalWidth; fh = rect.Height / ovalHeight; context.MoveTo(fw, fh / 2); context.AddArcToPoint(fw, fh, fw / 2, fh, 1); context.AddArcToPoint(0, fh, 0, fh / 2, 1); context.AddArcToPoint(0, 0, fw / 2, 0, 1); context.AddArcToPoint(fw, 0, fw, fh / 2, 1); context.ClosePath(); context.RestoreState(); }
//utility for drawing rectangle shape public void DrawRectShapeInContext(CGContext ctx, CGRect rect) { ctx.SetFillColor(UIColor.FromRGBA(95.0f / 255.0f, 104.0f / 255.0f, 114.0f / 255.0f, 1.0f).CGColor); ctx.SetStrokeColor(UIColor.FromRGBA(95.0f / 255.0f, 104.0f / 255.0f, 114.0f / 255.0f, 1.0f).CGColor); ctx.StrokeRect(rect); ctx.FillRect(rect); // Add rounded rect over plain rect with 4 pixel below the origin y, so that it will visible only the bottom rounded corners CGRect cornerRect = new CGRect(rect.X, rect.Y + 4, rect.Width, rect.Height); nfloat radius = 4; nfloat minx = cornerRect.GetMinX(), midx = cornerRect.GetMidX(), maxx = cornerRect.GetMaxX(); nfloat miny = cornerRect.GetMinY(), midy = cornerRect.GetMidY(), maxy = cornerRect.GetMaxY(); ctx.SaveState(); ctx.MoveTo(minx, miny); ctx.AddArcToPoint(minx, miny, midx, miny, radius); ctx.AddArcToPoint(maxx, miny, maxx, midy, radius); ctx.AddArcToPoint(maxx, maxy, midx, maxy, radius); ctx.AddArcToPoint(minx, maxy, minx, midy, radius); ctx.ClosePath(); ctx.DrawPath(CGPathDrawingMode.FillStroke); ctx.RestoreState(); }
public static void RoundRectPath(CGContext cr, CGRect rect, float[] cornerRadii) { if (cornerRadii == null || cornerRadii.Length != 4) { throw new ArgumentOutOfRangeException("cornerRadii", "cornerRadii count must be 4."); } cr.BeginPath(); float radius = cornerRadii[0]; cr.AddArc(rect.X + radius, rect.Y + radius, radius, (float)Math.PI, (float)(3.0f * Math.PI / 2.0f), false); radius = cornerRadii[1]; cr.AddArc(rect.X + rect.Width - radius, rect.Y + radius, radius, (float)(3.0f * Math.PI / 2.0f), 2.0f * (float)Math.PI, false); radius = cornerRadii[2]; cr.AddArc(rect.X + rect.Width - radius, rect.Y + rect.Height - radius, radius, (float)(2 * Math.PI), 5.0f * ((float)Math.PI / 2.0f), false); radius = cornerRadii[3]; cr.AddArc(rect.X + radius, rect.Y + rect.Height - radius, radius, (float)(5.0f * Math.PI / 2.0f), (float)(3.0f * Math.PI), false); cr.ClosePath(); }
//no use void DrawUpdateView() { if (BookInfo.DaysRemaining < 0) { NSColor.Red.Set(); } else { Utility.ColorWithRGB(0, 128, 252, 1.0f).Set(); } CGContext context = NSGraphicsContext.CurrentContext.GraphicsPort; context.BeginPath(); context.MoveTo(PUBLICATION_DOWN_ORGX, PUBLICATION_VIEW_HEIGHT); context.AddLineToPoint(PUBLICATION_COVER_WIDTH, PUBLICATION_DOWN_ORGY); context.AddLineToPoint(PUBLICATION_COVER_WIDTH, PUBLICATION_VIEW_HEIGHT); context.AddLineToPoint(PUBLICATION_DOWN_ORGX, PUBLICATION_VIEW_HEIGHT); context.ClosePath(); context.DrawPath(CGPathDrawingMode.Fill); }
//utility for drawing triangle shape public void DrawTriangleInContext(CGContext ctx, CGRect rect, float BorderWidth, bool isLeft) { UIColor color = UIColor.FromRGBA(95.0f / 255.0f, 104.0f / 255.0f, 114.0f / 255.0f, 1.0f); ctx.SetLineWidth(BorderWidth); ctx.SetStrokeColor(color.CGColor); ctx.SetFillColor(color.CGColor); ctx.SaveState(); if (isLeft) { ctx.MoveTo(rect.GetMinX(), rect.GetMinY()); } else { ctx.MoveTo(rect.GetMaxX(), rect.GetMinY()); } ctx.AddLineToPoint(rect.GetMinX(), rect.GetMaxY()); ctx.AddLineToPoint(rect.GetMaxX(), rect.GetMaxY()); ctx.ClosePath(); ctx.DrawPath(CGPathDrawingMode.FillStroke); ctx.RestoreState(); }
public override void DrawInContext(CGContext context) { // Drawing with a white stroke color context.SetRGBStrokeColor(1, 1, 1, 1); // Drawing with a blue fill color context.SetRGBFillColor(0, 0, 1, 1); // Draw them with a 2 stroke width so they are a bit more visible. context.SetLineWidth(2); PointF center; // Draw a Star stroked center = new PointF(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 PointF(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 PointF(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 PointF(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 PointF(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); }
public void DrawPath(IEnumerable <PathOperation> ops, Pen pen = null, BaseBrush baseBrush = null) { if (pen == null && baseBrush == null) { return; } DrawElement(() => { var bb = new BoundingBoxBuilder(); var lines = new List <CGPoint>(); foreach (var op in ops) { var moveTo = op as MoveTo; if (moveTo != null) { var start = moveTo.Start; var end = moveTo.End; context.MoveTo((nfloat)start.X, (nfloat)start.Y); context.MoveTo((nfloat)end.X, (nfloat)end.Y); bb.Add(start); bb.Add(end); continue; } var lt = op as LineTo; if (lt != null) { var start = lt.Start; var end = lt.End; context.AddLineToPoint((float)start.X, (float)start.Y); context.AddLineToPoint((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; var pp = Conversions.GetPoint(context.GetPathCurrentPoint()); Point c1, c2; at.GetCircles(pp, out c1, out c2); context.AddLineToPoint((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var curveTo = op as CurveTo; if (curveTo != null) { var end = curveTo.End; var control1 = curveTo.FirstControlPoint; var control2 = curveTo.SecondControlPoint; context.AddCurveToPoint((nfloat)control1.X, (nfloat)control1.Y, (nfloat)control2.X, (nfloat)control2.Y, (nfloat)end.X, (nfloat)end.Y); bb.Add(control1); bb.Add(control2); bb.Add(end); continue; } var cp = op as ClosePath; if (cp != null) { context.ClosePath(); continue; } throw new NotSupportedException("Path Op " + op); } return(bb.BoundingBox); }, pen, baseBrush); }
static void icon_check_empty(CGContext c) { c.MoveTo(1120f, 1280f); c.AddLineToPoint(288f, 1280f); c.AddQuadCurveToPoint(222f, 1280f, 175f, 1233f); c.AddQuadCurveToPoint(128f, 1186f, 128f, 1120f); c.AddLineToPoint(128f, 288f); c.AddQuadCurveToPoint(128f, 222f, 175f, 175f); c.AddQuadCurveToPoint(222f, 128f, 288f, 128f); c.AddLineToPoint(1120f, 128f); c.AddQuadCurveToPoint(1186f, 128f, 1233f, 175f); c.AddQuadCurveToPoint(1280f, 222f, 1280f, 288f); c.AddLineToPoint(1280f, 1120f); c.AddQuadCurveToPoint(1280f, 1186f, 1233f, 1233f); c.AddQuadCurveToPoint(1186f, 1280f, 1120f, 1280f); c.ClosePath(); c.MoveTo(1120f, 1280f); c.MoveTo(1408f, 1120f); c.AddLineToPoint(1408f, 288f); c.AddQuadCurveToPoint(1408f, 169f, 1323.5f, 84.5f); c.AddQuadCurveToPoint(1239f, 0f, 1120f, 0f); c.AddLineToPoint(288f, 0f); c.AddQuadCurveToPoint(169f, 0f, 84.5f, 84.5f); c.AddQuadCurveToPoint(0f, 169f, 0f, 288f); c.AddLineToPoint(0f, 1120f); c.AddQuadCurveToPoint(0f, 1239f, 84.5f, 1323.5f); c.AddQuadCurveToPoint(169f, 1408f, 288f, 1408f); c.AddLineToPoint(1120f, 1408f); c.AddQuadCurveToPoint(1239f, 1408f, 1323.5f, 1323.5f); c.AddQuadCurveToPoint(1408f, 1239f, 1408f, 1120f); c.ClosePath(); c.MoveTo(1408f, 1120f); c.FillPath(); c.StrokePath(); }
static void icon_chevron_left(CGContext c) { c.MoveTo(742f, -37f); c.AddLineToPoint(90f, 614f); c.AddQuadCurveToPoint(53f, 651f, 53f, 704.5f); c.AddQuadCurveToPoint(53f, 758f, 90f, 795f); c.AddLineToPoint(742f, 1446f); c.AddQuadCurveToPoint(779f, 1483f, 832.5f, 1483f); c.AddQuadCurveToPoint(886f, 1483f, 923f, 1446f); c.AddLineToPoint(998f, 1371f); c.AddQuadCurveToPoint(1035f, 1334f, 1035f, 1280.5f); c.AddQuadCurveToPoint(1035f, 1227f, 998f, 1190f); c.AddLineToPoint(512f, 704f); c.AddLineToPoint(998f, 219f); c.AddQuadCurveToPoint(1035f, 181f, 1035f, 128f); c.AddQuadCurveToPoint(1035f, 75f, 998f, 38f); c.AddLineToPoint(923f, -37f); c.AddQuadCurveToPoint(886f, -74f, 832.5f, -74f); c.AddQuadCurveToPoint(779f, -74f, 742f, -37f); c.ClosePath(); c.MoveTo(742f, -37f); c.FillPath(); c.StrokePath(); }
static void icon_circle_arrow_right(CGContext c) { c.MoveTo(1285f, 640f); c.AddQuadCurveToPoint(1285f, 667f, 1267f, 685f); c.AddLineToPoint(1176f, 776f); c.AddLineToPoint(814f, 1138f); c.AddQuadCurveToPoint(796f, 1156f, 769f, 1156f); c.AddQuadCurveToPoint(742f, 1156f, 724f, 1138f); c.AddLineToPoint(633f, 1047f); c.AddQuadCurveToPoint(615f, 1029f, 615f, 1002f); c.AddQuadCurveToPoint(615f, 975f, 633f, 957f); c.AddLineToPoint(822f, 768f); c.AddLineToPoint(320f, 768f); c.AddQuadCurveToPoint(294f, 768f, 275f, 749f); c.AddQuadCurveToPoint(256f, 730f, 256f, 704f); c.AddLineToPoint(256f, 576f); c.AddQuadCurveToPoint(256f, 550f, 275f, 531f); c.AddQuadCurveToPoint(294f, 512f, 320f, 512f); c.AddLineToPoint(822f, 512f); c.AddLineToPoint(633f, 323f); c.AddQuadCurveToPoint(614f, 304f, 614f, 278f); c.AddQuadCurveToPoint(614f, 252f, 633f, 233f); c.AddLineToPoint(724f, 142f); c.AddQuadCurveToPoint(742f, 124f, 769f, 124f); c.AddQuadCurveToPoint(796f, 124f, 814f, 142f); c.AddLineToPoint(1176f, 504f); c.AddLineToPoint(1267f, 595f); c.AddQuadCurveToPoint(1285f, 613f, 1285f, 640f); c.ClosePath(); c.MoveTo(1285f, 640f); c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
static void icon_cog(CGContext c) { c.MoveTo(1024f, 640f); c.AddQuadCurveToPoint(1024f, 746f, 949f, 821f); c.AddQuadCurveToPoint(874f, 896f, 768f, 896f); c.AddQuadCurveToPoint(662f, 896f, 587f, 821f); c.AddQuadCurveToPoint(512f, 746f, 512f, 640f); c.AddQuadCurveToPoint(512f, 534f, 587f, 459f); c.AddQuadCurveToPoint(662f, 384f, 768f, 384f); c.AddQuadCurveToPoint(874f, 384f, 949f, 459f); c.AddQuadCurveToPoint(1024f, 534f, 1024f, 640f); c.ClosePath(); c.MoveTo(1024f, 640f); c.MoveTo(1536f, 749f); c.AddLineToPoint(1536f, 527f); c.AddQuadCurveToPoint(1536f, 515f, 1528f, 504f); c.AddQuadCurveToPoint(1520f, 493f, 1508f, 491f); c.AddLineToPoint(1323f, 463f); c.AddQuadCurveToPoint(1304f, 409f, 1284f, 372f); c.AddQuadCurveToPoint(1319f, 322f, 1391f, 234f); c.AddQuadCurveToPoint(1401f, 222f, 1401f, 209f); c.AddQuadCurveToPoint(1401f, 196f, 1392f, 186f); c.AddQuadCurveToPoint(1365f, 149f, 1293f, 78f); c.AddQuadCurveToPoint(1221f, 7f, 1199f, 7f); c.AddQuadCurveToPoint(1187f, 7f, 1173f, 16f); c.AddLineToPoint(1035f, 124f); c.AddQuadCurveToPoint(991f, 101f, 944f, 86f); c.AddQuadCurveToPoint(928f, -50f, 915f, -100f); c.AddQuadCurveToPoint(908f, -128f, 879f, -128f); c.AddLineToPoint(657f, -128f); c.AddQuadCurveToPoint(643f, -128f, 632.5f, -119.5f); c.AddQuadCurveToPoint(622f, -111f, 621f, -98f); c.AddLineToPoint(593f, 86f); c.AddQuadCurveToPoint(544f, 102f, 503f, 123f); c.AddLineToPoint(362f, 16f); c.AddQuadCurveToPoint(352f, 7f, 337f, 7f); c.AddQuadCurveToPoint(323f, 7f, 312f, 18f); c.AddQuadCurveToPoint(186f, 132f, 147f, 186f); c.AddQuadCurveToPoint(140f, 196f, 140f, 209f); c.AddQuadCurveToPoint(140f, 221f, 148f, 232f); c.AddQuadCurveToPoint(163f, 253f, 199f, 298.5f); c.AddQuadCurveToPoint(235f, 344f, 253f, 369f); c.AddQuadCurveToPoint(226f, 419f, 212f, 468f); c.AddLineToPoint(29f, 495f); c.AddQuadCurveToPoint(16f, 497f, 8f, 507.5f); c.AddQuadCurveToPoint(0f, 518f, 0f, 531f); c.AddLineToPoint(0f, 753f); c.AddQuadCurveToPoint(0f, 765f, 8f, 776f); c.AddQuadCurveToPoint(16f, 787f, 27f, 789f); c.AddLineToPoint(213f, 817f); c.AddQuadCurveToPoint(227f, 863f, 252f, 909f); c.AddQuadCurveToPoint(212f, 966f, 145f, 1047f); c.AddQuadCurveToPoint(135f, 1059f, 135f, 1071f); c.AddQuadCurveToPoint(135f, 1081f, 144f, 1094f); c.AddQuadCurveToPoint(170f, 1130f, 242.5f, 1201.5f); c.AddQuadCurveToPoint(315f, 1273f, 337f, 1273f); c.AddQuadCurveToPoint(350f, 1273f, 363f, 1263f); c.AddLineToPoint(501f, 1156f); c.AddQuadCurveToPoint(545f, 1179f, 592f, 1194f); c.AddQuadCurveToPoint(608f, 1330f, 621f, 1380f); c.AddQuadCurveToPoint(628f, 1408f, 657f, 1408f); c.AddLineToPoint(879f, 1408f); c.AddQuadCurveToPoint(893f, 1408f, 903.5f, 1399.5f); c.AddQuadCurveToPoint(914f, 1391f, 915f, 1378f); c.AddLineToPoint(943f, 1194f); c.AddQuadCurveToPoint(992f, 1178f, 1033f, 1157f); c.AddLineToPoint(1175f, 1264f); c.AddQuadCurveToPoint(1184f, 1273f, 1199f, 1273f); c.AddQuadCurveToPoint(1212f, 1273f, 1224f, 1263f); c.AddQuadCurveToPoint(1353f, 1144f, 1389f, 1093f); c.AddQuadCurveToPoint(1396f, 1085f, 1396f, 1071f); c.AddQuadCurveToPoint(1396f, 1059f, 1388f, 1048f); c.AddQuadCurveToPoint(1373f, 1027f, 1337f, 981.5f); c.AddQuadCurveToPoint(1301f, 936f, 1283f, 911f); c.AddQuadCurveToPoint(1309f, 861f, 1324f, 813f); c.AddLineToPoint(1507f, 785f); c.AddQuadCurveToPoint(1520f, 783f, 1528f, 772.5f); c.AddQuadCurveToPoint(1536f, 762f, 1536f, 749f); c.ClosePath(); c.MoveTo(1536f, 749f); c.FillPath(); c.StrokePath(); }
static void icon_coffee(CGContext c) { c.MoveTo(1664f, 896f); c.AddQuadCurveToPoint(1664f, 976f, 1608f, 1032f); c.AddQuadCurveToPoint(1552f, 1088f, 1472f, 1088f); c.AddLineToPoint(1408f, 1088f); c.AddLineToPoint(1408f, 704f); c.AddLineToPoint(1472f, 704f); c.AddQuadCurveToPoint(1552f, 704f, 1608f, 760f); c.AddQuadCurveToPoint(1664f, 816f, 1664f, 896f); c.ClosePath(); c.MoveTo(1664f, 896f); c.MoveTo(0f, 128f); c.AddLineToPoint(1792f, 128f); c.AddQuadCurveToPoint(1792f, 22f, 1717f, -53f); c.AddQuadCurveToPoint(1642f, -128f, 1536f, -128f); c.AddLineToPoint(256f, -128f); c.AddQuadCurveToPoint(150f, -128f, 75f, -53f); c.AddQuadCurveToPoint(0f, 22f, 0f, 128f); c.ClosePath(); c.MoveTo(0f, 128f); c.MoveTo(1856f, 896f); c.AddQuadCurveToPoint(1856f, 737f, 1743.5f, 624.5f); c.AddQuadCurveToPoint(1631f, 512f, 1472f, 512f); c.AddLineToPoint(1408f, 512f); c.AddLineToPoint(1408f, 480f); c.AddQuadCurveToPoint(1408f, 388f, 1342f, 322f); c.AddQuadCurveToPoint(1276f, 256f, 1184f, 256f); c.AddLineToPoint(480f, 256f); c.AddQuadCurveToPoint(388f, 256f, 322f, 322f); c.AddQuadCurveToPoint(256f, 388f, 256f, 480f); c.AddLineToPoint(256f, 1216f); c.AddQuadCurveToPoint(256f, 1242f, 275f, 1261f); c.AddQuadCurveToPoint(294f, 1280f, 320f, 1280f); c.AddLineToPoint(1472f, 1280f); c.AddQuadCurveToPoint(1631f, 1280f, 1743.5f, 1167.5f); c.AddQuadCurveToPoint(1856f, 1055f, 1856f, 896f); c.ClosePath(); c.MoveTo(1856f, 896f); c.FillPath(); c.StrokePath(); }
static void icon_cloud_upload(CGContext c) { c.MoveTo(1280f, 672f); c.AddQuadCurveToPoint(1280f, 686f, 1271f, 695f); c.AddLineToPoint(919f, 1047f); c.AddQuadCurveToPoint(910f, 1056f, 896f, 1056f); c.AddQuadCurveToPoint(882f, 1056f, 873f, 1047f); c.AddLineToPoint(522f, 696f); c.AddQuadCurveToPoint(512f, 684f, 512f, 672f); c.AddQuadCurveToPoint(512f, 658f, 521f, 649f); c.AddQuadCurveToPoint(530f, 640f, 544f, 640f); c.AddLineToPoint(768f, 640f); c.AddLineToPoint(768f, 288f); c.AddQuadCurveToPoint(768f, 275f, 777.5f, 265.5f); c.AddQuadCurveToPoint(787f, 256f, 800f, 256f); c.AddLineToPoint(992f, 256f); c.AddQuadCurveToPoint(1005f, 256f, 1014.5f, 265.5f); c.AddQuadCurveToPoint(1024f, 275f, 1024f, 288f); c.AddLineToPoint(1024f, 640f); c.AddLineToPoint(1248f, 640f); c.AddQuadCurveToPoint(1261f, 640f, 1270.5f, 649.5f); c.AddQuadCurveToPoint(1280f, 659f, 1280f, 672f); c.ClosePath(); c.MoveTo(1280f, 672f); c.MoveTo(1920f, 384f); c.AddQuadCurveToPoint(1920f, 225f, 1807.5f, 112.5f); c.AddQuadCurveToPoint(1695f, 0f, 1536f, 0f); c.AddLineToPoint(448f, 0f); c.AddQuadCurveToPoint(263f, 0f, 131.5f, 131.5f); c.AddQuadCurveToPoint(0f, 263f, 0f, 448f); c.AddQuadCurveToPoint(0f, 578f, 70f, 688f); c.AddQuadCurveToPoint(140f, 798f, 258f, 853f); c.AddQuadCurveToPoint(256f, 883f, 256f, 896f); c.AddQuadCurveToPoint(256f, 1108f, 406f, 1258f); c.AddQuadCurveToPoint(556f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(924f, 1408f, 1053.5f, 1321f); c.AddQuadCurveToPoint(1183f, 1234f, 1242f, 1090f); c.AddQuadCurveToPoint(1313f, 1152f, 1408f, 1152f); c.AddQuadCurveToPoint(1514f, 1152f, 1589f, 1077f); c.AddQuadCurveToPoint(1664f, 1002f, 1664f, 896f); c.AddQuadCurveToPoint(1664f, 820f, 1623f, 758f); c.AddQuadCurveToPoint(1753f, 727f, 1836.5f, 622.5f); c.AddQuadCurveToPoint(1920f, 518f, 1920f, 384f); c.ClosePath(); c.MoveTo(1920f, 384f); c.FillPath(); c.StrokePath(); }
static void icon_cloud(CGContext c) { c.MoveTo(1920f, 384f); c.AddQuadCurveToPoint(1920f, 225f, 1807.5f, 112.5f); c.AddQuadCurveToPoint(1695f, 0f, 1536f, 0f); c.AddLineToPoint(448f, 0f); c.AddQuadCurveToPoint(263f, 0f, 131.5f, 131.5f); c.AddQuadCurveToPoint(0f, 263f, 0f, 448f); c.AddQuadCurveToPoint(0f, 580f, 71f, 689.5f); c.AddQuadCurveToPoint(142f, 799f, 258f, 853f); c.AddQuadCurveToPoint(256f, 881f, 256f, 896f); c.AddQuadCurveToPoint(256f, 1108f, 406f, 1258f); c.AddQuadCurveToPoint(556f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(926f, 1408f, 1054.5f, 1320f); c.AddQuadCurveToPoint(1183f, 1232f, 1242f, 1090f); c.AddQuadCurveToPoint(1312f, 1152f, 1408f, 1152f); c.AddQuadCurveToPoint(1514f, 1152f, 1589f, 1077f); c.AddQuadCurveToPoint(1664f, 1002f, 1664f, 896f); c.AddQuadCurveToPoint(1664f, 821f, 1623f, 758f); c.AddQuadCurveToPoint(1752f, 728f, 1836f, 623.5f); c.AddQuadCurveToPoint(1920f, 519f, 1920f, 384f); c.ClosePath(); c.MoveTo(1920f, 384f); c.FillPath(); c.StrokePath(); }
static void icon_circle_blank(CGContext c) { c.MoveTo(1280f, 640f); c.AddQuadCurveToPoint(1280f, 744f, 1239.5f, 838.5f); c.AddQuadCurveToPoint(1199f, 933f, 1130f, 1002f); c.AddQuadCurveToPoint(1061f, 1071f, 966.5f, 1111.5f); c.AddQuadCurveToPoint(872f, 1152f, 768f, 1152f); c.AddQuadCurveToPoint(664f, 1152f, 569.5f, 1111.5f); c.AddQuadCurveToPoint(475f, 1071f, 406f, 1002f); c.AddQuadCurveToPoint(337f, 933f, 296.5f, 838.5f); c.AddQuadCurveToPoint(256f, 744f, 256f, 640f); c.AddQuadCurveToPoint(256f, 536f, 296.5f, 441.5f); c.AddQuadCurveToPoint(337f, 347f, 406f, 278f); c.AddQuadCurveToPoint(475f, 209f, 569.5f, 168.5f); c.AddQuadCurveToPoint(664f, 128f, 768f, 128f); c.AddQuadCurveToPoint(872f, 128f, 966.5f, 168.5f); c.AddQuadCurveToPoint(1061f, 209f, 1130f, 278f); c.AddQuadCurveToPoint(1199f, 347f, 1239.5f, 441.5f); c.AddQuadCurveToPoint(1280f, 536f, 1280f, 640f); c.ClosePath(); c.MoveTo(1280f, 640f); c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
static void icon_circle_arrow_up(CGContext c) { c.MoveTo(1284f, 641f); c.AddQuadCurveToPoint(1284f, 668f, 1266f, 686f); c.AddLineToPoint(904f, 1048f); c.AddLineToPoint(813f, 1139f); c.AddQuadCurveToPoint(795f, 1157f, 768f, 1157f); c.AddQuadCurveToPoint(741f, 1157f, 723f, 1139f); c.AddLineToPoint(632f, 1048f); c.AddLineToPoint(270f, 686f); c.AddQuadCurveToPoint(252f, 668f, 252f, 641f); c.AddQuadCurveToPoint(252f, 614f, 270f, 596f); c.AddLineToPoint(361f, 505f); c.AddQuadCurveToPoint(379f, 487f, 406f, 487f); c.AddQuadCurveToPoint(433f, 487f, 451f, 505f); c.AddLineToPoint(640f, 694f); c.AddLineToPoint(640f, 192f); c.AddQuadCurveToPoint(640f, 166f, 659f, 147f); c.AddQuadCurveToPoint(678f, 128f, 704f, 128f); c.AddLineToPoint(832f, 128f); c.AddQuadCurveToPoint(858f, 128f, 877f, 147f); c.AddQuadCurveToPoint(896f, 166f, 896f, 192f); c.AddLineToPoint(896f, 694f); c.AddLineToPoint(1085f, 505f); c.AddQuadCurveToPoint(1104f, 486f, 1130f, 486f); c.AddQuadCurveToPoint(1156f, 486f, 1175f, 505f); c.AddLineToPoint(1266f, 596f); c.AddQuadCurveToPoint(1284f, 614f, 1284f, 641f); c.ClosePath(); c.MoveTo(1284f, 641f); c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
make_arcs(CGContext graphics, float x, float y, float width, float height, float startAngle, float sweepAngle, bool convert_units, bool antialiasing, bool isPieSlice) { int i; float drawn = 0; float endAngle; bool enough = false; // I do not think we need to convert the units so commented this out. /* if required deal, once and for all, with unit conversions */ //if (convert_units && !OPTIMIZE_CONVERSION(graphics)) //{ // x = gdip_unitx_convgr(graphics, x); // y = gdip_unity_convgr(graphics, y); // width = gdip_unitx_convgr(graphics, width); // height = gdip_unity_convgr(graphics, height); //} if (Math.Abs(sweepAngle) >= 360) { graphics.AddEllipseInRect(new CGRect(x, y, width, height)); return; } endAngle = startAngle + sweepAngle; /* if we end before the start then reverse positions (to keep increment positive) */ if (endAngle < startAngle) { var temp = endAngle; endAngle = startAngle; startAngle = temp; } if (isPieSlice) { graphics.MoveTo(x + (width / 2), y + (height / 2)); } /* i is the number of sub-arcs drawn, each sub-arc can be at most 90 degrees.*/ /* there can be no more then 4 subarcs, ie. 90 + 90 + 90 + (something less than 90) */ for (i = 0; i < 4; i++) { float current = startAngle + drawn; float additional; if (enough) { if (isPieSlice) { graphics.ClosePath(); } return; } additional = endAngle - current; /* otherwise, add the remainder */ if (additional > 90) { additional = 90.0f; } else { /* a near zero value will introduce bad artefact in the drawing (#78999) */ if ((additional >= -0.0001f) && (additional <= 0.0001f)) { return; } enough = true; } make_arc(graphics, (i == 0), /* only move to the starting pt in the 1st iteration */ x, y, width, height, /* bounding rectangle */ current, current + additional, antialiasing, isPieSlice); drawn += additional; } if (isPieSlice) { graphics.ClosePath(); } }
/// <summary> /// Draw the view into the specified rect. /// </summary> /// <param name="rect">The Rect.</param> public override void Draw(RectangleF rect) { RectangleF viewBounds = this.Bounds; CGContext curContext = UIGraphics.GetCurrentContext(); var numberString = this.Value.ToString(this.TextFormat); SizeF numberSize = new NSString(numberString).StringSize(this.Font); using (CGPath badgePath = this.NewBadgePathForTextSize(numberSize)) { RectangleF badgeRect = badgePath.PathBoundingBox; badgeRect.X = 0; badgeRect.Y = 0; badgeRect.Size = new SizeF((float)Math.Ceiling(badgeRect.Size.Width), (float)Math.Ceiling(badgeRect.Size.Height)); curContext.SaveState(); curContext.SetLineWidth(this.StrokeWidth); curContext.SetStrokeColorWithColor(this.StrokeColor.CGColor); curContext.SetFillColorWithColor(this.FillColor.CGColor); // Line stroke straddles the path, so we need to account for the outer portion badgeRect.Size = new SizeF(badgeRect.Size.Width + (float)Math.Ceiling(this.StrokeWidth / 2), badgeRect.Size.Height + (float)Math.Ceiling(this.StrokeWidth / 2)); PointF ctm = new PointF(0f, 0f); switch (this.Alignment) { case UITextAlignment.Justified: case UITextAlignment.Natural: case UITextAlignment.Center: ctm = new PointF((float)Math.Round((viewBounds.Size.Width - badgeRect.Size.Width) / 2), (float)Math.Round((viewBounds.Size.Height - badgeRect.Size.Height) / 2)); break; case UITextAlignment.Left: ctm = new PointF(0.0f, (float)Math.Round((viewBounds.Size.Height - badgeRect.Size.Height) / 2)); break; case UITextAlignment.Right: ctm = new PointF(viewBounds.Size.Width - badgeRect.Size.Width, (float)Math.Round(viewBounds.Size.Height - badgeRect.Size.Height) / 2); break; } curContext.TranslateCTM(ctm.X, ctm.Y); if (this.Shadow) { curContext.SaveState(); SizeF blurSize = this.ShadowOffset; curContext.SetShadowWithColor(blurSize, 4, this.ShadowColor.CGColor); curContext.BeginPath(); curContext.AddPath(badgePath); curContext.ClosePath(); curContext.DrawPath(CGPathDrawingMode.FillStroke); curContext.RestoreState(); } curContext.BeginPath(); curContext.AddPath(badgePath); curContext.ClosePath(); curContext.DrawPath(CGPathDrawingMode.FillStroke); if (this.Shine) { curContext.BeginPath(); curContext.AddPath(badgePath); curContext.ClosePath(); curContext.Clip(); using (CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB()) { float[] shinyColorGradient = new float[8] { 1f, 1f, 1f, 0.8f, 1f, 1f, 1f, 0f }; float[] shinyLocationGradient = new float[2] { 0f, 1f }; using (CGGradient gradient = new CGGradient(colorSpace, shinyColorGradient, shinyLocationGradient)) { curContext.SaveState(); curContext.BeginPath(); curContext.MoveTo(0.0f, 0.0f); float shineStartY = badgeRect.Size.Height * 0.25f; float shineStopY = shineStartY + (badgeRect.Size.Height * 0.4f); curContext.AddLineToPoint(0, shineStartY); curContext.AddCurveToPoint( 0, shineStopY, badgeRect.Size.Width, shineStopY, badgeRect.Size.Width, shineStartY); curContext.AddLineToPoint(badgeRect.Size.Width, 0); curContext.ClosePath(); curContext.Clip(); curContext.DrawLinearGradient( gradient, new PointF(badgeRect.Size.Width / 2.0f, 0.0f), new PointF(badgeRect.Size.Width / 2.0f, shineStopY), CGGradientDrawingOptions.DrawsBeforeStartLocation); curContext.RestoreState(); } } } curContext.RestoreState(); curContext.SaveState(); curContext.SetFillColorWithColor(this.TextColor.CGColor); PointF textPt = new PointF( ctm.X + ((badgeRect.Size.Width - numberSize.Width) / 2) + this.AdjustOffset.X, ctm.Y + ((badgeRect.Size.Height - numberSize.Height) / 2) + this.AdjustOffset.Y); new NSString(numberString).DrawString(textPt, this.Font); curContext.RestoreState(); } }
static void icon_cogs(CGContext c) { c.MoveTo(896f, 640f); c.AddQuadCurveToPoint(896f, 746f, 821f, 821f); c.AddQuadCurveToPoint(746f, 896f, 640f, 896f); c.AddQuadCurveToPoint(534f, 896f, 459f, 821f); c.AddQuadCurveToPoint(384f, 746f, 384f, 640f); c.AddQuadCurveToPoint(384f, 534f, 459f, 459f); c.AddQuadCurveToPoint(534f, 384f, 640f, 384f); c.AddQuadCurveToPoint(746f, 384f, 821f, 459f); c.AddQuadCurveToPoint(896f, 534f, 896f, 640f); c.ClosePath(); c.MoveTo(896f, 640f); c.MoveTo(1664f, 128f); c.AddQuadCurveToPoint(1664f, 180f, 1626f, 218f); c.AddQuadCurveToPoint(1588f, 256f, 1536f, 256f); c.AddQuadCurveToPoint(1484f, 256f, 1446f, 218f); c.AddQuadCurveToPoint(1408f, 180f, 1408f, 128f); c.AddQuadCurveToPoint(1408f, 75f, 1445.5f, 37.5f); c.AddQuadCurveToPoint(1483f, 0f, 1536f, 0f); c.AddQuadCurveToPoint(1589f, 0f, 1626.5f, 37.5f); c.AddQuadCurveToPoint(1664f, 75f, 1664f, 128f); c.ClosePath(); c.MoveTo(1664f, 128f); c.MoveTo(1664f, 1152f); c.AddQuadCurveToPoint(1664f, 1204f, 1626f, 1242f); c.AddQuadCurveToPoint(1588f, 1280f, 1536f, 1280f); c.AddQuadCurveToPoint(1484f, 1280f, 1446f, 1242f); c.AddQuadCurveToPoint(1408f, 1204f, 1408f, 1152f); c.AddQuadCurveToPoint(1408f, 1099f, 1445.5f, 1061.5f); c.AddQuadCurveToPoint(1483f, 1024f, 1536f, 1024f); c.AddQuadCurveToPoint(1589f, 1024f, 1626.5f, 1061.5f); c.AddQuadCurveToPoint(1664f, 1099f, 1664f, 1152f); c.ClosePath(); c.MoveTo(1664f, 1152f); c.MoveTo(1280f, 731f); c.AddLineToPoint(1280f, 546f); c.AddQuadCurveToPoint(1280f, 536f, 1273f, 526.5f); c.AddQuadCurveToPoint(1266f, 517f, 1257f, 516f); c.AddLineToPoint(1102f, 492f); c.AddQuadCurveToPoint(1091f, 457f, 1070f, 416f); c.AddQuadCurveToPoint(1104f, 368f, 1160f, 301f); c.AddQuadCurveToPoint(1167f, 291f, 1167f, 281f); c.AddQuadCurveToPoint(1167f, 269f, 1160f, 262f); c.AddQuadCurveToPoint(1137f, 232f, 1077.5f, 172.5f); c.AddQuadCurveToPoint(1018f, 113f, 999f, 113f); c.AddQuadCurveToPoint(988f, 113f, 978f, 120f); c.AddLineToPoint(863f, 210f); c.AddQuadCurveToPoint(826f, 191f, 786f, 179f); c.AddQuadCurveToPoint(775f, 71f, 763f, 24f); c.AddQuadCurveToPoint(756f, 0f, 733f, 0f); c.AddLineToPoint(547f, 0f); c.AddQuadCurveToPoint(536f, 0f, 527f, 7.5f); c.AddQuadCurveToPoint(518f, 15f, 517f, 25f); c.AddLineToPoint(494f, 178f); c.AddQuadCurveToPoint(460f, 188f, 419f, 209f); c.AddLineToPoint(301f, 120f); c.AddQuadCurveToPoint(294f, 113f, 281f, 113f); c.AddQuadCurveToPoint(270f, 113f, 260f, 121f); c.AddQuadCurveToPoint(116f, 254f, 116f, 281f); c.AddQuadCurveToPoint(116f, 290f, 123f, 300f); c.AddQuadCurveToPoint(133f, 314f, 164f, 353f); c.AddQuadCurveToPoint(195f, 392f, 211f, 414f); c.AddQuadCurveToPoint(188f, 458f, 176f, 496f); c.AddLineToPoint(24f, 520f); c.AddQuadCurveToPoint(14f, 521f, 7f, 529.5f); c.AddQuadCurveToPoint(0f, 538f, 0f, 549f); c.AddLineToPoint(0f, 734f); c.AddQuadCurveToPoint(0f, 744f, 7f, 753.5f); c.AddQuadCurveToPoint(14f, 763f, 23f, 764f); c.AddLineToPoint(178f, 788f); c.AddQuadCurveToPoint(189f, 823f, 210f, 864f); c.AddQuadCurveToPoint(176f, 912f, 120f, 979f); c.AddQuadCurveToPoint(113f, 990f, 113f, 999f); c.AddQuadCurveToPoint(113f, 1011f, 120f, 1019f); c.AddQuadCurveToPoint(142f, 1049f, 202f, 1108f); c.AddQuadCurveToPoint(262f, 1167f, 281f, 1167f); c.AddQuadCurveToPoint(292f, 1167f, 302f, 1160f); c.AddLineToPoint(417f, 1070f); c.AddQuadCurveToPoint(451f, 1088f, 494f, 1102f); c.AddQuadCurveToPoint(505f, 1210f, 517f, 1256f); c.AddQuadCurveToPoint(524f, 1280f, 547f, 1280f); c.AddLineToPoint(733f, 1280f); c.AddQuadCurveToPoint(744f, 1280f, 753f, 1272.5f); c.AddQuadCurveToPoint(762f, 1265f, 763f, 1255f); c.AddLineToPoint(786f, 1102f); c.AddQuadCurveToPoint(820f, 1092f, 861f, 1071f); c.AddLineToPoint(979f, 1160f); c.AddQuadCurveToPoint(987f, 1167f, 999f, 1167f); c.AddQuadCurveToPoint(1010f, 1167f, 1020f, 1159f); c.AddQuadCurveToPoint(1164f, 1026f, 1164f, 999f); c.AddQuadCurveToPoint(1164f, 990f, 1157f, 980f); c.AddQuadCurveToPoint(1145f, 964f, 1115f, 926f); c.AddQuadCurveToPoint(1085f, 888f, 1070f, 866f); c.AddQuadCurveToPoint(1093f, 818f, 1104f, 784f); c.AddLineToPoint(1256f, 761f); c.AddQuadCurveToPoint(1266f, 759f, 1273f, 750.5f); c.AddQuadCurveToPoint(1280f, 742f, 1280f, 731f); c.ClosePath(); c.MoveTo(1280f, 731f); c.MoveTo(1920f, 198f); c.AddLineToPoint(1920f, 58f); c.AddQuadCurveToPoint(1920f, 42f, 1771f, 27f); c.AddQuadCurveToPoint(1759f, 0f, 1741f, -25f); c.AddQuadCurveToPoint(1792f, -138f, 1792f, -163f); c.AddQuadCurveToPoint(1792f, -167f, 1788f, -170f); c.AddQuadCurveToPoint(1666f, -241f, 1664f, -241f); c.AddQuadCurveToPoint(1656f, -241f, 1618f, -194f); c.AddQuadCurveToPoint(1580f, -147f, 1566f, -126f); c.AddQuadCurveToPoint(1546f, -128f, 1536f, -128f); c.AddQuadCurveToPoint(1526f, -128f, 1506f, -126f); c.AddQuadCurveToPoint(1492f, -147f, 1454f, -194f); c.AddQuadCurveToPoint(1416f, -241f, 1408f, -241f); c.AddQuadCurveToPoint(1406f, -241f, 1284f, -170f); c.AddQuadCurveToPoint(1280f, -167f, 1280f, -163f); c.AddQuadCurveToPoint(1280f, -138f, 1331f, -25f); c.AddQuadCurveToPoint(1313f, 0f, 1301f, 27f); c.AddQuadCurveToPoint(1152f, 42f, 1152f, 58f); c.AddLineToPoint(1152f, 198f); c.AddQuadCurveToPoint(1152f, 214f, 1301f, 229f); c.AddQuadCurveToPoint(1314f, 258f, 1331f, 281f); c.AddQuadCurveToPoint(1280f, 394f, 1280f, 419f); c.AddQuadCurveToPoint(1280f, 423f, 1284f, 426f); c.AddQuadCurveToPoint(1288f, 428f, 1319f, 446f); c.AddQuadCurveToPoint(1350f, 464f, 1378f, 480f); c.AddQuadCurveToPoint(1406f, 496f, 1408f, 496f); c.AddQuadCurveToPoint(1416f, 496f, 1454f, 449.5f); c.AddQuadCurveToPoint(1492f, 403f, 1506f, 382f); c.AddQuadCurveToPoint(1526f, 384f, 1536f, 384f); c.AddQuadCurveToPoint(1546f, 384f, 1566f, 382f); c.AddQuadCurveToPoint(1617f, 453f, 1658f, 494f); c.AddLineToPoint(1664f, 496f); c.AddQuadCurveToPoint(1668f, 496f, 1788f, 426f); c.AddQuadCurveToPoint(1792f, 423f, 1792f, 419f); c.AddQuadCurveToPoint(1792f, 394f, 1741f, 281f); c.AddQuadCurveToPoint(1758f, 258f, 1771f, 229f); c.AddQuadCurveToPoint(1920f, 214f, 1920f, 198f); c.ClosePath(); c.MoveTo(1920f, 198f); c.MoveTo(1920f, 1222f); c.AddLineToPoint(1920f, 1082f); c.AddQuadCurveToPoint(1920f, 1066f, 1771f, 1051f); c.AddQuadCurveToPoint(1759f, 1024f, 1741f, 999f); c.AddQuadCurveToPoint(1792f, 886f, 1792f, 861f); c.AddQuadCurveToPoint(1792f, 857f, 1788f, 854f); c.AddQuadCurveToPoint(1666f, 783f, 1664f, 783f); c.AddQuadCurveToPoint(1656f, 783f, 1618f, 830f); c.AddQuadCurveToPoint(1580f, 877f, 1566f, 898f); c.AddQuadCurveToPoint(1546f, 896f, 1536f, 896f); c.AddQuadCurveToPoint(1526f, 896f, 1506f, 898f); c.AddQuadCurveToPoint(1492f, 877f, 1454f, 830f); c.AddQuadCurveToPoint(1416f, 783f, 1408f, 783f); c.AddQuadCurveToPoint(1406f, 783f, 1284f, 854f); c.AddQuadCurveToPoint(1280f, 857f, 1280f, 861f); c.AddQuadCurveToPoint(1280f, 886f, 1331f, 999f); c.AddQuadCurveToPoint(1313f, 1024f, 1301f, 1051f); c.AddQuadCurveToPoint(1152f, 1066f, 1152f, 1082f); c.AddLineToPoint(1152f, 1222f); c.AddQuadCurveToPoint(1152f, 1238f, 1301f, 1253f); c.AddQuadCurveToPoint(1314f, 1282f, 1331f, 1305f); c.AddQuadCurveToPoint(1280f, 1418f, 1280f, 1443f); c.AddQuadCurveToPoint(1280f, 1447f, 1284f, 1450f); c.AddQuadCurveToPoint(1288f, 1452f, 1319f, 1470f); c.AddQuadCurveToPoint(1350f, 1488f, 1378f, 1504f); c.AddQuadCurveToPoint(1406f, 1520f, 1408f, 1520f); c.AddQuadCurveToPoint(1416f, 1520f, 1454f, 1473.5f); c.AddQuadCurveToPoint(1492f, 1427f, 1506f, 1406f); c.AddQuadCurveToPoint(1526f, 1408f, 1536f, 1408f); c.AddQuadCurveToPoint(1546f, 1408f, 1566f, 1406f); c.AddQuadCurveToPoint(1617f, 1477f, 1658f, 1518f); c.AddLineToPoint(1664f, 1520f); c.AddQuadCurveToPoint(1668f, 1520f, 1788f, 1450f); c.AddQuadCurveToPoint(1792f, 1447f, 1792f, 1443f); c.AddQuadCurveToPoint(1792f, 1418f, 1741f, 1305f); c.AddQuadCurveToPoint(1758f, 1282f, 1771f, 1253f); c.AddQuadCurveToPoint(1920f, 1238f, 1920f, 1222f); c.ClosePath(); c.MoveTo(1920f, 1222f); c.FillPath(); c.StrokePath(); }
static void icon_chevron_right(CGContext c) { c.MoveTo(1099f, 704f); c.AddQuadCurveToPoint(1099f, 652f, 1062f, 613f); c.AddLineToPoint(410f, -38f); c.AddQuadCurveToPoint(373f, -75f, 320f, -75f); c.AddQuadCurveToPoint(267f, -75f, 230f, -38f); c.AddLineToPoint(154f, 37f); c.AddQuadCurveToPoint(117f, 76f, 117f, 128f); c.AddQuadCurveToPoint(117f, 181f, 154f, 218f); c.AddLineToPoint(640f, 704f); c.AddLineToPoint(154f, 1189f); c.AddQuadCurveToPoint(117f, 1228f, 117f, 1280f); c.AddQuadCurveToPoint(117f, 1333f, 154f, 1370f); c.AddLineToPoint(230f, 1445f); c.AddQuadCurveToPoint(266f, 1483f, 320f, 1483f); c.AddQuadCurveToPoint(374f, 1483f, 410f, 1445f); c.AddLineToPoint(1062f, 794f); c.AddQuadCurveToPoint(1099f, 757f, 1099f, 704f); c.ClosePath(); c.MoveTo(1099f, 704f); c.FillPath(); c.StrokePath(); }
static void icon_columns(CGContext c) { c.MoveTo(160f, 0f); c.AddLineToPoint(768f, 0f); c.AddLineToPoint(768f, 1152f); c.AddLineToPoint(128f, 1152f); c.AddLineToPoint(128f, 32f); c.AddQuadCurveToPoint(128f, 19f, 137.5f, 9.5f); c.AddQuadCurveToPoint(147f, 0f, 160f, 0f); c.ClosePath(); c.MoveTo(160f, 0f); c.MoveTo(1536f, 32f); c.AddLineToPoint(1536f, 1152f); c.AddLineToPoint(896f, 1152f); c.AddLineToPoint(896f, 0f); c.AddLineToPoint(1504f, 0f); c.AddQuadCurveToPoint(1517f, 0f, 1526.5f, 9.5f); c.AddQuadCurveToPoint(1536f, 19f, 1536f, 32f); c.ClosePath(); c.MoveTo(1536f, 32f); c.MoveTo(1664f, 1248f); c.AddLineToPoint(1664f, 32f); c.AddQuadCurveToPoint(1664f, -34f, 1617f, -81f); c.AddQuadCurveToPoint(1570f, -128f, 1504f, -128f); c.AddLineToPoint(160f, -128f); c.AddQuadCurveToPoint(94f, -128f, 47f, -81f); c.AddQuadCurveToPoint(0f, -34f, 0f, 32f); c.AddLineToPoint(0f, 1248f); c.AddQuadCurveToPoint(0f, 1314f, 47f, 1361f); c.AddQuadCurveToPoint(94f, 1408f, 160f, 1408f); c.AddLineToPoint(1504f, 1408f); c.AddQuadCurveToPoint(1570f, 1408f, 1617f, 1361f); c.AddQuadCurveToPoint(1664f, 1314f, 1664f, 1248f); c.ClosePath(); c.MoveTo(1664f, 1248f); c.FillPath(); c.StrokePath(); }
static void icon_chevron_down(CGContext c) { c.MoveTo(1611f, 832f); c.AddQuadCurveToPoint(1611f, 779f, 1574f, 742f); c.AddLineToPoint(923f, 91f); c.AddQuadCurveToPoint(885f, 53f, 832f, 53f); c.AddQuadCurveToPoint(778f, 53f, 742f, 91f); c.AddLineToPoint(91f, 742f); c.AddQuadCurveToPoint(53f, 778f, 53f, 832f); c.AddQuadCurveToPoint(53f, 885f, 91f, 923f); c.AddLineToPoint(165f, 998f); c.AddQuadCurveToPoint(204f, 1035f, 256f, 1035f); c.AddQuadCurveToPoint(309f, 1035f, 346f, 998f); c.AddLineToPoint(832f, 512f); c.AddLineToPoint(1318f, 998f); c.AddQuadCurveToPoint(1355f, 1035f, 1408f, 1035f); c.AddQuadCurveToPoint(1460f, 1035f, 1499f, 998f); c.AddLineToPoint(1574f, 923f); c.AddQuadCurveToPoint(1611f, 884f, 1611f, 832f); c.ClosePath(); c.MoveTo(1611f, 832f); c.FillPath(); c.StrokePath(); }
static void icon_comment(CGContext c) { c.MoveTo(1792f, 640f); c.AddQuadCurveToPoint(1792f, 466f, 1672f, 318.5f); c.AddQuadCurveToPoint(1552f, 171f, 1346f, 85.5f); c.AddQuadCurveToPoint(1140f, 0f, 896f, 0f); c.AddQuadCurveToPoint(826f, 0f, 751f, 8f); c.AddQuadCurveToPoint(553f, -167f, 291f, -234f); c.AddQuadCurveToPoint(242f, -248f, 177f, -256f); c.AddQuadCurveToPoint(160f, -258f, 146.5f, -247f); c.AddQuadCurveToPoint(133f, -236f, 129f, -218f); c.AddLineToPoint(129f, -217f); c.AddQuadCurveToPoint(126f, -213f, 128.5f, -205f); c.AddQuadCurveToPoint(131f, -197f, 130.5f, -195f); c.AddQuadCurveToPoint(130f, -193f, 135f, -185.5f); c.AddLineToPoint(141f, -176.5f); c.AddQuadCurveToPoint(141f, -176.5f, 148f, -168f); c.AddQuadCurveToPoint(155f, -159.5f, 156f, -159f); c.AddQuadCurveToPoint(163f, -151f, 187f, -124.5f); c.AddQuadCurveToPoint(211f, -98f, 221.5f, -86.5f); c.AddQuadCurveToPoint(232f, -75f, 252.5f, -47f); c.AddQuadCurveToPoint(273f, -19f, 285f, 4f); c.AddQuadCurveToPoint(297f, 27f, 312f, 63f); c.AddQuadCurveToPoint(327f, 99f, 338f, 139f); c.AddQuadCurveToPoint(181f, 228f, 90.5f, 359f); c.AddQuadCurveToPoint(0f, 490f, 0f, 640f); c.AddQuadCurveToPoint(0f, 770f, 71f, 888.5f); c.AddQuadCurveToPoint(142f, 1007f, 262f, 1093f); c.AddQuadCurveToPoint(382f, 1179f, 548f, 1229.5f); c.AddQuadCurveToPoint(714f, 1280f, 896f, 1280f); c.AddQuadCurveToPoint(1140f, 1280f, 1346f, 1194.5f); c.AddQuadCurveToPoint(1552f, 1109f, 1672f, 961.5f); c.AddQuadCurveToPoint(1792f, 814f, 1792f, 640f); c.ClosePath(); c.MoveTo(1792f, 640f); c.FillPath(); c.StrokePath(); }
static void icon_circle_arrow_down(CGContext c) { c.MoveTo(1284f, 639f); c.AddQuadCurveToPoint(1284f, 666f, 1266f, 684f); c.AddLineToPoint(1175f, 775f); c.AddQuadCurveToPoint(1157f, 793f, 1130f, 793f); c.AddQuadCurveToPoint(1103f, 793f, 1085f, 775f); c.AddLineToPoint(896f, 586f); c.AddLineToPoint(896f, 1088f); c.AddQuadCurveToPoint(896f, 1114f, 877f, 1133f); c.AddQuadCurveToPoint(858f, 1152f, 832f, 1152f); c.AddLineToPoint(704f, 1152f); c.AddQuadCurveToPoint(678f, 1152f, 659f, 1133f); c.AddQuadCurveToPoint(640f, 1114f, 640f, 1088f); c.AddLineToPoint(640f, 586f); c.AddLineToPoint(451f, 775f); c.AddQuadCurveToPoint(432f, 794f, 406f, 794f); c.AddQuadCurveToPoint(380f, 794f, 361f, 775f); c.AddLineToPoint(270f, 684f); c.AddQuadCurveToPoint(252f, 666f, 252f, 639f); c.AddQuadCurveToPoint(252f, 612f, 270f, 594f); c.AddLineToPoint(632f, 232f); c.AddLineToPoint(723f, 141f); c.AddQuadCurveToPoint(741f, 123f, 768f, 123f); c.AddQuadCurveToPoint(795f, 123f, 813f, 141f); c.AddLineToPoint(904f, 232f); c.AddLineToPoint(1266f, 594f); c.AddQuadCurveToPoint(1284f, 612f, 1284f, 639f); c.ClosePath(); c.MoveTo(1284f, 639f); c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
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(); }
static void icon_circle(CGContext c) { c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
static void icon_check(CGContext c) { c.MoveTo(1408f, 606f); c.AddLineToPoint(1408f, 288f); c.AddQuadCurveToPoint(1408f, 169f, 1323.5f, 84.5f); c.AddQuadCurveToPoint(1239f, 0f, 1120f, 0f); c.AddLineToPoint(288f, 0f); c.AddQuadCurveToPoint(169f, 0f, 84.5f, 84.5f); c.AddQuadCurveToPoint(0f, 169f, 0f, 288f); c.AddLineToPoint(0f, 1120f); c.AddQuadCurveToPoint(0f, 1239f, 84.5f, 1323.5f); c.AddQuadCurveToPoint(169f, 1408f, 288f, 1408f); c.AddLineToPoint(1120f, 1408f); c.AddQuadCurveToPoint(1183f, 1408f, 1237f, 1383f); c.AddQuadCurveToPoint(1252f, 1376f, 1255f, 1360f); c.AddQuadCurveToPoint(1258f, 1343f, 1246f, 1331f); c.AddLineToPoint(1197f, 1282f); c.AddQuadCurveToPoint(1187f, 1272f, 1174f, 1272f); c.AddQuadCurveToPoint(1171f, 1272f, 1165f, 1274f); c.AddQuadCurveToPoint(1142f, 1280f, 1120f, 1280f); c.AddLineToPoint(288f, 1280f); c.AddQuadCurveToPoint(222f, 1280f, 175f, 1233f); c.AddQuadCurveToPoint(128f, 1186f, 128f, 1120f); c.AddLineToPoint(128f, 288f); c.AddQuadCurveToPoint(128f, 222f, 175f, 175f); c.AddQuadCurveToPoint(222f, 128f, 288f, 128f); c.AddLineToPoint(1120f, 128f); c.AddQuadCurveToPoint(1186f, 128f, 1233f, 175f); c.AddQuadCurveToPoint(1280f, 222f, 1280f, 288f); c.AddLineToPoint(1280f, 542f); c.AddQuadCurveToPoint(1280f, 555f, 1289f, 564f); c.AddLineToPoint(1353f, 628f); c.AddQuadCurveToPoint(1363f, 638f, 1376f, 638f); c.AddQuadCurveToPoint(1382f, 638f, 1388f, 635f); c.AddQuadCurveToPoint(1408f, 627f, 1408f, 606f); c.ClosePath(); c.MoveTo(1408f, 606f); c.MoveTo(1639f, 1095f); c.AddLineToPoint(825f, 281f); c.AddQuadCurveToPoint(801f, 257f, 768f, 257f); c.AddQuadCurveToPoint(735f, 257f, 711f, 281f); c.AddLineToPoint(281f, 711f); c.AddQuadCurveToPoint(257f, 735f, 257f, 768f); c.AddQuadCurveToPoint(257f, 801f, 281f, 825f); c.AddLineToPoint(391f, 935f); c.AddQuadCurveToPoint(415f, 959f, 448f, 959f); c.AddQuadCurveToPoint(481f, 959f, 505f, 935f); c.AddLineToPoint(768f, 672f); c.AddLineToPoint(1415f, 1319f); c.AddQuadCurveToPoint(1439f, 1343f, 1472f, 1343f); c.AddQuadCurveToPoint(1505f, 1343f, 1529f, 1319f); c.AddLineToPoint(1639f, 1209f); c.AddQuadCurveToPoint(1663f, 1185f, 1663f, 1152f); c.AddQuadCurveToPoint(1663f, 1119f, 1639f, 1095f); c.ClosePath(); c.MoveTo(1639f, 1095f); c.FillPath(); c.StrokePath(); }
public void DrawPath(IEnumerable <PathOp> ops, Pen pen = null, Brush brush = null) { if (pen == null && brush == null) { return; } DrawElement(() => { var bb = new BoundingBoxBuilder(); foreach (var op in ops) { var mt = op as MoveTo; if (mt != null) { var p = mt.Point; if (!IsValid(p.X) || !IsValid(p.Y)) { continue; } context.MoveTo((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var lt = op as LineTo; if (lt != null) { var p = lt.Point; if (!IsValid(p.X) || !IsValid(p.Y)) { continue; } context.AddLineToPoint((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var at = op as ArcTo; if (at != null) { var p = at.Point; if (!IsValid(p.X) || !IsValid(p.Y)) { continue; } var pp = Conversions.GetPoint(context.GetPathCurrentPoint()); if (pp == p) { continue; } Point c1, c2; at.GetCircles(pp, out c1, out c2); var circleCenter = (at.LargeArc ^ at.SweepClockwise) ? c1 : c2; var startAngle = (float)Math.Atan2(pp.Y - circleCenter.Y, pp.X - circleCenter.X); var endAngle = (float)Math.Atan2(p.Y - circleCenter.Y, p.X - circleCenter.X); if (!IsValid(circleCenter.X) || !IsValid(circleCenter.Y) || !IsValid(startAngle) || !IsValid(endAngle)) { context.MoveTo((nfloat)p.X, (nfloat)p.Y); continue; } var clockwise = !at.SweepClockwise; context.AddArc((nfloat)circleCenter.X, (nfloat)circleCenter.Y, (nfloat)at.Radius.Min, startAngle, endAngle, clockwise); bb.Add(p); continue; } var ct = op as CurveTo; if (ct != null) { var p = ct.Point; if (!IsValid(p.X) || !IsValid(p.Y)) { continue; } var c1 = ct.Control1; var c2 = ct.Control2; if (!IsValid(c1.X) || !IsValid(c1.Y) || !IsValid(c2.X) || !IsValid(c2.Y)) { context.MoveTo((nfloat)p.X, (nfloat)p.Y); continue; } context.AddCurveToPoint((nfloat)c1.X, (nfloat)c1.Y, (nfloat)c2.X, (nfloat)c2.Y, (nfloat)p.X, (nfloat)p.Y); bb.Add(p); bb.Add(c1); bb.Add(c2); continue; } var cp = op as ClosePath; if (cp != null) { context.ClosePath(); continue; } throw new NotSupportedException("Path Op " + op); } return(bb.BoundingBox); }, pen, brush); }
public override void DrawInContext(CGContext context) { // Drawing with a white stroke color context.SetRGBStrokeColor(1, 1, 1, 1); // And draw with a blue fill color context.SetRGBFillColor(0, 0, 1, 1); // Draw them with a 2 stroke width so they are a bit more visible. context.SetLineWidth(2); // Add an ellipse circumscribed in the given rect to the current path, then stroke it context.AddEllipseInRect(new RectangleF(30, 30, 60, 60)); context.StrokePath(); // Stroke ellipse convenience that is equivalent to AddEllipseInRect(); StrokePath(); context.StrokeEllipseInRect(new RectangleF(30, 120, 60, 60)); // Fill rect convenience equivalent to AddEllipseInRect(); FillPath(); context.FillEllipseInRect(new RectangleF(30, 210, 60, 60)); // Stroke 2 seperate arcs context.AddArc(150, 60, 30, 0, (float)Math.PI / 2, false); context.StrokePath(); context.AddArc(150, 60, 30, (float)(3 * Math.PI / 2), (float)Math.PI, true); context.StrokePath(); // Stroke 2 arcs together going opposite directions. context.AddArc(150, 150, 30, 0, (float)Math.PI / 2, false); context.AddArc(150, 150, 30, (float)(3 * Math.PI / 2), (float)Math.PI, true); context.StrokePath(); // Stroke 2 arcs together going the same direction.. context.AddArc(150, 240, 30, 0, (float)(Math.PI / 2), false); context.AddArc(150, 240, 30, (float)Math.PI, (float)(3 * Math.PI / 2), false); context.StrokePath(); // Stroke an arc using AddArcToPoint PointF [] p = { new PointF(210, 30), new PointF(210, 60), new PointF(240, 60), }; context.MoveTo(p[0].X, p[0].Y); context.AddArcToPoint(p[1].X, p[1].Y, p[2].X, p[2].Y, 30); context.StrokePath(); // Show the two segments that are used to determine the tangent lines to draw the arc. context.SetRGBStrokeColor(1, 0, 0, 1); context.AddLines(p); context.StrokePath(); // As a bonus, we'll combine arcs to create a round rectangle! // Drawing with a white stroke color context.SetRGBStrokeColor(1, 1, 1, 1); // If you were making this as a routine, you would probably accept a rectangle // that defines its bounds, and a radius reflecting the "rounded-ness" of the rectangle. var rrect = new RectangleF(210, 90, 60, 60); var radius = 10; // NOTE: At this point you may want to verify that your radius is no more than half // the width and height of your rectangle, as this technique degenerates for those cases. // In order to draw a rounded rectangle, we will take advantage of the fact that // context.AddArcToPoint will draw straight lines past the start and end of the arc // in order to create the path from the current position and the destination position. // In order to create the 4 arcs correctly, we need to know the min, mid and max positions // on the x and y lengths of the given rectangle. float minx = rrect.X, midx = rrect.X + rrect.Width / 2, maxx = rrect.X + rrect.Width; float miny = rrect.Y, midy = rrect.Y + rrect.Height / 2, maxy = rrect.Y + rrect.Height; // Next, we will go around the rectangle in the order given by the figure below. // minx midx maxx // miny 2 3 4 // midy 1 9 5 // maxy 8 7 6 // Which gives us a coincident start and end point, which is incidental to this technique, but still doesn't // form a closed path, so we still need to close the path to connect the ends correctly. // Thus we start by moving to point 1, then adding arcs through each pair of points that follows. // You could use a similar tecgnique to create any shape with rounded corners. // Start at 1 context.MoveTo(minx, midy); // Add an arc through 2 to 3 context.AddArcToPoint(minx, miny, midx, miny, radius); // Add an arc through 4 to 5 context.AddArcToPoint(maxx, miny, maxx, midy, radius); // Add an arc through 6 to 7 context.AddArcToPoint(maxx, maxy, midx, maxy, radius); // Add an arc through 8 to 9 context.AddArcToPoint(minx, maxy, minx, midy, radius); // Close the path context.ClosePath(); // Fill & stroke the path context.DrawPath(CGPathDrawingMode.FillStroke); }
public override void Draw(RectangleF rect) { GeometryAnnotation myAnnotation = MainView.Annotation as GeometryAnnotation; // only draw our lines if we're not in the middle of a transition and we // acutally have some points to draw. if (!this.Hidden && myAnnotation.Points != null && myAnnotation.Points.Count > 0) { CGContext context = UIGraphics.GetCurrentContext(); if (myAnnotation.LineColor != null) { myAnnotation.LineColor = UIColor.White; } context.SetStrokeColorWithColor(myAnnotation.LineColor.CGColor); if (myAnnotation.Type == GeometryType.Polygon) { context.SetRGBFillColor(0.0f, 0.0f, 1.0f, 1.0f); } // Draw them with a 2.0 stroke width so they are a bit more visible context.SetLineWidth(2.0f); for (int idx = 0; idx < myAnnotation.Points.Count; idx++) { CLLocation location = myAnnotation.Points[idx]; PointF point = MainView.MapView.ConvertCoordinate(location.Coordinate, this); //Debug.WriteLine("Point: {0}, {1}", point.X, point.Y); if (idx == 0) { context.MoveTo(point.X, point.Y); } else { context.AddLineToPoint(point.X, point.Y); } } if (myAnnotation.Type == GeometryType.Line) { context.StrokePath(); } else if (myAnnotation.Type == GeometryType.Polygon) { context.ClosePath(); context.DrawPath(CGPathDrawingMode.FillStroke); } // debug. Draw the line around our view. /* * CGContextMoveToPoint(context, 0, 0); * CGContextAddLineToPoint(context, 0, self.frame.size.height); * CGContextAddLineToPoint(context, self.frame.size.width, self.frame.size.height); * CGContextAddLineToPoint(context, self.frame.size.width, 0); * CGContextAddLineToPoint(context, 0, 0); * CGContextStrokePath(context); */ } }
static void icon_chevron_up(CGContext c) { c.MoveTo(1611f, 320f); c.AddQuadCurveToPoint(1611f, 267f, 1574f, 230f); c.AddLineToPoint(1499f, 155f); c.AddQuadCurveToPoint(1461f, 117f, 1408f, 117f); c.AddQuadCurveToPoint(1354f, 117f, 1318f, 155f); c.AddLineToPoint(832f, 640f); c.AddLineToPoint(346f, 155f); c.AddQuadCurveToPoint(310f, 117f, 256f, 117f); c.AddQuadCurveToPoint(202f, 117f, 166f, 155f); c.AddLineToPoint(91f, 230f); c.AddQuadCurveToPoint(53f, 266f, 53f, 320f); c.AddQuadCurveToPoint(53f, 373f, 91f, 411f); c.AddLineToPoint(742f, 1062f); c.AddQuadCurveToPoint(779f, 1099f, 832f, 1099f); c.AddQuadCurveToPoint(884f, 1099f, 923f, 1062f); c.AddLineToPoint(1573f, 411f); c.AddQuadCurveToPoint(1611f, 373f, 1611f, 320f); c.ClosePath(); c.MoveTo(1611f, 320f); c.FillPath(); c.StrokePath(); }
public static void DrawLine(CGContext context, List<PointF> points, CGColor color, float lineWidth, bool closePath, bool dashed) { if (points == null) throw new NullReferenceException(); if (points.Count == 0) throw new ArgumentException("The line must have at least one point."); context.SaveState(); context.SetStrokeColor(color); context.SetLineWidth(lineWidth); context.MoveTo(points[0].X, points[0].Y); for(int a = 1; a < points.Count; a++) context.AddLineToPoint(points[a].X, points[a].Y); if (dashed) context.SetLineDash(0, new float[2] { 1, 2 }, 2); if (closePath) context.ClosePath(); context.StrokePath(); context.RestoreState(); }
private void DrawBorder(CGContext context, RectangleF rect) { context.SaveState (); context.BeginPath (); float lineSize = 2f; if (this.scaleFactor > 1) { lineSize += this.scaleFactor * .25f; } context.SetLineWidth (lineSize); context.SetStrokeColor (this.borderColor.CGColor); MakePath (context, rect); context.ClosePath (); context.StrokePath (); context.RestoreState (); }
public override void Draw(RectangleF rect) { float[] color = Color.CGColor.Components; UIGraphics.BeginImageContext(new SizeF(30, 20)); CGContext ctx = UIGraphics.GetCurrentContext(); ctx.SetRGBFillColor(color[0], color[1], color[2], 1); ctx.SetShadowWithColor(SizeF.Empty, 7f, UIColor.Black.CGColor); ctx.AddLines(new[] { new PointF(15, 5), new PointF(25, 25), new PointF(5, 25) }); ctx.ClosePath(); ctx.FillPath(); UIImage viewImage = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); var imgframe = new RectangleF((ShowOnRect.X + ((ShowOnRect.Width - 30) / 2)), ((ShowOnRect.Height / 2) + ShowOnRect.Y), 30, 13); var img = new UIImageView(viewImage); AddSubview(img); img.TranslatesAutoresizingMaskIntoConstraints = false; var dict = new NSDictionary("img", img); img.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat(string.Format(@"H:|-{0}-[img({1})]", imgframe.X, imgframe.Width), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); img.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat(string.Format(@"V:|-{0}-[img({1})]", imgframe.Y, imgframe.Height), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); UIFont font = UIFont.FromName(FontName, FontSize); var message = new NSAttributedString(Message, font); SizeF size = message.GetBoundingRect(new SizeF(FieldFrame.Width - (PaddingInErrorPopUp) * 2, 1000), NSStringDrawingOptions.UsesLineFragmentOrigin, null).Size; size = new SizeF((float)Math.Ceiling(size.Width), (float)Math.Ceiling(size.Height)); var view = new UIView(RectangleF.Empty); InsertSubviewBelow(view, img); view.BackgroundColor = Color; view.Layer.CornerRadius = 5f; view.Layer.ShadowColor = UIColor.Black.CGColor; view.Layer.ShadowRadius = 5f; view.Layer.Opacity = 1f; view.Layer.ShadowOffset = SizeF.Empty; view.TranslatesAutoresizingMaskIntoConstraints = false; dict = new NSDictionary("view", view); view.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( string.Format(@"H:|-{0}-[view({1})]", FieldFrame.X + (FieldFrame.Width - (size.Width + (PaddingInErrorPopUp * 2))), size.Width + (PaddingInErrorPopUp * 2)), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); view.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( string.Format(@"V:|-{0}-[view({1})]", imgframe.Y + imgframe.Height, size.Height + (PaddingInErrorPopUp * 2)), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); var lbl = new UILabel(RectangleF.Empty) { Font = font, Lines = 0, BackgroundColor = UIColor.Clear, Text = Message, TextColor = FontColor }; view.AddSubview(lbl); lbl.TranslatesAutoresizingMaskIntoConstraints = false; dict = new NSDictionary("lbl", lbl); lbl.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( string.Format(@"H:|-{0}-[lbl({1})]", PaddingInErrorPopUp, size.Width), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); lbl.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( string.Format(@"V:|-{0}-[lbl({1})]", PaddingInErrorPopUp, size.Height), NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); }
static void icon_comments(CGContext c) { c.MoveTo(1408f, 768f); c.AddQuadCurveToPoint(1408f, 629f, 1314f, 511f); c.AddQuadCurveToPoint(1220f, 393f, 1057.5f, 324.5f); c.AddQuadCurveToPoint(895f, 256f, 704f, 256f); c.AddQuadCurveToPoint(618f, 256f, 528f, 272f); c.AddQuadCurveToPoint(404f, 184f, 250f, 144f); c.AddQuadCurveToPoint(214f, 135f, 164f, 128f); c.AddLineToPoint(161f, 128f); c.AddQuadCurveToPoint(150f, 128f, 140.5f, 136f); c.AddQuadCurveToPoint(131f, 144f, 129f, 157f); c.AddQuadCurveToPoint(128f, 160f, 128f, 163.5f); c.AddQuadCurveToPoint(128f, 167f, 128.5f, 170f); c.AddQuadCurveToPoint(129f, 173f, 130.5f, 176f); c.AddLineToPoint(133f, 181f); c.AddQuadCurveToPoint(133f, 181f, 136.5f, 186.5f); c.AddQuadCurveToPoint(140f, 192f, 140.5f, 191.5f); c.AddQuadCurveToPoint(141f, 191f, 145f, 196.5f); c.AddQuadCurveToPoint(149f, 202f, 149f, 201f); c.AddQuadCurveToPoint(154f, 207f, 172f, 226f); c.AddQuadCurveToPoint(190f, 245f, 198f, 255.5f); c.AddQuadCurveToPoint(206f, 266f, 220.5f, 284.5f); c.AddQuadCurveToPoint(235f, 303f, 245.5f, 323f); c.AddQuadCurveToPoint(256f, 343f, 266f, 367f); c.AddQuadCurveToPoint(142f, 439f, 71f, 544f); c.AddQuadCurveToPoint(0f, 649f, 0f, 768f); c.AddQuadCurveToPoint(0f, 907f, 94f, 1025f); c.AddQuadCurveToPoint(188f, 1143f, 350.5f, 1211.5f); c.AddQuadCurveToPoint(513f, 1280f, 704f, 1280f); c.AddQuadCurveToPoint(895f, 1280f, 1057.5f, 1211.5f); c.AddQuadCurveToPoint(1220f, 1143f, 1314f, 1025f); c.AddQuadCurveToPoint(1408f, 907f, 1408f, 768f); c.ClosePath(); c.MoveTo(1408f, 768f); c.MoveTo(1792f, 512f); c.AddQuadCurveToPoint(1792f, 392f, 1721f, 287.5f); c.AddQuadCurveToPoint(1650f, 183f, 1526f, 111f); c.AddQuadCurveToPoint(1536f, 87f, 1546.5f, 67f); c.AddQuadCurveToPoint(1557f, 47f, 1571.5f, 28.5f); c.AddQuadCurveToPoint(1586f, 10f, 1594f, -0.5f); c.AddQuadCurveToPoint(1602f, -11f, 1620f, -30f); c.AddQuadCurveToPoint(1638f, -49f, 1643f, -55f); c.AddQuadCurveToPoint(1644f, -56f, 1647f, -59.5f); c.AddQuadCurveToPoint(1650f, -63f, 1651.5f, -64.5f); c.AddQuadCurveToPoint(1653f, -66f, 1655.5f, -69.5f); c.AddQuadCurveToPoint(1658f, -73f, 1659f, -75f); c.AddLineToPoint(1661.5f, -80f); c.AddQuadCurveToPoint(1661.5f, -80f, 1663.5f, -86f); c.AddQuadCurveToPoint(1665.5f, -92f, 1664f, -92.5f); c.AddQuadCurveToPoint(1662.5f, -93f, 1663f, -99f); c.AddQuadCurveToPoint(1660f, -113f, 1650f, -121f); c.AddQuadCurveToPoint(1640f, -129f, 1628f, -128f); c.AddQuadCurveToPoint(1578f, -121f, 1542f, -112f); c.AddQuadCurveToPoint(1388f, -72f, 1264f, 16f); c.AddQuadCurveToPoint(1174f, 0f, 1088f, 0f); c.AddQuadCurveToPoint(817f, 0f, 616f, 132f); c.AddQuadCurveToPoint(674f, 128f, 704f, 128f); c.AddQuadCurveToPoint(865f, 128f, 1013f, 173f); c.AddQuadCurveToPoint(1161f, 218f, 1277f, 302f); c.AddQuadCurveToPoint(1402f, 394f, 1469f, 514f); c.AddQuadCurveToPoint(1536f, 634f, 1536f, 768f); c.AddQuadCurveToPoint(1536f, 845f, 1513f, 920f); c.AddQuadCurveToPoint(1642f, 849f, 1717f, 742f); c.AddQuadCurveToPoint(1792f, 635f, 1792f, 512f); c.ClosePath(); c.MoveTo(1792f, 512f); c.FillPath(); c.StrokePath(); }
static void icon_circle_arrow_left(CGContext c) { c.MoveTo(1280f, 576f); c.AddLineToPoint(1280f, 704f); c.AddQuadCurveToPoint(1280f, 730f, 1261f, 749f); c.AddQuadCurveToPoint(1242f, 768f, 1216f, 768f); c.AddLineToPoint(714f, 768f); c.AddLineToPoint(903f, 957f); c.AddQuadCurveToPoint(922f, 976f, 922f, 1002f); c.AddQuadCurveToPoint(922f, 1028f, 903f, 1047f); c.AddLineToPoint(812f, 1138f); c.AddQuadCurveToPoint(794f, 1156f, 767f, 1156f); c.AddQuadCurveToPoint(740f, 1156f, 722f, 1138f); c.AddLineToPoint(360f, 776f); c.AddLineToPoint(269f, 685f); c.AddQuadCurveToPoint(251f, 667f, 251f, 640f); c.AddQuadCurveToPoint(251f, 613f, 269f, 595f); c.AddLineToPoint(360f, 504f); c.AddLineToPoint(722f, 142f); c.AddQuadCurveToPoint(740f, 124f, 767f, 124f); c.AddQuadCurveToPoint(794f, 124f, 812f, 142f); c.AddLineToPoint(903f, 233f); c.AddQuadCurveToPoint(921f, 251f, 921f, 278f); c.AddQuadCurveToPoint(921f, 305f, 903f, 323f); c.AddLineToPoint(714f, 512f); c.AddLineToPoint(1216f, 512f); c.AddQuadCurveToPoint(1242f, 512f, 1261f, 531f); c.AddQuadCurveToPoint(1280f, 550f, 1280f, 576f); c.ClosePath(); c.MoveTo(1280f, 576f); c.MoveTo(1536f, 640f); c.AddQuadCurveToPoint(1536f, 431f, 1433f, 254.5f); c.AddQuadCurveToPoint(1330f, 78f, 1153.5f, -25f); c.AddQuadCurveToPoint(977f, -128f, 768f, -128f); c.AddQuadCurveToPoint(559f, -128f, 382.5f, -25f); c.AddQuadCurveToPoint(206f, 78f, 103f, 254.5f); c.AddQuadCurveToPoint(0f, 431f, 0f, 640f); c.AddQuadCurveToPoint(0f, 849f, 103f, 1025.5f); c.AddQuadCurveToPoint(206f, 1202f, 382.5f, 1305f); c.AddQuadCurveToPoint(559f, 1408f, 768f, 1408f); c.AddQuadCurveToPoint(977f, 1408f, 1153.5f, 1305f); c.AddQuadCurveToPoint(1330f, 1202f, 1433f, 1025.5f); c.AddQuadCurveToPoint(1536f, 849f, 1536f, 640f); c.ClosePath(); c.MoveTo(1536f, 640f); c.FillPath(); c.StrokePath(); }
static void icon_question_sign(CGContext c) { c.MoveTo(0f, 375f); c.AddQuadCurveToPoint(0f, 453f, 29.5f, 521f); c.AddQuadCurveToPoint(59f, 589f, 110f, 640f); c.AddQuadCurveToPoint(161f, 691f, 229f, 720.5f); c.AddQuadCurveToPoint(297f, 750f, 375f, 750f); c.AddQuadCurveToPoint(453f, 750f, 521f, 720.5f); c.AddQuadCurveToPoint(589f, 691f, 640f, 640f); c.AddQuadCurveToPoint(691f, 589f, 720.5f, 521f); c.AddQuadCurveToPoint(750f, 453f, 750f, 375f); c.AddQuadCurveToPoint(750f, 297f, 720.5f, 229f); c.AddQuadCurveToPoint(691f, 161f, 640f, 110f); c.AddQuadCurveToPoint(589f, 59f, 521f, 29.5f); c.AddQuadCurveToPoint(453f, 0f, 375f, 0f); c.AddQuadCurveToPoint(297f, 0f, 229f, 29.5f); c.AddQuadCurveToPoint(161f, 59f, 110f, 110f); c.AddQuadCurveToPoint(59f, 161f, 29.5f, 229f); c.AddQuadCurveToPoint(0f, 297f, 0f, 375f); c.ClosePath(); c.MoveTo(0f, 375f); c.MoveTo(250f, 531f); c.AddLineToPoint(294f, 476f); c.AddQuadCurveToPoint(300f, 472f, 304f, 471f); c.AddQuadCurveToPoint(310f, 471f, 314f, 475f); c.AddQuadCurveToPoint(322f, 481f, 332f, 486f); c.AddQuadCurveToPoint(340f, 490f, 350.5f, 493.5f); c.AddQuadCurveToPoint(361f, 497f, 372f, 497f); c.AddQuadCurveToPoint(392f, 497f, 405f, 486.5f); c.AddQuadCurveToPoint(418f, 476f, 418f, 460f); c.AddQuadCurveToPoint(418f, 443f, 406.5f, 429.5f); c.AddQuadCurveToPoint(395f, 416f, 378f, 401f); c.AddQuadCurveToPoint(367f, 392f, 356f, 381.5f); c.AddQuadCurveToPoint(345f, 371f, 336f, 357.5f); c.AddQuadCurveToPoint(327f, 344f, 321f, 327.5f); c.AddQuadCurveToPoint(315f, 311f, 315f, 290f); c.AddLineToPoint(315f, 260f); c.AddQuadCurveToPoint(315f, 255f, 319.5f, 250.5f); c.AddQuadCurveToPoint(324f, 246f, 329f, 246f); c.AddLineToPoint(406f, 246f); c.AddQuadCurveToPoint(412f, 246f, 416f, 250.5f); c.AddQuadCurveToPoint(420f, 255f, 420f, 260f); c.AddLineToPoint(420f, 285f); c.AddQuadCurveToPoint(420f, 303f, 432f, 316f); c.AddQuadCurveToPoint(444f, 329f, 461f, 344f); c.AddQuadCurveToPoint(473f, 354f, 485f, 365.5f); c.AddQuadCurveToPoint(497f, 377f, 506.5f, 392f); c.AddQuadCurveToPoint(516f, 407f, 522.5f, 425f); c.AddQuadCurveToPoint(529f, 443f, 529f, 467f); c.AddQuadCurveToPoint(529f, 499f, 516f, 524f); c.AddQuadCurveToPoint(503f, 549f, 481.5f, 565.5f); c.AddQuadCurveToPoint(460f, 582f, 433f, 590.5f); c.AddQuadCurveToPoint(406f, 599f, 379f, 599f); c.AddQuadCurveToPoint(349f, 599f, 325.5f, 591.5f); c.AddQuadCurveToPoint(302f, 584f, 285.5f, 575f); c.AddQuadCurveToPoint(269f, 566f, 260.5f, 558f); c.AddQuadCurveToPoint(252f, 550f, 251f, 549f); c.AddQuadCurveToPoint(242f, 540f, 250f, 531f); c.ClosePath(); c.MoveTo(250f, 531f); c.MoveTo(315f, 132f); c.AddQuadCurveToPoint(315f, 127f, 319.5f, 122.5f); c.AddQuadCurveToPoint(324f, 118f, 329f, 118f); c.AddLineToPoint(406f, 118f); c.AddQuadCurveToPoint(412f, 118f, 416f, 122.5f); c.AddQuadCurveToPoint(420f, 127f, 420f, 132f); c.AddLineToPoint(420f, 206f); c.AddQuadCurveToPoint(420f, 220f, 406f, 220f); c.AddLineToPoint(329f, 220f); c.AddQuadCurveToPoint(324f, 220f, 319.5f, 216f); c.AddQuadCurveToPoint(315f, 212f, 315f, 206f); c.AddLineToPoint(315f, 132f); c.ClosePath(); c.MoveTo(315f, 132f); c.FillPath(); c.StrokePath(); }
public override void DrawInContext (CGContext context) { // Drawing with a white stroke color context.SetStrokeColor (1, 1, 1, 1); // And draw 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); // Add an ellipse circumscribed in the given rect to the current path, then stroke it context.AddEllipseInRect (new CGRect (30, 30, 60, 60)); context.StrokePath (); // Stroke ellipse convenience that is equivalent to AddEllipseInRect(); StrokePath(); context.StrokeEllipseInRect (new CGRect (30, 120, 60, 60)); // Fill rect convenience equivalent to AddEllipseInRect(); FillPath(); context.FillEllipseInRect (new CGRect (30, 210, 60, 60)); // Stroke 2 seperate arcs context.AddArc (150, 60, 30, 0, (float)Math.PI / 2, false); context.StrokePath (); context.AddArc (150, 60, 30, (float)(3 * Math.PI / 2), (float)Math.PI, true); context.StrokePath (); // Stroke 2 arcs together going opposite directions. context.AddArc (150, 150, 30, 0, (float)Math.PI / 2, false); context.AddArc (150, 150, 30, (float)(3 * Math.PI / 2), (float)Math.PI, true); context.StrokePath (); // Stroke 2 arcs together going the same direction.. context.AddArc (150, 240, 30, 0, (float)(Math.PI / 2), false); context.AddArc (150, 240, 30, (float)Math.PI, (float)(3 * Math.PI / 2), false); context.StrokePath (); // Stroke an arc using AddArcToPoint CGPoint[] p = { new CGPoint (210, 30), new CGPoint (210, 60), new CGPoint (240, 60), }; context.MoveTo (p [0].X, p [0].Y); context.AddArcToPoint (p [1].X, p [1].Y, p [2].X, p [2].Y, 30); context.StrokePath (); // Show the two segments that are used to determine the tangent lines to draw the arc. context.SetStrokeColor (1, 0, 0, 1); context.AddLines (p); context.StrokePath (); // As a bonus, we'll combine arcs to create a round rectangle! // Drawing with a white stroke color context.SetStrokeColor (1, 1, 1, 1); // If you were making this as a routine, you would probably accept a rectangle // that defines its bounds, and a radius reflecting the "rounded-ness" of the rectangle. var rrect = new CGRect (210, 90, 60, 60); var radius = 10; // NOTE: At this point you may want to verify that your radius is no more than half // the width and height of your rectangle, as this technique degenerates for those cases. // In order to draw a rounded rectangle, we will take advantage of the fact that // context.AddArcToPoint will draw straight lines past the start and end of the arc // in order to create the path from the current position and the destination position. // In order to create the 4 arcs correctly, we need to know the min, mid and max positions // on the x and y lengths of the given rectangle. nfloat minx = rrect.X, midx = rrect.X + rrect.Width / 2, maxx = rrect.X + rrect.Width; nfloat miny = rrect.Y, midy = rrect.Y + rrect.Height / 2, maxy = rrect.Y + rrect.Height; // Next, we will go around the rectangle in the order given by the figure below. // minx midx maxx // miny 2 3 4 // midy 1 9 5 // maxy 8 7 6 // Which gives us a coincident start and end point, which is incidental to this technique, but still doesn't // form a closed path, so we still need to close the path to connect the ends correctly. // Thus we start by moving to point 1, then adding arcs through each pair of points that follows. // You could use a similar tecgnique to create any shape with rounded corners. // Start at 1 context.MoveTo (minx, midy); // Add an arc through 2 to 3 context.AddArcToPoint (minx, miny, midx, miny, radius); // Add an arc through 4 to 5 context.AddArcToPoint (maxx, miny, maxx, midy, radius); // Add an arc through 6 to 7 context.AddArcToPoint (maxx, maxy, midx, maxy, radius); // Add an arc through 8 to 9 context.AddArcToPoint (minx, maxy, minx, midy, radius); // Close the path context.ClosePath (); // Fill & stroke the path context.DrawPath (CGPathDrawingMode.FillStroke); }
public void DrawPath(IEnumerable <PathOp> ops, Pen pen = null, Brush brush = null) { if (pen == null && brush == null) { return; } DrawElement(() => { var bb = new BoundingBoxBuilder(); foreach (var op in ops) { var mt = op as MoveTo; if (mt != null) { var p = mt.Point; context.MoveTo((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var lt = op as LineTo; if (lt != null) { var p = lt.Point; context.AddLineToPoint((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var at = op as ArcTo; if (at != null) { var p = at.Point; var pp = Conversions.GetPoint(context.GetPathCurrentPoint()); Point c1, c2; at.GetCircles(pp, out c1, out c2); context.AddLineToPoint((nfloat)p.X, (nfloat)p.Y); bb.Add(p); continue; } var ct = op as CurveTo; if (ct != null) { var p = ct.Point; var c1 = ct.Control1; var c2 = ct.Control2; context.AddCurveToPoint((nfloat)c1.X, (nfloat)c1.Y, (nfloat)c2.X, (nfloat)c2.Y, (nfloat)p.X, (nfloat)p.Y); bb.Add(p); bb.Add(c1); bb.Add(c2); continue; } var cp = op as ClosePath; if (cp != null) { context.ClosePath(); continue; } throw new NotSupportedException("Path Op " + op); } return(bb.BoundingBox); }, pen, brush); }
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); }
void FillRoundedRect (RectangleF rect, CGContext context) { float radius = 10.0f; context.BeginPath (); context.SetGrayFillColor (0.0f, this.Opacity); context.MoveTo (rect.GetMinX () + radius, rect.GetMinY ()); context.AddArc (rect.GetMaxX () - radius, rect.GetMinY () + radius, radius, (float)(3 * Math.PI / 2), 0f, false); context.AddArc (rect.GetMaxX () - radius, rect.GetMaxY () - radius, radius, 0, (float)(Math.PI / 2), false); context.AddArc (rect.GetMinX () + radius, rect.GetMaxY () - radius, radius, (float)(Math.PI / 2), (float)Math.PI, false); context.AddArc (rect.GetMinX () + radius, rect.GetMinY () + radius, radius, (float)Math.PI, (float)(3 * Math.PI / 2), false); context.ClosePath (); context.FillPath (); }
// rect changes depending on if the whole view is being redrawn, or just a section public override void Draw(CGRect rect) { Console.WriteLine("Draw() Called"); base.Draw(rect); using (CGContext context = UIGraphics.GetCurrentContext()) { UIColor.White.SetFill(); context.FillRect(rect); CGPoint startPoint = new CGPoint(); startPoint.X = 150; startPoint.Y = 200; Double radius = 120; List <UIColor> colors = new List <UIColor>(); colors.Add(UIColor.FromRGB(231, 218, 129)); colors.Add(UIColor.FromRGB(215, 164, 127)); colors.Add(UIColor.FromRGB(215, 129, 127)); colors.Add(UIColor.FromRGB(215, 127, 177)); colors.Add(UIColor.FromRGB(179, 127, 215)); colors.Add(UIColor.FromRGB(127, 135, 215)); colors.Add(UIColor.FromRGB(127, 177, 215)); colors.Add(UIColor.FromRGB(140, 193, 202)); colors.Add(UIColor.FromRGB(150, 222, 180)); colors.Add(UIColor.FromRGB(166, 215, 127)); int[] numbers = new int[10] { 100, 80, 100, 90, 120, 120, 85, 110, 120, 110 }; for (var i = 0; i < 10; i++) { UIColor color = colors[i]; color.SetStroke(); context.BeginPath(); CGPoint startArc = new CGPoint(); startArc.X = (nfloat)(startPoint.X + radius / 8 * Math.Cos(2 * Math.PI * i / 10 + 2 * Math.PI / 20 - Math.PI / 2)); startArc.Y = (nfloat)(startPoint.Y + radius / 8 * Math.Sin(2 * Math.PI * i / 10 + 2 * Math.PI / 20 - Math.PI / 2)); context.MoveTo(startArc.X, startArc.Y); context.AddArc(startArc.X, startArc.Y, (nfloat)numbers[i], (nfloat)(-Math.PI / 2 + 2 * Math.PI * i / 10), (nfloat)(-Math.PI / 2 + Math.PI * 2 * (i + 1) / 10), false); context.ClosePath(); color.SetFill(); context.DrawPath(CGPathDrawingMode.FillStroke); } UIColor alpha_color = UIColor.FromRGBA(255, 255, 255, 80); alpha_color.SetStroke(); context.BeginPath(); context.AddArc(startPoint.X, startPoint.Y, (nfloat)radius * 5 / 8, 0, (nfloat)(2 * Math.PI), false); context.ClosePath(); alpha_color.SetFill(); context.DrawPath(CGPathDrawingMode.FillStroke); UIColor white_color = UIColor.FromRGBA(255, 255, 255, 255); white_color.SetStroke(); context.BeginPath(); context.AddArc(startPoint.X, startPoint.Y, (nfloat)radius * 3 / 8, 0, (nfloat)(2 * Math.PI), false); context.ClosePath(); white_color.SetFill(); context.DrawPath(CGPathDrawingMode.FillStroke); for (var i = 0; i < 10; i++) { CGPoint icon_center = new CGPoint(); icon_center.X = (nfloat)(startPoint.X + radius / 2 * Math.Cos(2 * Math.PI * i / 10 + 2 * Math.PI / 20 - Math.PI / 2)); icon_center.Y = (nfloat)(startPoint.Y + radius / 2 * Math.Sin(2 * Math.PI * i / 10 + 2 * Math.PI / 20 - Math.PI / 2)); String filename = (i + 1).ToString() + ".png"; CGImage image = UIImage.FromFile(filename).CGImage; nint icon_width = image.Width * 2 / 3; nint icon_height = image.Height * 2 / 3; CGRect icon_rect = new CGRect(icon_center.X - icon_width / 2, icon_center.Y - icon_height / 2, icon_width, icon_height); context.DrawImage(icon_rect, image); } int sum = 0; for (var i = 0; i < 10; i++) { sum += numbers[i]; } int result = sum / 12; UIColor ring_color = UIColor.FromRGB(234, 235, 236); ring_color.SetStroke(); context.BeginPath(); context.AddArc(startPoint.X, startPoint.Y, (nfloat)radius * 5 / 16, 0, (nfloat)(2 * Math.PI), false); context.ClosePath(); context.SetLineWidth(5); context.DrawPath(CGPathDrawingMode.Stroke); UIColor result_color = UIColor.FromRGB(172, 202, 78); result_color.SetStroke(); context.BeginPath(); context.AddArc(startPoint.X, startPoint.Y, (nfloat)radius * 5 / 16, (nfloat)(-Math.PI / 2), (nfloat)(-Math.PI / 2 + result * 2 * Math.PI / 100), false); context.SetLineWidth(5); context.DrawPath(CGPathDrawingMode.Stroke); UIColor.Black.SetStroke(); CGPoint fontPoint = new CGPoint(); context.ScaleCTM(1, -1); fontPoint.X = startPoint.X - 17; fontPoint.Y = -startPoint.Y - 12; context.SetLineWidth(1); context.TextPosition = fontPoint; context.SelectFont("Helvetica", 32, CGTextEncoding.MacRoman); UIColor.Black.SetFill(); context.SetTextDrawingMode(CGTextDrawingMode.FillStroke); context.ShowText(result.ToString()); //// draw a rectangle using stroke rect //context.StrokeRect(new CGRect(10, 10, 200, 100)); //// draw a rectangle using a path //context.BeginPath(); //context.MoveTo(220, 10); //context.AddLineToPoint(420, 10); //context.AddLineToPoint(420, 110); //context.AddLineToPoint(220, 110); //context.ClosePath(); //UIColor.DarkGray.SetFill(); //context.DrawPath(CGPathDrawingMode.FillStroke); //// draw a rectangle using a path //CGPath rectPath = new CGPath(); //rectPath.AddRect(new CGRect(new CGPoint(430, 10), new CGSize(200, 100))); //context.AddPath(rectPath); //context.DrawPath(CGPathDrawingMode.Stroke); } }