private void DrawTimer(SKCanvas canvas, SKImageInfo info) { canvas.Clear(); canvas.DrawPaint(new SKPaint { Color = new SKColor(96, 96, 96) }); SKPoint center = new SKPoint(info.Width / 2 - 15, info.Height / 2); float radius = Math.Min(info.Width / 2, info.Height / 2) - 10; SKRect rect = new SKRect(center.X - radius, center.Y - radius, center.X + radius, center.Y + radius); var surroundCircle = new YCircle(center, radius + 2, new SKColor(48, 48, 48), 4, SKPaintStyle.Stroke); surroundCircle.Draw(canvas); var backgroundCircle = new YCircle(center, radius, new SKColor(80, 80, 80), 1, SKPaintStyle.Fill); backgroundCircle.Draw(canvas); float startAngle = 270; var path = new YPath(new SKPath(), new SKColor(245, 222, 179), 5); path.DrawingPath.MoveTo(center); path.Paint.Style = SKPaintStyle.Fill; path.DrawingPath.ArcTo(rect, startAngle, _sweepAngle, false); path.DrawingPath.Close(); path.Draw(canvas); }
private void skElement_MouseDown(object sender, MouseButtonEventArgs e) { _canRedo = false; _redoStack = new Stack <YFigure>(); _isMouseDown = true; var pixelPosition = e.GetPosition(sender as Canvas); var x = (float)(pixelPosition.X * DpiScale.DpiScaleX - 350 * DpiScale.DpiScaleX); var y = (float)(pixelPosition.Y * DpiScale.DpiScaleY - 150 * DpiScale.DpiScaleY); _skPoint = new SKPoint(x, y); var color = GetCurrentColor(); if (_state == State.fill) { _yFiller = new YFiller(_skPoint, color); } else { if (_state == State.rubber) { color = new SKColor(255, 255, 255); } _history.Push(new YPoint(_skPoint, color, _strokeWidth)); _yPath = new YPath(new SKPath(), color, _strokeWidth); _yPath.DrawingPath.MoveTo(_skPoint); } skElement.InvalidateVisual(); }