Save All is now working.

Size is now a relative value in Line.
This commit is contained in:
Creeper Lv
2026-01-01 23:02:12 +11:00
parent 2eb59564b4
commit c1e4c71985
12 changed files with 73 additions and 31 deletions

View File

@@ -77,7 +77,7 @@ namespace Progrart.Core.Graphics
new SKPaint()
{
ColorF = Color,
StrokeWidth = Size,
StrokeWidth = context.TranslateSize(Size),
Shader = shader
}
);

View File

@@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Progrart.Core.Graphics
{
public class Rectangle : BaseElement
public class Rectangle : BaseElement
{
float StrokeWidth;
@@ -78,7 +78,7 @@ namespace Progrart.Core.Graphics
new SKPaint()
{
ColorF = Color,
StrokeWidth = StrokeWidth,
StrokeWidth = context.TranslateSize(StrokeWidth),
Shader = shader
}
);

View File

@@ -82,7 +82,11 @@ namespace Progrart.Core.JSExecution
{
height = (float)(js_height.AsNumber());
}
RenderContext renderContext = new RenderContext((int)(width * Scale), (int)(width * Scale));
RenderContext renderContext = new RenderContext((int)(width * Scale), (int)(width * Scale))
{
LogicalW = width,
LogicalH = height
};
ImageRoot imageRoot = new ImageRoot();
var img = engine.Engine.Call("main");

View File

@@ -8,6 +8,8 @@ namespace Progrart.Core
public PrimitiveDrawingCore DrawingCore { get; }
public SKCanvas canvas { get => DrawingCore.canvas; }
public float LogicalW;
public float LogicalH;
public RenderContext(PrimitiveDrawingCore core)
{
this.DrawingCore = core;
@@ -20,6 +22,10 @@ namespace Progrart.Core
{
return TranslatePoint(point.X, point.Y);
}
public float TranslateSize(float s)
{
return (float)(s * Math.Sqrt(DrawingCore.Width * DrawingCore.Width + DrawingCore.Height * DrawingCore.Height)/ Math.Sqrt(LogicalH * LogicalH + LogicalW * LogicalW));
}
public RenderContext(int W, int H)
{
DrawingCore = new PrimitiveDrawingCore(W, H);