Exemple #1
0
        private void SKElement_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
        {
            ICanvas canvas = new SkiaCanvas()
            {
                Canvas = e.Surface.Canvas
            };

            //canvas.FillColor = Colors.Transparent;
            //canvas.FillColor = Colors.White.WithAlpha(0.9f);
            //canvas.FillRectangle(0, 0, (float)DrawSurface.ActualWidth, (float)DrawSurface.ActualHeight);


            //canvas.StrokeColor = Colors.Red.WithAlpha(.5f);
            canvas.StrokeColor = Colors.Red;
            canvas.StrokeSize  = 2;
            var path = new PathF();

            if (_points.Count > 0)
            {
                path.MoveTo(_points[0].X, _points[0].Y);
                for (int i = 1; i < _points.Count; i++)
                {
                    path.LineTo(_points[i].X, _points[i].Y);
                }
                //path.Close();
                canvas.DrawPath(path);
            }
        }
Exemple #2
0
        private void SKElement_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
        {
            ICanvas canvas = new SkiaCanvas()
            {
                Canvas = e.Surface.Canvas
            };

            canvas.StrokeColor = Colors.Red;
            canvas.StrokeSize  = 2;
            //draw many points
            var path = new PathF();

            if (_points.Count > 0)
            {
                path.MoveTo(_points[0].X, _points[0].Y);
                for (int i = 1; i < _points.Count; i++)
                {
                    path.LineTo(_points[i].X, _points[i].Y);
                }
                canvas.DrawPath(path);
            }
        }