Exemplo n.º 1
0
 public static void RoundRect(CanvasContext2D ctx, int x, int y, int width, int height, int radius = 5, bool fill = true, bool stroke = false)
 {
     ctx.Save();
     ctx.LineWidth = 3;
     ctx.BeginPath();
     ctx.MoveTo(x + radius, y);
     ctx.LineTo(x + width, y);
     //ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
     ctx.LineTo(x + width, y + height);
     // ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
     ctx.LineTo(x, y + height);
     // ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
     ctx.LineTo(x, y + radius);
     ctx.QuadraticCurveTo(x, y, x + radius, y);
     ctx.ClosePath();
     if (stroke)
         ctx.Stroke();
     if (fill)
         ctx.Fill();
     ctx.Restore();
 }
Exemplo n.º 2
0
 private void drawCircle(CanvasContext2D context, object radgrad, double size)
 {
     context.FillStyle = radgrad;
     context.BeginPath();
     context.Arc(0, 0, size / 2, 0, Math.PI * 2, true);
     context.ClosePath();
     context.Fill();
 }