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:
Родитель
38f6a14d13
Коммит
7fcf55c64f
|
@ -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(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче