Exemple #1
0
        public async ValueTask DrawLine(Vector2 from, Vector2 to, Color color)
        {
            var f = from + _origin.ToVector2();
            var t = to + _origin.ToVector2();

            await _canvas2DContext.BeginPathAsync();

            await _canvas2DContext.SetStrokeStyleAsync($"rgb({color.R},{color.G},{color.B})");

            await _canvas2DContext.SetLineWidthAsync(3);

            await _canvas2DContext.SetLineCapAsync(LineCap.Round);

            await _canvas2DContext.MoveToAsync(f.X, f.Y);

            await _canvas2DContext.LineToAsync(t.X, t.Y);

            await _canvas2DContext.StrokeAsync();
        }