GraphicsTester: add scaled path tests

This commit adds a DrawPathsScaled AbstractScenario (complimenting the existing DrawLinesScaled scenario) to demonstrate PathF scaling functionality #302
This commit is contained in:
Scott W Harden 2022-02-05 11:37:08 -05:00
Родитель 38f6a14d13
Коммит 7fcf55c64f
2 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,39 @@
using Microsoft.Maui.Graphics;
using System;
using System.Collections.Generic;
using System.Text;
namespace GraphicsTester.Scenarios
{
internal class DrawPathsScaled : AbstractScenario
{
public DrawPathsScaled() : base(720, 1024)
{
}
public override void Draw(ICanvas canvas)
{
DrawScaledPaths(canvas);
}
private void DrawScaledPaths(ICanvas canvas)
{
PathF path = new(100, 100);
path.AddArc(100, 100, 200, 200, 0, 180, true);
path.LineTo(150, 100);
path.Close();
canvas.StrokeColor = Colors.Black;
canvas.DrawPath(path);
canvas.StrokeColor = Colors.Magenta;
canvas.DrawPath(path.AsScaledPath(1.5f));
canvas.StrokeColor = Colors.Green;
canvas.DrawPath(path.AsScaledPath(0.5f, 1f));
canvas.StrokeColor = Colors.Orange;
canvas.DrawPath(path.AsScaledPath(1f, 0.5f));
}
}
}

Просмотреть файл

@ -24,6 +24,7 @@ namespace GraphicsTester.Scenarios
new ArcScenario1(true),
new ArcScenario2(),
new DrawPaths(),
new DrawPathsScaled(),
new DrawFlattenedPaths(),
new DrawImages(),
new DrawTextAtPoint(),