private void DrawCircle(SKCanvas canvas, CoreCircle circle, float strokewidth, SKColor color) { canvas.DrawCircle(circle.Center, circle.Radius, new SKPaint() { StrokeWidth = strokewidth, Color = color, IsStroke = true }); }
public CoreCircleProgressDrawer(SKCanvasView canvas, CoreCircle circle, Func <float> progress, float strokeWidth, SKColor progressColor, SKColor foregroundColor) { canvas.PaintSurface += (sender, args) => { circle.CalculateCenter(args.Info); args.Surface.Canvas.Clear(); DrawCircle(args.Surface.Canvas, circle, strokeWidth, foregroundColor); DrawArc(args.Surface.Canvas, circle, progress, strokeWidth, progressColor); }; }
private void DrawArc(SKCanvas canvas, CoreCircle circle, Func <float> progress, float strokewidth, SKColor color) { var angle = progress.Invoke() * 3.6f; canvas.DrawArc(circle.Rect, 180, angle, false, new SKPaint() { StrokeWidth = strokewidth, Color = color, IsStroke = true, StrokeCap = SKStrokeCap.Round }); }
public CoreRadialProgressbar(float radius, SKColor backgroundColor, SKColor ringColor, float strokeWidth = 5) { var circle = new CoreCircle(radius, (info) => new SKPoint((float)info.Width / 2, (float)info.Height / 2)); _ProgressDrawer = new CoreRadialProgressDrawer(this, circle, () => (float)(Progress / 2), strokeWidth, ringColor, backgroundColor); }