From 20dfba6e7ee382b40885000a76feead263f0cae4 Mon Sep 17 00:00:00 2001 From: routersys Date: Thu, 2 Jul 2026 12:53:13 +0900 Subject: [PATCH] =?UTF-8?q?DrawCompositor=E3=81=AE=E5=A4=89=E6=8F=9B?= =?UTF-8?q?=E8=A1=8C=E5=88=97=E6=A7=8B=E7=AF=89=E3=82=92DrawTransform?= =?UTF-8?q?=E3=81=B8=E9=9B=86=E7=B4=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/DrawCompositor.cs | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/LuaScript/DrawCompositor.cs b/LuaScript/DrawCompositor.cs index d32427c..49cde06 100644 --- a/LuaScript/DrawCompositor.cs +++ b/LuaScript/DrawCompositor.cs @@ -79,32 +79,16 @@ namespace LuaScript for (int i = 0; i < commands.Count; i++) { var cmd = commands[i]; + if (!DrawTransform.TryResolve(cmd, width, height, out var transform)) + continue; + var interpolation = cmd.Antialias != 0d ? BitmapInterpolationMode.Linear : BitmapInterpolationMode.NearestNeighbor; var blend = BlendModeMap.Resolve(cmd.Blend); - if (cmd.Poly is { } poly) - { - if (!DrawPolyMath.TrySolveAffine(poly, out var affine)) - continue; - rt.Transform = affine * toTarget; - DrawSource(rt, (float)Math.Clamp(poly[20], 0d, 1d), interpolation, blend); - continue; - } - - double aspect = Math.Clamp(cmd.Aspect, -1d, 1d); - float zx = (float)(cmd.Zoom * (1d + aspect)); - float zy = (float)(cmd.Zoom * (1d - aspect)); - float opacity = (float)Math.Clamp(cmd.Alpha, 0d, 1d); - - var matrix = - Matrix3x2.CreateTranslation(-width * 0.5f, -height * 0.5f) * - Matrix3x2.CreateScale(zx, zy) * - Matrix3x2.CreateTranslation((float)(cmd.Ox - originX), (float)(cmd.Oy - originY)); - - rt.Transform = matrix; - DrawSource(rt, opacity, interpolation, blend); + rt.Transform = transform * toTarget; + DrawSource(rt, (float)Math.Clamp(cmd.Alpha, 0d, 1d), interpolation, blend); } rt.Transform = Matrix3x2.Identity; dc.EndDraw();