Added Oval and Path. Currently Path only have move_to and line_to commands.

This commit is contained in:
Creeper Lv
2026-01-11 02:15:55 +11:00
parent b032249942
commit 609e51d375
8 changed files with 225 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
using SkiaSharp;
namespace Progrart.Core.Graphics
{
public class PathCmd
{
public virtual void ApplyCommand(RenderContext context, SKPath path) { }
}
public class LineToCmd(float x, float y) : PathCmd
{
public readonly float x = x;
public readonly float y = y;
public override void ApplyCommand(RenderContext context, SKPath path)
{
base.ApplyCommand(context, path);
var pos = context.TranslatePoint(x, y);
path.LineTo(pos);
}
}
public class MoveToCmd(float x, float y) : PathCmd
{
public readonly float x = x;
public readonly float y = y;
public override void ApplyCommand(RenderContext context, SKPath path)
{
base.ApplyCommand(context, path);
var pos = context.TranslatePoint(x, y);
path.MoveTo(pos);
}
}
}