From d607e4ec4992ab3c599d20efef5c341569325d04 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:38:32 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=E3=83=98=E3=83=83=E3=83=80=E3=83=BC?= =?UTF-8?q?=E6=A4=9C=E8=A8=BC=E4=BB=98=E3=81=8Dobj.load(movie)=E3=82=92?= =?UTF-8?q?=E4=B8=A1=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E3=81=A7=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript.Tests/NativeWorkerRoundTripTests.cs | 85 +++++-- LuaScript/Engine/LuaJitWorker.cs | 34 ++- LuaScript/Engine/NativeProtocol.cs | 1 + LuaScript/LuaScript.csproj | 4 + LuaScript/LuaScriptEffectProcessor.cs | 9 + LuaScript/LuaScriptEngine.cs | 16 ++ LuaScript/MovieDecoder.cs | 213 ++++++++++++++++++ native/worker.lua | 17 ++ 8 files changed, 355 insertions(+), 24 deletions(-) create mode 100644 LuaScript/MovieDecoder.cs diff --git a/LuaScript.Tests/NativeWorkerRoundTripTests.cs b/LuaScript.Tests/NativeWorkerRoundTripTests.cs index 4450d49..11337bf 100644 --- a/LuaScript.Tests/NativeWorkerRoundTripTests.cs +++ b/LuaScript.Tests/NativeWorkerRoundTripTests.cs @@ -12,6 +12,7 @@ namespace LuaScript.Tests private static readonly Func NoLoadFigure = (_, _, _, _, _) => ([], 1, 1); private static readonly Func NoLoadText = (_, _, _, _, _, _) => ([], 1, 1); private static readonly Func NoLoadImage = _ => ([], 1, 1); + private static readonly Func NoLoadMovie = (_, _) => ([], 1, 1); private static readonly Action>> NoAddEffect = (_, _) => { }; private static readonly Action NoAddDraw = _ => { }; @@ -39,7 +40,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.rz = obj.time * 90\nobj.alpha = 128", - fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.False(dirty); @@ -74,7 +75,7 @@ namespace LuaScript.Tests "local gray = r*0.299 + g*0.587 + b*0.114 " + "obj.setpixel(x,y,gray,gray,gray,a) end end"; - bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.True(dirty); @@ -109,7 +110,7 @@ namespace LuaScript.Tests "local gray=r*0.299+g*0.587+b*0.114 " + "pd:set(base+1,gray) pd:set(base+2,gray) pd:set(base+3,gray) end end"; - bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.True(dirty); @@ -145,7 +146,7 @@ namespace LuaScript.Tests for (int k = 1; k <= 5; k++) { var fields = Fields(2, 2, k); - bool ok = _worker.Execute("obj.x = obj.time * 10", fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute("obj.x = obj.time * 10", fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.Equal(k * 10d, fields[NativeProtocol.X]); } @@ -160,12 +161,12 @@ namespace LuaScript.Tests var fields = Fields(2, 2, 0d); bool timedOut = _worker.Execute( - "local x=0 while true do x=x+1 end", fields, pixels, 2, 2, 1500, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + "local x=0 while true do x=x+1 end", fields, pixels, 2, 2, 1500, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.False(timedOut); Assert.Contains("timed out", error); var fields2 = Fields(2, 2, 3d); - bool ok = _worker.Execute("obj.x = obj.time", fields2, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); + bool ok = _worker.Execute("obj.x = obj.time", fields2, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); Assert.True(ok, error); Assert.Equal(3d, fields2[NativeProtocol.X]); } @@ -187,7 +188,7 @@ namespace LuaScript.Tests "obj.zoom = o.zoom obj.rz = o.rz obj.alpha = o.alpha " + "obj.sx = o.sy obj.rzr = o.rzr"; - bool ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.Equal(12d, fields[NativeProtocol.X]); @@ -219,13 +220,13 @@ namespace LuaScript.Tests "local b = obj.getobject(\"a\") " + "obj.x = a.x + b.x"; - bool ok = _worker.Execute(script, Fields(2, 2, 0d), pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, Fields(2, 2, 0d), pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.Equal(1, calls); var fields = Fields(2, 2, 0d); x = 20d; - ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); + ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, resolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); Assert.True(ok, error); Assert.Equal(2, calls); Assert.Equal(40d, fields[NativeProtocol.X]); @@ -242,7 +243,7 @@ namespace LuaScript.Tests const string script = "local o = obj.getobject(\"missing\") obj.x = o == nil and 1 or 0"; - bool ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.Equal(1d, fields[NativeProtocol.X]); @@ -260,7 +261,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.draw() obj.draw(10, 20, 30, 2, 0.5, 0.25)", - fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, addDraw, + fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, addDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -281,7 +282,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.drawpoly(0,0,0, 10,0,0, 10,10,0, 0,10,0)", - fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, addDraw, + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, addDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -303,7 +304,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.drawpoly(0,0,0, 8,0,0, 8,8,0, 0,8,0, 1,1, 3,1, 3,3, 1,3, 0.5)", - fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, addDraw, + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, addDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -324,7 +325,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.setoption('antialias', 0) obj.x = obj.getoption('antialias') obj.y = obj.getoption('unset')", - fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, + fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -343,7 +344,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.draw() obj.setoption('antialias', 0) obj.draw()", - Fields(2, 2, 0d), pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, addDraw, + Fields(2, 2, 0d), pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, addDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -380,7 +381,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.setfont('Meiryo', 40, 3, 0x112233) obj.load('text', 'Hi')", - fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, loadText, NoLoadImage, NoAddEffect, NoAddDraw, + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, loadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out bool bufferReplaced, out byte[]? newPixels, out int rw, out int rh, out string? error); Assert.True(ok, error); @@ -420,7 +421,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.load('image', 'C:/sample.png')", - fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, loadImage, NoAddEffect, NoAddDraw, + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, loadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out bool bufferReplaced, out byte[]? newPixels, out int rw, out int rh, out string? error); Assert.True(ok, error); @@ -433,6 +434,44 @@ namespace LuaScript.Tests Assert.Equal(decoded, newPixels!.AsSpan(0, decoded.Length).ToArray()); } + [Fact] + public void LoadMovie_RoundTripsPathAndTime() + { + Assert.True(LuaJitWorker.IsAvailable(NativeDir), "native/luajit.exe must be present"); + + const int mw = 2, mh = 2; + var frame = new byte[mw * mh * 4]; + for (int i = 0; i < frame.Length; i++) + frame[i] = (byte)((i * 31 + 3) & 0xFF); + + string? capturedPath = null; + double capturedTime = -1; + Func loadMovie = (path, time) => + { + capturedPath = path; + capturedTime = time; + return (frame, mw, mh); + }; + + var pixels = new byte[4 * 4 * 4]; + var fields = Fields(4, 4, 0d); + + bool ok = _worker.Execute( + "obj.load('movie', 'C:/clip.mp4', 1.5)", + fields, pixels, 4, 4, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, loadMovie, NoAddEffect, NoAddDraw, + out bool dirty, out bool bufferReplaced, out byte[]? newPixels, out int rw, out int rh, out string? error); + + Assert.True(ok, error); + Assert.Equal("C:/clip.mp4", capturedPath); + Assert.Equal(1.5d, capturedTime); + Assert.True(dirty); + Assert.True(bufferReplaced); + Assert.Equal(mw, rw); + Assert.Equal(mh, rh); + Assert.NotNull(newPixels); + Assert.Equal(frame, newPixels!.AsSpan(0, frame.Length).ToArray()); + } + [Fact] public void GetValue_ReturnsObjFields() { @@ -444,7 +483,7 @@ namespace LuaScript.Tests bool ok = _worker.Execute( "obj.x = obj.getvalue('track0') obj.y = obj.getvalue('alpha') obj.z = obj.getvalue('unknown')", - fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, + fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); @@ -471,7 +510,7 @@ namespace LuaScript.Tests "for y=0,obj.h-1 do for x=0,obj.w-1 do obj.setpixel(x,y,0,0,0,0) end end " + "obj.copybuffer('obj','tmp')"; - bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute(script, fields, pixels, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out string? error); Assert.True(ok, error); Assert.True(dirty); @@ -490,11 +529,11 @@ namespace LuaScript.Tests stored[3] = 255; stored[7] = 255; stored[11] = 255; stored[15] = 255; var save = (byte[])stored.Clone(); - bool ok = _worker.Execute("obj.copybuffer('cache:foo','obj')", Fields(w, h, 0d), save, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute("obj.copybuffer('cache:foo','obj')", Fields(w, h, 0d), save, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.True(ok, error); var blank = new byte[w * h * 4]; - ok = _worker.Execute("obj.copybuffer('obj','cache:foo')", Fields(w, h, 0d), blank, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out error); + ok = _worker.Execute("obj.copybuffer('obj','cache:foo')", Fields(w, h, 0d), blank, w, h, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out bool dirty, out _, out _, out _, out _, out error); Assert.True(ok, error); Assert.True(dirty); Assert.Equal(stored, blank); @@ -508,12 +547,12 @@ namespace LuaScript.Tests var pixels = new byte[16]; var fields = Fields(2, 2, 0d); - bool ok = _worker.Execute("obj.x = missing.value", fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); + bool ok = _worker.Execute("obj.x = missing.value", fields, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out string? error); Assert.False(ok); Assert.False(string.IsNullOrEmpty(error)); var fields2 = Fields(2, 2, 7d); - bool ok2 = _worker.Execute("obj.x = obj.time", fields2, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); + bool ok2 = _worker.Execute("obj.x = obj.time", fields2, pixels, 2, 2, 5000, NoResolver, NoLoadFigure, NoLoadText, NoLoadImage, NoLoadMovie, NoAddEffect, NoAddDraw, out _, out _, out _, out _, out _, out error); Assert.True(ok2, error); Assert.Equal(7d, fields2[NativeProtocol.X]); } diff --git a/LuaScript/Engine/LuaJitWorker.cs b/LuaScript/Engine/LuaJitWorker.cs index bb009c6..1f54a8b 100644 --- a/LuaScript/Engine/LuaJitWorker.cs +++ b/LuaScript/Engine/LuaJitWorker.cs @@ -51,6 +51,7 @@ namespace LuaScript.Engine Func loadFigure, Func loadText, Func loadImage, + Func loadMovie, Action>> addEffect, Action addDraw, out bool pixelsDirty, @@ -106,7 +107,7 @@ namespace LuaScript.Engine if (status != NativeProtocol.StatusCallback) break; - DispatchCallback(view, resolveObject, loadFigure, loadText, loadImage, addEffect, addDraw); + DispatchCallback(view, resolveObject, loadFigure, loadText, loadImage, loadMovie, addEffect, addDraw); _workEvent.Set(); } @@ -152,6 +153,7 @@ namespace LuaScript.Engine Func loadFigure, Func loadText, Func loadImage, + Func loadMovie, Action>> addEffect, Action addDraw) { @@ -170,6 +172,9 @@ namespace LuaScript.Engine case NativeProtocol.CbKindLoadImage: ResolveLoadImageCallback(view, loadImage); break; + case NativeProtocol.CbKindLoadMovie: + ResolveLoadMovieCallback(view, loadMovie); + break; case NativeProtocol.CbKindEffect: ResolveEffectCallback(view, addEffect); break; @@ -333,6 +338,33 @@ namespace LuaScript.Engine view.Write(NativeProtocol.OffCallbackFound, 1); } + private void ResolveLoadMovieCallback( + MemoryMappedViewAccessor view, + Func loadMovie) + { + int tagLen = Math.Clamp(view.ReadInt32(NativeProtocol.OffCallbackTagLen), 0, NativeProtocol.CallbackTagMax); + view.ReadArray(NativeProtocol.CallbackTagOffset, _callbackTag, 0, tagLen); + string path = Encoding.UTF8.GetString(_callbackTag, 0, tagLen); + double time = view.ReadDouble(NativeProtocol.CallbackResultOffset); + + (byte[] buffer, int w, int h) result; + try { result = loadMovie(path, time); } + catch { result = (new byte[4], 1, 1); } + + int pixelSize = result.w * result.h * 4; + long capacity = view.Capacity - NativeProtocol.PixelOffset; + if (pixelSize > capacity) + { + result = (new byte[4], 1, 1); + pixelSize = 4; + } + + view.Write(NativeProtocol.OffLoadResultWidth, result.w); + view.Write(NativeProtocol.OffLoadResultHeight, result.h); + view.WriteArray(NativeProtocol.PixelOffset, result.buffer, 0, pixelSize); + view.Write(NativeProtocol.OffCallbackFound, 1); + } + private void ResolveEffectCallback(MemoryMappedViewAccessor view, Action>> addEffect) { int tagLen = Math.Clamp(view.ReadInt32(NativeProtocol.OffCallbackTagLen), 0, NativeProtocol.CallbackTagMax); diff --git a/LuaScript/Engine/NativeProtocol.cs b/LuaScript/Engine/NativeProtocol.cs index 02a690d..ea042f0 100644 --- a/LuaScript/Engine/NativeProtocol.cs +++ b/LuaScript/Engine/NativeProtocol.cs @@ -50,6 +50,7 @@ namespace LuaScript.Engine public const int CbKindDrawPoly = 4; public const int CbKindLoadText = 5; public const int CbKindLoadImage = 6; + public const int CbKindLoadMovie = 7; public const int CbExist = 0; public const int CbX = 1; diff --git a/LuaScript/LuaScript.csproj b/LuaScript/LuaScript.csproj index 751dd76..2d45e7c 100644 --- a/LuaScript/LuaScript.csproj +++ b/LuaScript/LuaScript.csproj @@ -67,6 +67,10 @@ $(YMM4DirPath)Vortice.Mathematics.dll false + + $(YMM4DirPath)Vortice.MediaFoundation.dll + false + $(YMM4DirPath)YukkuriMovieMaker.dll false diff --git a/LuaScript/LuaScriptEffectProcessor.cs b/LuaScript/LuaScriptEffectProcessor.cs index 627b59a..e7cfb31 100644 --- a/LuaScript/LuaScriptEffectProcessor.cs +++ b/LuaScript/LuaScriptEffectProcessor.cs @@ -91,6 +91,7 @@ namespace LuaScript private DrawCompositor? _drawCompositor; private TextRenderer? _nativeTextRenderer; private ImageDecoder? _nativeImageDecoder; + private MovieDecoder? _nativeMovieDecoder; protected override ID2D1Image? CreateEffect(IGraphicsDevicesAndContext devices) { @@ -450,6 +451,7 @@ namespace LuaScript NativeLoadFigure, NativeLoadText, NativeLoadImage, + NativeLoadMovie, (name, args) => ctx.AddEffect(new AviUtlEffectRequest(name, args)), ctx.AddDraw, out bool dirty, out bool bufferReplaced, out byte[]? newPixels, @@ -516,6 +518,13 @@ namespace LuaScript return (buffer, w, h); } + private (byte[] buffer, int w, int h) NativeLoadMovie(string path, double time) + { + _nativeMovieDecoder ??= new MovieDecoder(); + var buffer = _nativeMovieDecoder.Decode(path, time, out int w, out int h); + return (buffer, w, h); + } + private static (byte[] buffer, int w, int h) NativeLoadFigure(string name, int color, double size, double lineWidth, double aspect) { aspect = Math.Clamp(aspect, -1d, 1d); diff --git a/LuaScript/LuaScriptEngine.cs b/LuaScript/LuaScriptEngine.cs index ac3296b..2617f6d 100644 --- a/LuaScript/LuaScriptEngine.cs +++ b/LuaScript/LuaScriptEngine.cs @@ -58,6 +58,7 @@ namespace LuaScript private TextRenderer? _textRenderer; private ImageDecoder? _imageDecoder; + private MovieDecoder? _movieDecoder; private string _fontFamily = string.Empty; private double _fontSize = 34d; private bool _fontBold; @@ -511,6 +512,11 @@ namespace LuaScript case "image" when args.Count > 1 && args[1].Type == DataType.String: LoadImage(args[1].String); break; + case "movie" when args.Count > 1 && args[1].Type == DataType.String: + LoadMovie( + args[1].String, + args.Count > 2 ? args[2].CastToNumber() ?? _activeContext.Time : _activeContext.Time); + break; } return DynValue.Void; }); @@ -700,6 +706,14 @@ namespace LuaScript RefreshObjDimensions(); } + private void LoadMovie(string path, double time) + { + _movieDecoder ??= new MovieDecoder(); + var buffer = _movieDecoder.Decode(path, time, out int w, out int h); + _activeContext!.ReplaceBuffer(buffer, w, h); + RefreshObjDimensions(); + } + private void RefreshObjDimensions() { int w = _activeContext!.ImageWidth; @@ -770,6 +784,7 @@ namespace LuaScript _thread.Join(); _textRenderer?.Dispose(); _imageDecoder?.Dispose(); + _movieDecoder?.Dispose(); _cts.Cancel(); _cts.Dispose(); _workSignal.Dispose(); @@ -785,6 +800,7 @@ namespace LuaScript _thread.Join(); _textRenderer?.Dispose(); _imageDecoder?.Dispose(); + _movieDecoder?.Dispose(); _cts.Dispose(); _workSignal.Dispose(); _doneSignal.Dispose(); diff --git a/LuaScript/MovieDecoder.cs b/LuaScript/MovieDecoder.cs new file mode 100644 index 0000000..a7c3fec --- /dev/null +++ b/LuaScript/MovieDecoder.cs @@ -0,0 +1,213 @@ +using System; +using System.IO; +using SharpGen.Runtime.Win32; +using Vortice.MediaFoundation; + +namespace LuaScript +{ + internal sealed class MovieDecoder : IDisposable + { + private const int MaxDimension = 8192; + private const int FirstVideoStream = -4; + private const int AllStreams = -2; + private const int EndOfStreamFlag = 0x2; + + private bool _mfStarted; + private string? _path; + private IMFSourceReader? _reader; + private int _width; + private int _height; + private int _stride; + + public unsafe byte[] Decode(string path, double timeSeconds, out int width, out int height) + { + width = 1; + height = 1; + if (string.IsNullOrEmpty(path) || !IsSupportedVideo(path)) + return new byte[4]; + + try + { + EnsureReader(path); + if (_reader is null || _width <= 0 || _height <= 0) + return new byte[4]; + + SetPosition(_reader, (long)(Math.Max(0d, timeSeconds) * 10_000_000d)); + + using var sample = ReadVideoSample(_reader); + if (sample is null) + return new byte[4]; + + using var buffer = sample.ConvertToContiguousBuffer(); + buffer.Lock(out nint data, out _, out _); + try + { + int w = _width; + int h = _height; + int absStride = Math.Abs(_stride); + bool bottomUp = _stride < 0; + var result = new byte[w * h * 4]; + byte* src = (byte*)data; + fixed (byte* dst = result) + { + for (int y = 0; y < h; y++) + { + int sourceRow = bottomUp ? h - 1 - y : y; + byte* s = src + sourceRow * absStride; + byte* d = dst + y * w * 4; + for (int x = 0; x < w; x++) + { + d[0] = s[0]; + d[1] = s[1]; + d[2] = s[2]; + d[3] = 255; + s += 4; + d += 4; + } + } + } + width = w; + height = h; + return result; + } + finally + { + buffer.Unlock(); + } + } + catch + { + width = 1; + height = 1; + return new byte[4]; + } + } + + private void EnsureReader(string path) + { + if (_reader is not null && string.Equals(_path, path, StringComparison.Ordinal)) + return; + + DisposeReader(); + + if (!_mfStarted) + { + MediaFactory.MFStartup(false); + _mfStarted = true; + } + + using var attributes = MediaFactory.MFCreateAttributes(1); + attributes.Set(SourceReaderAttributeKeys.EnableAdvancedVideoProcessing, 1); + var reader = MediaFactory.MFCreateSourceReaderFromURL(path, attributes); + + reader.SetStreamSelection(AllStreams, false); + reader.SetStreamSelection(FirstVideoStream, true); + + using (var mediaType = MediaFactory.MFCreateMediaType()) + { + mediaType.Set(MediaTypeAttributeKeys.MajorType, MediaTypeGuids.Video); + mediaType.Set(MediaTypeAttributeKeys.Subtype, VideoFormatGuids.Rgb32); + reader.SetCurrentMediaType(FirstVideoStream, mediaType); + } + + using var current = reader.GetCurrentMediaType(FirstVideoStream); + var mediaAttributes = (IMFAttributes)current; + ulong frameSize = Convert.ToUInt64(mediaAttributes.Get(MediaTypeAttributeKeys.FrameSize)); + int w = (int)(frameSize >> 32); + int h = (int)(frameSize & 0xFFFFFFFF); + + int stride; + try { stride = Convert.ToInt32(mediaAttributes.Get(MediaTypeAttributeKeys.DefaultStride)); } + catch { stride = w * 4; } + if (stride == 0) + stride = w * 4; + + if (w <= 0 || h <= 0 || w > MaxDimension || h > MaxDimension) + { + reader.Dispose(); + return; + } + + _reader = reader; + _path = path; + _width = w; + _height = h; + _stride = stride; + } + + private static void SetPosition(IMFSourceReader reader, long ticks) + { + var variant = new Variant + { + Value = ticks, + ElementType = (VariantElementType)20, + }; + reader.SetCurrentPosition(Guid.Empty, variant); + } + + private static IMFSample? ReadVideoSample(IMFSourceReader reader) + { + for (int guard = 0; guard < 256; guard++) + { + reader.ReadSample(FirstVideoStream, 0, out _, out int flags, out _, out IMFSample? sample); + if (sample is not null) + return sample; + if ((flags & EndOfStreamFlag) != 0) + return null; + } + return null; + } + + private static bool IsSupportedVideo(string path) + { + try + { + if (!File.Exists(path)) + return false; + Span head = stackalloc byte[16]; + using var stream = File.OpenRead(path); + int read = stream.Read(head); + if (read < 12) + return false; + + if (head[4] == 0x66 && head[5] == 0x74 && head[6] == 0x79 && head[7] == 0x70) + return true; + if (head[0] == 0x1A && head[1] == 0x45 && head[2] == 0xDF && head[3] == 0xA3) + return true; + if (head[0] == 0x52 && head[1] == 0x49 && head[2] == 0x46 && head[3] == 0x46 && + head[8] == 0x41 && head[9] == 0x56 && head[10] == 0x49 && head[11] == 0x20) + return true; + if (head[0] == 0x46 && head[1] == 0x4C && head[2] == 0x56) + return true; + if (head[0] == 0x30 && head[1] == 0x26 && head[2] == 0xB2 && head[3] == 0x75) + return true; + return false; + } + catch + { + return false; + } + } + + private void DisposeReader() + { + _reader?.Dispose(); + _reader = null; + _path = null; + _width = 0; + _height = 0; + _stride = 0; + } + + public void Dispose() + { + DisposeReader(); + if (_mfStarted) + { + try { MediaFactory.MFShutdown(); } + catch { } + _mfStarted = false; + } + } + } +} diff --git a/native/worker.lua b/native/worker.lua index 6bc04a5..60638c9 100644 --- a/native/worker.lua +++ b/native/worker.lua @@ -65,6 +65,7 @@ local CB_KIND_DRAW = 3 local CB_KIND_DRAWPOLY = 4 local CB_KIND_LOADTEXT = 5 local CB_KIND_LOADIMAGE = 6 +local CB_KIND_LOADMOVIE = 7 assert(loadfile(shimPath))() @@ -253,6 +254,20 @@ local function loadImage(path) applyLoadResult() end +local function loadMovie(path, time) + local payload = tostring(path or "") + local len = #payload + if len > CB_TAG_MAX then len = CB_TAG_MAX end + ffi.copy(base + CB_TAG_OFFSET, payload, len) + i32[OFF_CB_TAGLEN] = len + i32[OFF_CB_KIND] = CB_KIND_LOADMOVIE + cbResult[0] = time or obj.time or 0 + i32[OFF_STATUS] = STATUS_CALLBACK + k32.SetEvent(doneEvent) + k32.WaitForSingleObject(workEvent, INFINITE) + applyLoadResult() +end + function obj.load(kind, ...) if kind == "figure" then loadFigure(...) @@ -260,6 +275,8 @@ function obj.load(kind, ...) loadText(...) elseif kind == "image" then loadImage(...) + elseif kind == "movie" then + loadMovie(...) end end From 0799785cada57b007c7bf01b9ce7e312b616be0b Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:43:02 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=82=92AviUtl?= =?UTF-8?q?=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.ja-jp.txt | 116 ++++++++++++++++++++++------- 1 file changed, 90 insertions(+), 26 deletions(-) diff --git a/LuaScript/docs/LuaScript.ja-jp.txt b/LuaScript/docs/LuaScript.ja-jp.txt index 24b5476..1faeee2 100644 --- a/LuaScript/docs/LuaScript.ja-jp.txt +++ b/LuaScript/docs/LuaScript.ja-jp.txt @@ -318,22 +318,86 @@ ○obj.load(対象, ...) オブジェクトのバッファを生成した内容に置き換えます。 - 本バージョンでは "figure"(図形)のみ対応します。 + 対象は "figure"(図形) / "text"(テキスト) / "image"(画像ファイル) / + "movie"(動画ファイル) に対応します。生成後 obj.w / obj.h 等は生成 + サイズへ更新され、load 直後の getpixel でも参照できます。 + 従来エンジン・高速エンジンの両方で動作します。 + obj.load("figure", 名前, 色, サイズ [, ライン [, アスペクト]]) - 図形を生成してオブジェクトのバッファを置き換えます - (出力は図形サイズに合わせて生成され、中心に配置されます)。 - 名前 : 図形名。円 / 四角形 / 三角形 / 五角形 / 六角形 / - 星形 のいずれか(英語名 circle, rect, triangle, - pentagon, hexagon, star も使用可)。 + 図形を生成してバッファを置き換えます(中心に配置)。 + 名前 : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (英語名 circle, rect, triangle, pentagon, + hexagon, star も使用可)。 色 : 塗り色 0xRRGGBB。 サイズ : 図形の基準サイズ(ピクセル)。 - ライン : 輪郭の太さ(省略可)。省略または 0 で塗りつぶし。 - サイズ以上の値を指定した場合も塗りつぶしになります。 - アスペクト: 歪曲 -1.0 ~ 1.0(省略可)。正で横幅、負で縦幅が縮みます。 - 例:obj.load("figure", "円", 0xff3366, 200) - ※ 実装されているのは obj.load("figure", ...) のみです。画像ファイルや - "text"・"tempbuffer"・"movie" 等の対象は何も行いません。 - ※ 描画系スクリプトは従来エンジン(MoonSharp)で実行されます。 + ライン : 輪郭の太さ(省略可)。0 で塗りつぶし。 + アスペクト: 歪曲 -1.0 ~ 1.0(省略可)。 + 例:obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", 文字列) + obj.setfont で指定したフォント・サイズ・色で文字列を + 描画してバッファを置き換えます(DirectWrite で描画)。 + 例:obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", パス) + 画像ファイルを読み込んでバッファを置き換えます。 + ※ 安全のため先頭ヘッダーを検証し、真正な画像 + (PNG / JPEG / GIF / BMP / TIFF / WebP)のみ読み込みます。 + 例:obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", パス [, 時間]) + 動画ファイルの指定時間のフレームを読み込んでバッファを + 置き換えます(Media Foundation で復号)。 + 時間 : 秒。省略時は obj.time。 + ※ 安全のため先頭ヘッダーを検証し、真正な動画 + (MP4 / MOV / MKV / WebM / AVI / FLV / ASF)のみ + 読み込みます。 + 例:obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + ○obj.setfont(フォント名 [, サイズ [, スタイル [, 色]]]) + obj.load("text") で使用するフォントを設定します。 + スタイル : ビット和。1=太字, 2=斜体, 3=太字+斜体。 + 色 : 0xRRGGBB。 + 例:obj.setfont("Meiryo", 64, 1, 0xffffff) + + ○obj.draw([ox, oy, oz [, 拡大率 [, 不透明度 [, アスペクト]]]]) + 現在のオブジェクト画像を蓄積バッファへ合成して描画します。 + 複数回呼ぶと重ねて描画されます(残像・パーティクル等)。 + ox, oy, oz : 中心からのオフセット(省略時 0)。 + 拡大率 : 1.0 で等倍(省略時 1.0)。 + 不透明度 : 0.0 ~ 1.0(省略時 1.0)。 + アスペクト : -1.0 ~ 1.0(省略時 0)。 + ※ 呼び出すと標準描画は抑制され、合成結果が出力されます。 + + ○obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, 不透明度]]) + 4 頂点で指定した四角形へオブジェクト画像をテクスチャ描画します。 + 頂点は左上→右上→右下→左下の順。UV 省略時は画像全体を使用します。 + ※ アフィン変換で写像します(平行四辺形は厳密、非平行四辺形は近似)。 + + ○obj.copybuffer(コピー先, コピー元) + バッファ間で画像をコピーします。識別子の先頭文字で判定します。 + "obj" : オブジェクト画像バッファ + "tmp" : 一時バッファ + "cache:名前" : 名前付きキャッシュ(フレーム間で保持) + 例:obj.copybuffer("tmp", "obj") -- 退避 + obj.copybuffer("obj", "tmp") -- 復元 + ※ "frm"(フレームバッファ/背景)はYMM4の構造上取得できません。 + + ○obj.getvalue(対象) + obj の現在値を取得します(obj.x や obj.track0 等と同値)。 + 対象 : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame" 等。 + 戻り値 : 数値(未知の対象は 0)。 + + ○obj.setoption(名前, 値) / obj.getoption(名前) + オプションを設定 / 取得します。未対応の項目も受理してスクリプトを + 停止させません(getoption は設定値を返し、未設定は 0)。 + 現在描画へ反映される項目: + "antialias" : 0 で最近傍、それ以外で線形補間(obj.draw/drawpoly)。 + + ○obj.pixeloption(名前, 値) + ピクセル操作のオプションを状態として保持します。 @@ -507,28 +571,28 @@ AviUtl 互換の決定論的な整数乱数です。詳細は「obj テーブル - 関数」を 参照してください。 - ○図形描画 - obj.load("figure", ...) で円・四角形・三角形・五角形・六角形・星形を - 生成し、オブジェクトのバッファを置き換えます。詳細は「obj テーブル - + ○描画・合成・読み込み + obj.draw / obj.drawpoly による描画合成、obj.copybuffer による + バッファ操作、obj.load("figure"/"text"/"image"/"movie") による生成・ + 読み込み、obj.setfont、obj.effect、obj.getvalue、obj.setoption / + obj.getoption / obj.pixeloption に対応します。詳細は「obj テーブル - 関数」を参照してください。 - 次の機能は本体の描画パイプラインへの統合を要するため、この互換層では対象外です。 + 次の機能はこの互換層では対象外です。 これらを呼び出すスクリプトは意図どおりには動作しません。 - ×描画・合成(obj.draw / obj.drawpoly)、obj.load の "figure" 以外の対象 - (画像ファイル・"text"・"movie" 等)、および obj.setfont - ×フィルタ効果やバッファ操作 - (obj.effect / obj.copybuffer / obj.setoption など) - ×require によるモジュール読み込み、io などのファイルアクセス + ×require によるモジュール読み込み、io / dofile などの任意ファイル + アクセス(obj.load の画像 / 動画はヘッダー検証付きで対応)。 + ×obj.setanchor、scene.set / scene.get 等。 - 非対応・制限事項 - - ×AviUtl2 の obj.effect(), obj.draw(), obj.drawpoly() 等には対応していません(obj.load は "figure" のみ対応。「AviUtl スクリプトの部分互換」を参照)。 - ×AviUtl2 の obj.rand1(), obj.setfont(), obj.mes() 等には対応していません。 - ×AviUtl2 の obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 等には対応していません。 + ×AviUtl2 の obj.rand1(), obj.mes(), obj.setanchor() 等には対応していません。 ×AviUtl2 の scene テーブルの scene.set(), scene.get() 等の関数には対応していません。 (scene.width と scene.height の読み取りのみ対応) - ×ファイルアクセス(require, dofile, io 等)には対応していません。 + ×スクリプトからの任意ファイルアクセス(require, dofile, io 等)には対応して + いません。obj.load("image"/"movie") のみ、先頭ヘッダー検証で真正なメディアと + 確認できたファイルを読み込みます。 ×obj.z を変更した場合、描画には反映されます(ReadBack に含まれる)が、 3D 描画のサポートは限定的です。 ×スクリプトのタイムアウト(5秒)を超えた場合、実行は強制終了されます。 From 7601b77902e3435986dcee81b09a3d297da6c9c9 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:44:24 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E8=8B=B1=E8=AA=9E=E3=82=92AviUtl=E4=BA=92?= =?UTF-8?q?=E6=8F=9B=E5=AE=9F=E8=A3=85=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.en-us.txt | 129 ++++++++++++++++++++++------- 1 file changed, 99 insertions(+), 30 deletions(-) diff --git a/LuaScript/docs/LuaScript.en-us.txt b/LuaScript/docs/LuaScript.en-us.txt index bb03bc3..f895fc1 100644 --- a/LuaScript/docs/LuaScript.en-us.txt +++ b/LuaScript/docs/LuaScript.en-us.txt @@ -322,24 +322,92 @@ Example: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) o obj.load(target, ...) - Replaces the object buffer with generated content. - Only the "figure" target is supported in this version. + Replaces the object buffer with generated content. The targets + "figure", "text", "image" (image file) and "movie" (video file) + are supported. After loading, obj.w / obj.h, etc. are updated to the + generated size and can be read by getpixel right after the load. + Works on both the MoonSharp and the fast (LuaJIT) engine. + obj.load("figure", name, color, size [, line [, aspect]]) - Generates a shape and replaces the object buffer with it - (the output is resized to the shape and centered). - name : Shape name. One of 円 / 四角形 / 三角形 / 五角形 / - 六角形 / 星形 (English aliases circle, rect, - triangle, pentagon, hexagon, star are also accepted). + Generates a shape and replaces the buffer (centered). + name : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (English aliases circle, rect, triangle, pentagon, + hexagon, star are also accepted). color : Fill color 0xRRGGBB. size : Bounding size in pixels. - line : Outline width (optional). Omitted or 0 fills the - shape; a value at or above the size also fills it. - aspect : Distortion -1.0 ~ 1.0 (optional). Positive shrinks - the width, negative shrinks the height. - Example: obj.load("figure", "円", 0xff3366, 200) - * Only obj.load("figure", ...) is implemented. Other targets - (image files, "text", "tempbuffer", "movie", etc.) do nothing. - * Drawing scripts run on the MoonSharp engine. + line : Outline width (optional). 0 fills the shape. + aspect : Distortion -1.0 ~ 1.0 (optional). + Example: obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", string) + Draws the string with the font, size and color set by + obj.setfont and replaces the buffer (rendered with DirectWrite). + Example: obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", path) + Loads an image file and replaces the buffer. + * For safety the leading header is validated and only genuine + images (PNG / JPEG / GIF / BMP / TIFF / WebP) are loaded. + Example: obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", path [, time]) + Loads the frame at the given time of a video file and replaces + the buffer (decoded with Media Foundation). + time : Seconds. Defaults to obj.time when omitted. + * For safety the leading header is validated and only genuine + videos (MP4 / MOV / MKV / WebM / AVI / FLV / ASF) are loaded. + Example: obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + o obj.setfont(font [, size [, style [, color]]]) + Sets the font used by obj.load("text"). + style : Bit flags. 1=bold, 2=italic, 3=bold+italic. + color : 0xRRGGBB. + Example: obj.setfont("Meiryo", 64, 1, 0xffffff) + + o obj.draw([ox, oy, oz [, zoom [, alpha [, aspect]]]]) + Composites the current object image onto the accumulation buffer. + Calling it multiple times draws overlapping copies (afterimages, + particles, etc.). + ox, oy, oz : Offset from the center (default 0). + zoom : 1.0 is original size (default 1.0). + alpha : 0.0 ~ 1.0 (default 1.0). + aspect : -1.0 ~ 1.0 (default 0). + * Once called, the standard draw is suppressed and the composited + result is output. + + o obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, alpha]]) + Texture-maps the object image onto a quad given by 4 vertices. + Vertex order is top-left, top-right, bottom-right, bottom-left. + When UVs are omitted the whole image is used. + * Mapped with an affine transform (exact for parallelograms, + approximate for non-parallelograms). + + o obj.copybuffer(destination, source) + Copies an image between buffers, selected by the first character. + "obj" : Object image buffer + "tmp" : Temporary buffer + "cache:name" : Named cache (kept across frames) + Example: obj.copybuffer("tmp", "obj") -- save + obj.copybuffer("obj", "tmp") -- restore + * "frm" (frame buffer / background) cannot be obtained due to the + structure of YMM4. + + o obj.getvalue(target) + Gets the current value of obj (same as obj.x, obj.track0, etc.). + target : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame", etc. + Returns: a number (0 for an unknown target). + + o obj.setoption(name, value) / obj.getoption(name) + Sets / gets an option. Unsupported options are accepted so they do + not stop the script (getoption returns the stored value, 0 if unset). + Options that currently affect drawing: + "antialias" : 0 = nearest neighbor, otherwise linear interpolation + (obj.draw / obj.drawpoly). + + o obj.pixeloption(name, value) + Stores an option for pixel operations as state. @@ -515,28 +583,29 @@ A deterministic integer random function compatible with AviUtl. See "obj Table - Functions" for details. - o Figure drawing - obj.load("figure", ...) generates a basic shape (circle, rectangle, - triangle, pentagon, hexagon, star) and replaces the object buffer - with it. See "obj Table - Functions" for details. + o Drawing, compositing and loading + Drawing and compositing with obj.draw / obj.drawpoly, buffer + operations with obj.copybuffer, generation and loading with + obj.load("figure"/"text"/"image"/"movie"), obj.setfont, obj.effect, + obj.getvalue, and obj.setoption / obj.getoption / obj.pixeloption are + supported. See "obj Table - Functions" for details. - The following require integration with the rendering pipeline and are out of - scope for this layer. Scripts that call them will not behave as intended. - x Drawing and compositing (obj.draw / obj.drawpoly), obj.load targets - other than "figure" (image files, "text", "movie", etc.) and obj.setfont - x Filter effects and buffer operations - (obj.effect / obj.copybuffer / obj.setoption, etc.) - x Module loading via require, and file access such as io + The following are out of scope for this layer. Scripts that call them will not + behave as intended. + x Module loading via require, and arbitrary file access such as io / + dofile (image / video loading via obj.load is supported with header + validation). + x obj.setanchor, scene.set / scene.get, etc. - Unsupported Features / Limitations - - x obj.effect(), obj.draw(), obj.drawpoly(), etc. from AviUtl2 are not supported (only obj.load("figure", ...) is supported; see "AviUtl Script Compatibility (Partial)"). - x obj.rand1(), obj.setfont(), obj.mes(), etc. from AviUtl2 are not supported. - x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. from AviUtl2 are not supported. + x obj.rand1(), obj.mes(), obj.setanchor(), etc. from AviUtl2 are not supported. x Functions such as scene.set() and scene.get() in the AviUtl2 scene table are not supported. (Only scene.width and scene.height can be read) - x File access (require, dofile, io, etc.) is not supported. + x Arbitrary file access from scripts (require, dofile, io, etc.) is not supported. + Only obj.load("image"/"movie") loads files confirmed to be genuine media by + leading-header validation. x Modifying obj.z is reflected in rendering (included in ReadBack), but 3D rendering support is limited. x If the script timeout (5 seconds) is exceeded, execution is forcibly terminated. From d6b6e440bf10d8b67a33d353158f8ec142d6753d Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:45:37 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E7=B0=A1=E4=BD=93=E5=AD=97=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E8=AA=9E=E3=82=92AviUtl=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.zh-cn.txt | 117 ++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 28 deletions(-) diff --git a/LuaScript/docs/LuaScript.zh-cn.txt b/LuaScript/docs/LuaScript.zh-cn.txt index bde8c1e..c94c1be 100644 --- a/LuaScript/docs/LuaScript.zh-cn.txt +++ b/LuaScript/docs/LuaScript.zh-cn.txt @@ -311,22 +311,84 @@ 示例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) ○ obj.load(目标, ...) - 将对象缓冲区替换为生成的内容。本版本仅支持 "figure"(图形)。 + 将对象缓冲区替换为生成的内容。支持 "figure"(图形) / "text"(文本) / + "image"(图像文件) / "movie"(视频文件)。加载后 obj.w / obj.h 等会更新为 + 生成尺寸,紧接着的 getpixel 也可读取。传统引擎与高速引擎均可运行。 + obj.load("figure", 名称, 颜色, 大小 [, 线宽 [, 纵横比]]) - 生成图形并替换对象缓冲区 - (输出按图形大小生成并居中)。 - 名称 : 图形名。円 / 四角形 / 三角形 / 五角形 / 六角形 / - 星形 之一(也可用英文 circle, rect, triangle, - pentagon, hexagon, star)。 - 颜色 : 填充色 0xRRGGBB。 - 大小 : 图形基准大小(像素)。 - 线宽 : 轮廓宽度(可省略)。省略或 0 为填充; - 指定大于等于大小的值时也为填充。 - 纵横比 : 变形 -1.0 ~ 1.0(可省略)。正值缩小宽度,负值缩小高度。 - 示例:obj.load("figure", "円", 0xff3366, 200) - * 仅实现了 obj.load("figure", ...)。图像文件、"text"、"tempbuffer"、 - "movie" 等目标不执行任何操作。 - * 绘制类脚本在 MoonSharp 引擎上运行。 + 生成图形并替换缓冲区(居中)。 + 名称 : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (也可用英文 circle, rect, triangle, pentagon, + hexagon, star)。 + 颜色 : 填充色 0xRRGGBB。 + 大小 : 基准大小(像素)。 + 线宽 : 轮廓宽度(可省略)。0 为填充。 + 纵横比 : 变形 -1.0 ~ 1.0(可省略)。 + 示例:obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", 字符串) + 以 obj.setfont 指定的字体、大小、颜色绘制字符串并替换缓冲区 + (使用 DirectWrite 绘制)。 + 示例:obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", 路径) + 加载图像文件并替换缓冲区。 + ※ 为安全起见会校验文件头,仅加载真正的图像 + (PNG / JPEG / GIF / BMP / TIFF / WebP)。 + 示例:obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", 路径 [, 时间]) + 加载视频文件指定时间的帧并替换缓冲区 + (使用 Media Foundation 解码)。 + 时间 : 秒。省略时为 obj.time。 + ※ 为安全起见会校验文件头,仅加载真正的视频 + (MP4 / MOV / MKV / WebM / AVI / FLV / ASF)。 + 示例:obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + ○ obj.setfont(字体 [, 大小 [, 样式 [, 颜色]]]) + 设置 obj.load("text") 使用的字体。 + 样式 : 位标志。1=粗体, 2=斜体, 3=粗斜体。 + 颜色 : 0xRRGGBB。 + 示例:obj.setfont("Meiryo", 64, 1, 0xffffff) + + ○ obj.draw([ox, oy, oz [, 缩放 [, 不透明度 [, 纵横比]]]]) + 将当前对象图像合成到累积缓冲区并绘制。 + 多次调用会叠加绘制(残像、粒子等)。 + ox, oy, oz : 相对中心的偏移(默认 0)。 + 缩放 : 1.0 为原始大小(默认 1.0)。 + 不透明度 : 0.0 ~ 1.0(默认 1.0)。 + 纵横比 : -1.0 ~ 1.0(默认 0)。 + ※ 调用后将抑制标准绘制,输出合成结果。 + + ○ obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, 不透明度]]) + 将对象图像以纹理方式绘制到 4 个顶点指定的四边形。 + 顶点顺序为左上→右上→右下→左下。省略 UV 时使用整幅图像。 + ※ 使用仿射变换映射(平行四边形精确,非平行四边形为近似)。 + + ○ obj.copybuffer(目标, 源) + 在缓冲区之间复制图像。按标识符首字符判定。 + "obj" : 对象图像缓冲区 + "tmp" : 临时缓冲区 + "cache:名称" : 命名缓存(跨帧保留) + 示例:obj.copybuffer("tmp", "obj") -- 保存 + obj.copybuffer("obj", "tmp") -- 恢复 + ※ 由于 YMM4 的结构,无法获取 "frm"(帧缓冲区 / 背景)。 + + ○ obj.getvalue(目标) + 获取 obj 的当前值(与 obj.x、obj.track0 等相同)。 + 目标 : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame" 等。 + 返回值 : 数值(未知目标返回 0)。 + + ○ obj.setoption(名称, 值) / obj.getoption(名称) + 设置 / 获取选项。未支持的项目也会被接受,不会中断脚本 + (getoption 返回设置值,未设置为 0)。 + 当前会反映到绘制的项目: + "antialias" : 0 为最近邻,其它为线性插值(obj.draw / obj.drawpoly)。 + + ○ obj.pixeloption(名称, 值) + 将像素操作的选项作为状态保存。 @@ -495,27 +557,26 @@ ○ obj.rand(st, ed [, seed [, frame]]) 与 AviUtl 兼容的确定性整数随机数。详情请参阅“obj 表 - 函数”。 - ○ 图形绘制 - obj.load("figure", ...) 生成圆、四角形、三角形、五角形、六角形、星形, - 并替换对象缓冲区。详情请参阅“obj 表 - 函数”。 + ○ 绘制·合成·加载 + 支持 obj.draw / obj.drawpoly 的绘制合成、obj.copybuffer 的缓冲区操作、 + obj.load("figure"/"text"/"image"/"movie") 的生成与加载、obj.setfont、 + obj.effect、obj.getvalue 以及 obj.setoption / obj.getoption / + obj.pixeloption。详情请参阅“obj 表 - 函数”。 - 以下功能需要与本体的绘制管线集成,因此不在此兼容层的范围内。 + 以下功能不在此兼容层的范围内。 调用它们的脚本不会按预期运行。 - × 绘制与合成(obj.draw / obj.drawpoly)、obj.load 的 "figure" 以外目标 - (图像文件、"text"、"movie" 等),以及 obj.setfont - × 滤镜效果与缓冲区操作 - (obj.effect / obj.copybuffer / obj.setoption 等) - × 通过 require 加载模块,以及 io 等文件访问 + × 通过 require 加载模块,以及 io / dofile 等任意文件访问 + (obj.load 的图像 / 视频加载已带文件头校验支持)。 + × obj.setanchor、scene.set / scene.get 等。 - 不支持项目·限制事项 - - × 不支持 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly() 等(obj.load 仅支持 "figure",参阅“AviUtl 脚本的部分兼容”)。 - × 不支持 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。 - × 不支持 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。 + × 不支持 AviUtl2 的 obj.rand1()、obj.mes()、obj.setanchor() 等。 × 不支持 AviUtl2 scene 表中的 scene.set()、scene.get() 等函数。 (仅支持读取 scene.width 和 scene.height) - × 不支持文件访问(require、dofile、io 等)。 + × 不支持脚本进行任意文件访问(require、dofile、io 等)。 + 仅 obj.load("image"/"movie") 会加载经文件头校验确认为真正媒体的文件。 × 修改 obj.z 会反映到绘制中(包含在 ReadBack 中), 但 3D 绘制支持有限。 × 超过脚本超时时间(5 秒)时,执行将被强制终止。 From 451b017f6f373c4fb96554f14ab1605808a1dd61 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:46:57 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E7=B9=81=E4=BD=93=E5=AD=97=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E8=AA=9E=E3=82=92AviUtl=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.zh-tw.txt | 117 ++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 28 deletions(-) diff --git a/LuaScript/docs/LuaScript.zh-tw.txt b/LuaScript/docs/LuaScript.zh-tw.txt index b120129..eed6585 100644 --- a/LuaScript/docs/LuaScript.zh-tw.txt +++ b/LuaScript/docs/LuaScript.zh-tw.txt @@ -311,22 +311,84 @@ 範例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) ○ obj.load(目標, ...) - 將物件緩衝區替換為產生的內容。本版本僅支援 "figure"(圖形)。 + 將物件緩衝區替換為產生的內容。支援 "figure"(圖形) / "text"(文字) / + "image"(影像檔) / "movie"(影片檔)。載入後 obj.w / obj.h 等會更新為產生 + 尺寸,緊接著的 getpixel 亦可讀取。傳統引擎與高速引擎皆可執行。 + obj.load("figure", 名稱, 顏色, 大小 [, 線寬 [, 長寬比]]) - 產生圖形並替換物件緩衝區 - (輸出依圖形大小產生並置中)。 - 名稱 : 圖形名。円 / 四角形 / 三角形 / 五角形 / 六角形 / - 星形 之一(亦可用英文 circle, rect, triangle, - pentagon, hexagon, star)。 - 顏色 : 填滿色 0xRRGGBB。 - 大小 : 圖形基準大小(像素)。 - 線寬 : 輪廓寬度(可省略)。省略或 0 為填滿; - 指定大於等於大小的值時亦為填滿。 - 長寬比 : 變形 -1.0 ~ 1.0(可省略)。正值縮小寬度,負值縮小高度。 - 範例:obj.load("figure", "円", 0xff3366, 200) - * 僅實作了 obj.load("figure", ...)。影像檔、"text"、"tempbuffer"、 - "movie" 等目標不執行任何動作。 - * 繪製類腳本在 MoonSharp 引擎上執行。 + 產生圖形並替換緩衝區(置中)。 + 名稱 : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (亦可用英文 circle, rect, triangle, pentagon, + hexagon, star)。 + 顏色 : 填滿色 0xRRGGBB。 + 大小 : 基準大小(像素)。 + 線寬 : 輪廓寬度(可省略)。0 為填滿。 + 長寬比 : 變形 -1.0 ~ 1.0(可省略)。 + 範例:obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", 字串) + 以 obj.setfont 指定的字型、大小、顏色繪製字串並替換緩衝區 + (使用 DirectWrite 繪製)。 + 範例:obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", 路徑) + 載入影像檔並替換緩衝區。 + ※ 為安全起見會驗證檔頭,僅載入真正的影像 + (PNG / JPEG / GIF / BMP / TIFF / WebP)。 + 範例:obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", 路徑 [, 時間]) + 載入影片檔指定時間的影格並替換緩衝區 + (使用 Media Foundation 解碼)。 + 時間 : 秒。省略時為 obj.time。 + ※ 為安全起見會驗證檔頭,僅載入真正的影片 + (MP4 / MOV / MKV / WebM / AVI / FLV / ASF)。 + 範例:obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + ○ obj.setfont(字型 [, 大小 [, 樣式 [, 顏色]]]) + 設定 obj.load("text") 使用的字型。 + 樣式 : 位元旗標。1=粗體, 2=斜體, 3=粗斜體。 + 顏色 : 0xRRGGBB。 + 範例:obj.setfont("Meiryo", 64, 1, 0xffffff) + + ○ obj.draw([ox, oy, oz [, 縮放 [, 不透明度 [, 長寬比]]]]) + 將目前物件影像合成到累積緩衝區並繪製。 + 多次呼叫會疊加繪製(殘影、粒子等)。 + ox, oy, oz : 相對中心的偏移(預設 0)。 + 縮放 : 1.0 為原始大小(預設 1.0)。 + 不透明度 : 0.0 ~ 1.0(預設 1.0)。 + 長寬比 : -1.0 ~ 1.0(預設 0)。 + ※ 呼叫後會抑制標準繪製,輸出合成結果。 + + ○ obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, 不透明度]]) + 將物件影像以材質方式繪製到 4 個頂點指定的四邊形。 + 頂點順序為左上→右上→右下→左下。省略 UV 時使用整幅影像。 + ※ 使用仿射變換對應(平行四邊形精確,非平行四邊形為近似)。 + + ○ obj.copybuffer(目標, 來源) + 在緩衝區之間複製影像。依識別字首字元判定。 + "obj" : 物件影像緩衝區 + "tmp" : 暫存緩衝區 + "cache:名稱" : 具名快取(跨影格保留) + 範例:obj.copybuffer("tmp", "obj") -- 儲存 + obj.copybuffer("obj", "tmp") -- 還原 + ※ 由於 YMM4 的結構,無法取得 "frm"(影格緩衝區 / 背景)。 + + ○ obj.getvalue(目標) + 取得 obj 的目前值(與 obj.x、obj.track0 等相同)。 + 目標 : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame" 等。 + 回傳值 : 數值(未知目標回傳 0)。 + + ○ obj.setoption(名稱, 值) / obj.getoption(名稱) + 設定 / 取得選項。未支援的項目也會被接受,不會中斷腳本 + (getoption 回傳設定值,未設定為 0)。 + 目前會反映到繪製的項目: + "antialias" : 0 為最近鄰,其它為線性內插(obj.draw / obj.drawpoly)。 + + ○ obj.pixeloption(名稱, 值) + 將像素操作的選項作為狀態保存。 @@ -495,27 +557,26 @@ ○ obj.rand(st, ed [, seed [, frame]]) 與 AviUtl 相容的確定性整數亂數。詳情請參閱「obj 表 - 函式」。 - ○ 圖形繪製 - obj.load("figure", ...) 產生圓、四角形、三角形、五角形、六角形、星形, - 並替換物件緩衝區。詳情請參閱「obj 表 - 函式」。 + ○ 繪製·合成·載入 + 支援 obj.draw / obj.drawpoly 的繪製合成、obj.copybuffer 的緩衝區操作、 + obj.load("figure"/"text"/"image"/"movie") 的產生與載入、obj.setfont、 + obj.effect、obj.getvalue 以及 obj.setoption / obj.getoption / + obj.pixeloption。詳情請參閱「obj 表 - 函式」。 - 以下功能需要與本體的繪製管線整合,因此不在此相容層的範圍內。 + 以下功能不在此相容層的範圍內。 呼叫它們的腳本不會如預期運作。 - × 繪製與合成(obj.draw / obj.drawpoly)、obj.load 的 "figure" 以外目標 - (影像檔、"text"、"movie" 等),以及 obj.setfont - × 濾鏡效果與緩衝區操作 - (obj.effect / obj.copybuffer / obj.setoption 等) - × 透過 require 載入模組,以及 io 等檔案存取 + × 透過 require 載入模組,以及 io / dofile 等任意檔案存取 + (obj.load 的影像 / 影片載入已附檔頭驗證支援)。 + × obj.setanchor、scene.set / scene.get 等。 - 不支援項目·限制事項 - - × 不支援 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly() 等(obj.load 僅支援 "figure",參閱「AviUtl 腳本的部分相容」)。 - × 不支援 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。 - × 不支援 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。 + × 不支援 AviUtl2 的 obj.rand1()、obj.mes()、obj.setanchor() 等。 × 不支援 AviUtl2 scene 表中的 scene.set()、scene.get() 等函式。 (僅支援讀取 scene.width 和 scene.height) - × 不支援檔案存取(require、dofile、io 等)。 + × 不支援腳本進行任意檔案存取(require、dofile、io 等)。 + 僅 obj.load("image"/"movie") 會載入經檔頭驗證確認為真正媒體的檔案。 × 修改 obj.z 會反映至繪製中(包含在 ReadBack 中), 但 3D 繪製支援有限。 × 超過腳本逾時時間(5 秒)時,執行將被強制終止。 From c4011d8eef4ac328dc5914817a0359592cc92b60 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:48:19 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E9=9F=93=E5=9B=BD=E8=AA=9E=E3=82=92AviUtl?= =?UTF-8?q?=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.ko-kr.txt | 123 ++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 30 deletions(-) diff --git a/LuaScript/docs/LuaScript.ko-kr.txt b/LuaScript/docs/LuaScript.ko-kr.txt index 1a982ff..70b051b 100644 --- a/LuaScript/docs/LuaScript.ko-kr.txt +++ b/LuaScript/docs/LuaScript.ko-kr.txt @@ -313,23 +313,86 @@ 예: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) ○ obj.load(대상, ...) - 오브젝트 버퍼를 생성한 내용으로 교체합니다. - 이 버전에서는 "figure"(도형)만 지원합니다. + 오브젝트 버퍼를 생성한 내용으로 교체합니다. "figure"(도형) / + "text"(텍스트) / "image"(이미지 파일) / "movie"(동영상 파일)를 + 지원합니다. 로드 후 obj.w / obj.h 등은 생성 크기로 갱신되며, 로드 + 직후의 getpixel로도 참조할 수 있습니다. 기존 엔진과 고속 엔진 + 양쪽에서 동작합니다. + obj.load("figure", 이름, 색, 크기 [, 라인 [, 종횡비]]) - 도형을 생성하여 오브젝트 버퍼를 교체합니다 - (출력은 도형 크기에 맞춰 생성되고 중심에 배치됩니다). - 이름 : 도형 이름. 円 / 四角形 / 三角形 / 五角形 / 六角形 / - 星形 중 하나(영어 circle, rect, triangle, - pentagon, hexagon, star 도 사용 가능). - 색 : 채움 색 0xRRGGBB. - 크기 : 도형의 기준 크기(픽셀). - 라인 : 외곽선 두께(생략 가능). 생략 또는 0이면 채움. - 크기 이상의 값을 지정한 경우에도 채움이 됩니다. - 종횡비 : 왜곡 -1.0 ~ 1.0(생략 가능). 양수는 너비, 음수는 높이를 줄입니다. - 예: obj.load("figure", "円", 0xff3366, 200) - ※ 구현된 것은 obj.load("figure", ...) 뿐입니다. 이미지 파일, - "text"・"tempbuffer"・"movie" 등의 대상은 아무것도 하지 않습니다. - ※ 그리기 계열 스크립트는 MoonSharp 엔진에서 실행됩니다. + 도형을 생성하여 버퍼를 교체합니다(중심 배치). + 이름 : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (영어 circle, rect, triangle, pentagon, hexagon, + star 도 사용 가능). + 색 : 채움 색 0xRRGGBB. + 크기 : 기준 크기(픽셀). + 라인 : 외곽선 두께(생략 가능). 0이면 채움. + 종횡비 : 왜곡 -1.0 ~ 1.0(생략 가능). + 예: obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", 문자열) + obj.setfont로 지정한 글꼴・크기・색으로 문자열을 그려 + 버퍼를 교체합니다(DirectWrite로 그림). + 예: obj.setfont("Yu Gothic UI", 48); obj.load("text", "자막") + + obj.load("image", 경로) + 이미지 파일을 읽어 버퍼를 교체합니다. + ※ 안전을 위해 선두 헤더를 검증하여 진짜 이미지 + (PNG / JPEG / GIF / BMP / TIFF / WebP)만 읽습니다. + 예: obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", 경로 [, 시간]) + 동영상 파일의 지정 시간 프레임을 읽어 버퍼를 교체합니다 + (Media Foundation으로 디코딩). + 시간 : 초. 생략 시 obj.time. + ※ 안전을 위해 선두 헤더를 검증하여 진짜 동영상 + (MP4 / MOV / MKV / WebM / AVI / FLV / ASF)만 읽습니다. + 예: obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + ○ obj.setfont(글꼴 [, 크기 [, 스타일 [, 색]]]) + obj.load("text")에서 사용할 글꼴을 설정합니다. + 스타일 : 비트 플래그. 1=굵게, 2=기울임, 3=굵게+기울임. + 색 : 0xRRGGBB. + 예: obj.setfont("Meiryo", 64, 1, 0xffffff) + + ○ obj.draw([ox, oy, oz [, 확대율 [, 불투명도 [, 종횡비]]]]) + 현재 오브젝트 이미지를 누적 버퍼에 합성하여 그립니다. + 여러 번 호출하면 겹쳐서 그려집니다(잔상・파티클 등). + ox, oy, oz : 중심으로부터의 오프셋(기본 0). + 확대율 : 1.0이 등배(기본 1.0). + 불투명도 : 0.0 ~ 1.0(기본 1.0). + 종횡비 : -1.0 ~ 1.0(기본 0). + ※ 호출하면 표준 그리기가 억제되고 합성 결과가 출력됩니다. + + ○ obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, 불투명도]]) + 4개 정점으로 지정한 사각형에 오브젝트 이미지를 텍스처로 그립니다. + 정점 순서는 좌상→우상→우하→좌하. UV 생략 시 전체 이미지를 사용합니다. + ※ 아핀 변환으로 매핑합니다(평행사변형은 정확, 비평행사변형은 근사). + + ○ obj.copybuffer(대상, 원본) + 버퍼 간에 이미지를 복사합니다. 식별자의 첫 글자로 판정합니다. + "obj" : 오브젝트 이미지 버퍼 + "tmp" : 임시 버퍼 + "cache:이름" : 명명 캐시(프레임 간 유지) + 예: obj.copybuffer("tmp", "obj") -- 저장 + obj.copybuffer("obj", "tmp") -- 복원 + ※ "frm"(프레임 버퍼 / 배경)은 YMM4의 구조상 가져올 수 없습니다. + + ○ obj.getvalue(대상) + obj의 현재 값을 가져옵니다(obj.x, obj.track0 등과 동일). + 대상 : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame" 등. + 반환값 : 숫자(알 수 없는 대상은 0). + + ○ obj.setoption(이름, 값) / obj.getoption(이름) + 옵션을 설정 / 가져옵니다. 지원하지 않는 항목도 받아들여 + 스크립트를 중단시키지 않습니다(getoption은 설정값을 반환, 미설정은 0). + 현재 그리기에 반영되는 항목: + "antialias" : 0이면 최근접, 그 외는 선형 보간(obj.draw / obj.drawpoly). + + ○ obj.pixeloption(이름, 값) + 픽셀 조작 옵션을 상태로 보존합니다. @@ -503,28 +566,28 @@ AviUtl 호환의 결정론적 정수 난수입니다. 자세한 내용은 "obj 테이블 - 함수"를 참조하세요. - ○ 도형 그리기 - obj.load("figure", ...) 로 원·사각형·삼각형·오각형·육각형·별형을 - 생성하여 오브젝트 버퍼를 교체합니다. 자세한 내용은 + ○ 그리기·합성·로드 + obj.draw / obj.drawpoly에 의한 그리기 합성, obj.copybuffer에 의한 + 버퍼 조작, obj.load("figure"/"text"/"image"/"movie")에 의한 생성·로드, + obj.setfont, obj.effect, obj.getvalue, 그리고 obj.setoption / + obj.getoption / obj.pixeloption을 지원합니다. 자세한 내용은 "obj 테이블 - 함수"를 참조하세요. - 다음 기능은 본체의 렌더링 파이프라인과의 통합이 필요하므로 이 호환 - 계층의 범위 밖입니다. 이를 호출하는 스크립트는 의도대로 동작하지 않습니다. - × 그리기·합성(obj.draw / obj.drawpoly), obj.load의 "figure" 이외 대상 - (이미지 파일·"text"・"movie" 등), 그리고 obj.setfont - × 필터 효과 및 버퍼 조작 - (obj.effect / obj.copybuffer / obj.setoption 등) - × require에 의한 모듈 로드 및 io 등의 파일 접근 + 다음 기능은 이 호환 계층의 범위 밖입니다. + 이를 호출하는 스크립트는 의도대로 동작하지 않습니다. + × require에 의한 모듈 로드 및 io / dofile 등의 임의 파일 접근 + (obj.load의 이미지 / 동영상 로드는 헤더 검증과 함께 지원). + × obj.setanchor, scene.set / scene.get 등. - 미지원·제한 사항 - - × AviUtl2의 obj.effect(), obj.draw(), obj.drawpoly() 등은 지원하지 않습니다(obj.load은 "figure"만 지원. "AviUtl 스크립트 부분 호환" 참조). - × AviUtl2의 obj.rand1(), obj.setfont(), obj.mes() 등은 지원하지 않습니다. - × AviUtl2의 obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 등은 지원하지 않습니다. + × AviUtl2의 obj.rand1(), obj.mes(), obj.setanchor() 등은 지원하지 않습니다. × AviUtl2의 scene 테이블의 scene.set(), scene.get() 등의 함수는 지원하지 않습니다. (scene.width와 scene.height의 읽기만 지원) - × 파일 접근(require, dofile, io 등)은 지원하지 않습니다. + × 스크립트에서의 임의 파일 접근(require, dofile, io 등)은 지원하지 않습니다. + obj.load("image"/"movie")만 선두 헤더 검증으로 진짜 미디어로 확인된 파일을 + 읽습니다. × obj.z를 변경하면 렌더링에 반영되지만(ReadBack에 포함), 3D 렌더링 지원은 제한적입니다. × 스크립트 타임아웃(5초)을 초과하면 실행이 강제 종료됩니다. From 26c96b302fcd80bc7e53a9d993fa34e86b550b28 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:49:51 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=B9=E3=83=9A=E3=82=A4=E3=83=B3=E8=AA=9E?= =?UTF-8?q?=E3=82=92AviUtl=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85=E3=81=B8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.es-es.txt | 131 ++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 31 deletions(-) diff --git a/LuaScript/docs/LuaScript.es-es.txt b/LuaScript/docs/LuaScript.es-es.txt index 8d661c3..2e3662c 100644 --- a/LuaScript/docs/LuaScript.es-es.txt +++ b/LuaScript/docs/LuaScript.es-es.txt @@ -320,24 +320,93 @@ Ejemplo: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) o obj.load(target, ...) - Reemplaza el búfer del objeto con contenido generado. - En esta versión solo se admite el target "figure". + Reemplaza el búfer del objeto con contenido generado. Se admiten los + targets "figure", "text", "image" (archivo de imagen) y "movie" + (archivo de vídeo). Tras la carga, obj.w / obj.h, etc. se actualizan al + tamaño generado y pueden leerse con getpixel justo después de la carga. + Funciona en el motor MoonSharp y en el motor rápido (LuaJIT). + obj.load("figure", name, color, size [, line [, aspect]]) - Genera una forma y reemplaza el búfer del objeto con ella - (la salida se redimensiona a la forma y se centra). - name : Nombre de la forma. Uno de 円 / 四角形 / 三角形 / - 五角形 / 六角形 / 星形 (también se aceptan los alias - en inglés circle, rect, triangle, pentagon, hexagon, star). + Genera una forma y reemplaza el búfer (centrada). + name : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (también los alias en inglés circle, rect, triangle, + pentagon, hexagon, star). color : Color de relleno 0xRRGGBB. size : Tamaño base en píxeles. - line : Grosor del contorno (opcional). Omitido o 0 rellena la - forma; un valor igual o mayor que el tamaño también la rellena. - aspect : Distorsión -1.0 ~ 1.0 (opcional). Positivo reduce el - ancho, negativo reduce el alto. - Ejemplo: obj.load("figure", "円", 0xff3366, 200) - * Solo se implementa obj.load("figure", ...). Otros targets - (archivos de imagen, "text", "tempbuffer", "movie", etc.) no hacen nada. - * Los scripts de dibujo se ejecutan en el motor MoonSharp. + line : Grosor del contorno (opcional). 0 rellena la forma. + aspect : Distorsión -1.0 ~ 1.0 (opcional). + Ejemplo: obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", cadena) + Dibuja la cadena con la fuente, el tamaño y el color definidos + por obj.setfont y reemplaza el búfer (con DirectWrite). + Ejemplo: obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", ruta) + Carga un archivo de imagen y reemplaza el búfer. + * Por seguridad se valida la cabecera inicial y solo se cargan + imágenes genuinas (PNG / JPEG / GIF / BMP / TIFF / WebP). + Ejemplo: obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", ruta [, tiempo]) + Carga el fotograma en el tiempo indicado de un archivo de vídeo + y reemplaza el búfer (decodificado con Media Foundation). + tiempo : Segundos. Por defecto obj.time si se omite. + * Por seguridad se valida la cabecera inicial y solo se cargan + vídeos genuinos (MP4 / MOV / MKV / WebM / AVI / FLV / ASF). + Ejemplo: obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + o obj.setfont(fuente [, tamaño [, estilo [, color]]]) + Establece la fuente usada por obj.load("text"). + estilo : Bits. 1=negrita, 2=cursiva, 3=negrita+cursiva. + color : 0xRRGGBB. + Ejemplo: obj.setfont("Meiryo", 64, 1, 0xffffff) + + o obj.draw([ox, oy, oz [, zoom [, alpha [, aspect]]]]) + Compone la imagen actual del objeto en el búfer de acumulación. + Llamarla varias veces dibuja copias superpuestas (estelas, + partículas, etc.). + ox, oy, oz : Desplazamiento desde el centro (por defecto 0). + zoom : 1.0 es tamaño original (por defecto 1.0). + alpha : 0.0 ~ 1.0 (por defecto 1.0). + aspect : -1.0 ~ 1.0 (por defecto 0). + * Una vez llamada, se suprime el dibujo estándar y se emite el + resultado compuesto. + + o obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, alpha]]) + Aplica la imagen del objeto como textura sobre un cuadrilátero dado por + 4 vértices. El orden es superior-izq, superior-der, inferior-der, + inferior-izq. Si se omiten las UV se usa toda la imagen. + * Se mapea con una transformación afín (exacta para paralelogramos, + aproximada para no paralelogramos). + + o obj.copybuffer(destino, origen) + Copia una imagen entre búferes, seleccionado por el primer carácter. + "obj" : Búfer de imagen del objeto + "tmp" : Búfer temporal + "cache:nombre" : Caché con nombre (se conserva entre fotogramas) + Ejemplo: obj.copybuffer("tmp", "obj") -- guardar + obj.copybuffer("obj", "tmp") -- restaurar + * "frm" (búfer de fotograma / fondo) no puede obtenerse por la + estructura de YMM4. + + o obj.getvalue(target) + Obtiene el valor actual de obj (igual que obj.x, obj.track0, etc.). + target : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame", etc. + Devuelve: un número (0 para un target desconocido). + + o obj.setoption(nombre, valor) / obj.getoption(nombre) + Establece / obtiene una opción. Las opciones no admitidas se aceptan + para no detener el script (getoption devuelve el valor guardado, 0 si + no está establecido). + Opciones que afectan al dibujo actualmente: + "antialias" : 0 = vecino más cercano, en otro caso interpolación + lineal (obj.draw / obj.drawpoly). + + o obj.pixeloption(nombre, valor) + Guarda como estado una opción para las operaciones de píxeles. @@ -515,29 +584,29 @@ Función de número aleatorio entero determinista compatible con AviUtl. Consulte "Tabla obj - Funciones" para más detalles. - o Dibujo de figuras - obj.load("figure", ...) genera una forma básica (círculo, rectángulo, - triángulo, pentágono, hexágono, estrella) y reemplaza el búfer del - objeto con ella. Consulte "Tabla obj - Funciones" para más detalles. + o Dibujo, composición y carga + Se admiten el dibujo y composición con obj.draw / obj.drawpoly, las + operaciones de búfer con obj.copybuffer, la generación y carga con + obj.load("figure"/"text"/"image"/"movie"), obj.setfont, obj.effect, + obj.getvalue y obj.setoption / obj.getoption / obj.pixeloption. + Consulte "Tabla obj - Funciones" para más detalles. - Lo siguiente requiere integración con la canalización de renderizado y, por - tanto, queda fuera del alcance de esta capa. Los scripts que lo llamen no se - comportarán como se espera. - x Dibujo y composición (obj.draw / obj.drawpoly), targets de obj.load - distintos de "figure" (archivos de imagen, "text", "movie", etc.) y obj.setfont - x Efectos de filtro y operaciones de búfer - (obj.effect / obj.copybuffer / obj.setoption, etc.) - x Carga de módulos mediante require y acceso a archivos como io + Lo siguiente queda fuera del alcance de esta capa. Los scripts que lo llamen no + se comportarán como se espera. + x Carga de módulos mediante require y acceso arbitrario a archivos como + io / dofile (la carga de imagen / vídeo con obj.load sí se admite con + validación de cabecera). + x obj.setanchor, scene.set / scene.get, etc. - Funciones no admitidas / Limitaciones - - x obj.effect(), obj.draw(), obj.drawpoly(), etc. de AviUtl2 no son compatibles (solo se admite obj.load("figure", ...); consulte "Compatibilidad parcial con scripts de AviUtl"). - x obj.rand1(), obj.setfont(), obj.mes(), etc. de AviUtl2 no son compatibles. - x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. de AviUtl2 no son compatibles. + x obj.rand1(), obj.mes(), obj.setanchor(), etc. de AviUtl2 no son compatibles. x Las funciones como scene.set() y scene.get() de la tabla scene de AviUtl2 no son compatibles. (Solo se pueden leer scene.width y scene.height) - x El acceso a archivos (require, dofile, io, etc.) no es compatible. + x El acceso arbitrario a archivos desde scripts (require, dofile, io, etc.) no es compatible. + Solo obj.load("image"/"movie") carga archivos confirmados como medios genuinos + mediante validación de la cabecera inicial. x Modificar obj.z se refleja en el renderizado (incluido en ReadBack), pero el soporte de renderizado 3D es limitado. x Si se supera el tiempo de espera del script (5 segundos), la ejecución se termina forzosamente. From 1acaef291cb97443f2f90a76617446c3ad681300 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:51:18 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=A4=E3=83=B3=E3=83=89=E3=83=8D=E3=82=B7?= =?UTF-8?q?=E3=82=A2=E8=AA=9E=E3=82=92AviUtl=E4=BA=92=E6=8F=9B=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=81=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.id-id.txt | 130 ++++++++++++++++++++++------- 1 file changed, 99 insertions(+), 31 deletions(-) diff --git a/LuaScript/docs/LuaScript.id-id.txt b/LuaScript/docs/LuaScript.id-id.txt index be7c6d5..db8f75a 100644 --- a/LuaScript/docs/LuaScript.id-id.txt +++ b/LuaScript/docs/LuaScript.id-id.txt @@ -318,24 +318,92 @@ Contoh: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) o obj.load(target, ...) - Mengganti buffer objek dengan konten yang dihasilkan. - Pada versi ini hanya target "figure" yang didukung. + Mengganti buffer objek dengan konten yang dihasilkan. Target "figure", + "text", "image" (berkas gambar) dan "movie" (berkas video) didukung. + Setelah dimuat, obj.w / obj.h, dll. diperbarui ke ukuran yang + dihasilkan dan dapat dibaca oleh getpixel tepat setelah pemuatan. + Berfungsi pada mesin MoonSharp maupun mesin cepat (LuaJIT). + obj.load("figure", name, color, size [, line [, aspect]]) - Menghasilkan sebuah bentuk dan mengganti buffer objek dengannya - (output diubah ukurannya sesuai bentuk dan dipusatkan). - name : Nama bentuk. Salah satu dari 円 / 四角形 / 三角形 / - 五角形 / 六角形 / 星形 (alias Inggris circle, rect, - triangle, pentagon, hexagon, star juga diterima). + Menghasilkan bentuk dan mengganti buffer (dipusatkan). + name : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (alias Inggris circle, rect, triangle, pentagon, + hexagon, star juga diterima). color : Warna isi 0xRRGGBB. size : Ukuran dasar dalam piksel. - line : Lebar garis tepi (opsional). Dihilangkan atau 0 mengisi - bentuk; nilai sama atau lebih besar dari ukuran juga mengisinya. - aspect : Distorsi -1.0 ~ 1.0 (opsional). Positif mengecilkan - lebar, negatif mengecilkan tinggi. - Contoh: obj.load("figure", "円", 0xff3366, 200) - * Hanya obj.load("figure", ...) yang diimplementasikan. Target lain - (berkas gambar, "text", "tempbuffer", "movie", dll.) tidak melakukan apa pun. - * Skrip penggambaran dijalankan pada mesin MoonSharp. + line : Lebar garis tepi (opsional). 0 mengisi bentuk. + aspect : Distorsi -1.0 ~ 1.0 (opsional). + Contoh: obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", string) + Menggambar string dengan font, ukuran, dan warna yang diatur + oleh obj.setfont dan mengganti buffer (digambar dengan DirectWrite). + Contoh: obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", path) + Memuat berkas gambar dan mengganti buffer. + * Demi keamanan, header awal divalidasi dan hanya gambar asli + (PNG / JPEG / GIF / BMP / TIFF / WebP) yang dimuat. + Contoh: obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", path [, time]) + Memuat frame pada waktu tertentu dari berkas video dan mengganti + buffer (didekode dengan Media Foundation). + time : Detik. Default obj.time jika dihilangkan. + * Demi keamanan, header awal divalidasi dan hanya video asli + (MP4 / MOV / MKV / WebM / AVI / FLV / ASF) yang dimuat. + Contoh: obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + o obj.setfont(font [, size [, style [, color]]]) + Mengatur font yang digunakan oleh obj.load("text"). + style : Flag bit. 1=tebal, 2=miring, 3=tebal+miring. + color : 0xRRGGBB. + Contoh: obj.setfont("Meiryo", 64, 1, 0xffffff) + + o obj.draw([ox, oy, oz [, zoom [, alpha [, aspect]]]]) + Mengomposit gambar objek saat ini ke buffer akumulasi. + Memanggilnya beberapa kali menggambar salinan bertumpuk (afterimage, + partikel, dll.). + ox, oy, oz : Offset dari pusat (default 0). + zoom : 1.0 adalah ukuran asli (default 1.0). + alpha : 0.0 ~ 1.0 (default 1.0). + aspect : -1.0 ~ 1.0 (default 0). + * Setelah dipanggil, penggambaran standar ditekan dan hasil komposit + dikeluarkan. + + o obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, alpha]]) + Memetakan gambar objek sebagai tekstur ke quad dari 4 verteks. + Urutan verteks: kiri-atas, kanan-atas, kanan-bawah, kiri-bawah. + Jika UV dihilangkan, seluruh gambar digunakan. + * Dipetakan dengan transformasi afin (tepat untuk jajaran genjang, + perkiraan untuk non-jajaran genjang). + + o obj.copybuffer(tujuan, sumber) + Menyalin gambar antar buffer, dipilih oleh karakter pertama. + "obj" : Buffer gambar objek + "tmp" : Buffer sementara + "cache:nama" : Cache bernama (dipertahankan antar frame) + Contoh: obj.copybuffer("tmp", "obj") -- simpan + obj.copybuffer("obj", "tmp") -- pulihkan + * "frm" (buffer frame / latar) tidak dapat diperoleh karena struktur YMM4. + + o obj.getvalue(target) + Mengambil nilai saat ini dari obj (sama dengan obj.x, obj.track0, dll.). + target : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame", dll. + Mengembalikan: sebuah angka (0 untuk target yang tidak dikenal). + + o obj.setoption(name, value) / obj.getoption(name) + Mengatur / mengambil opsi. Opsi yang tidak didukung tetap diterima + sehingga tidak menghentikan skrip (getoption mengembalikan nilai + tersimpan, 0 jika belum diatur). + Opsi yang saat ini memengaruhi penggambaran: + "antialias" : 0 = tetangga terdekat, selain itu interpolasi linear + (obj.draw / obj.drawpoly). + + o obj.pixeloption(name, value) + Menyimpan opsi untuk operasi piksel sebagai status. @@ -512,29 +580,29 @@ Fungsi bilangan acak bulat deterministik yang kompatibel dengan AviUtl. Lihat "Tabel obj - Fungsi" untuk detailnya. - o Penggambaran figur - obj.load("figure", ...) menghasilkan bentuk dasar (lingkaran, persegi, - segitiga, segilima, segienam, bintang) dan mengganti buffer objek - dengannya. Lihat "Tabel obj - Fungsi" untuk detailnya. + o Penggambaran, komposisi, dan pemuatan + Penggambaran dan komposisi dengan obj.draw / obj.drawpoly, operasi + buffer dengan obj.copybuffer, pembuatan dan pemuatan dengan + obj.load("figure"/"text"/"image"/"movie"), obj.setfont, obj.effect, + obj.getvalue, serta obj.setoption / obj.getoption / obj.pixeloption + didukung. Lihat "Tabel obj - Fungsi" untuk detailnya. - Berikut ini memerlukan integrasi dengan pipeline render sehingga berada di - luar cakupan lapisan ini. Skrip yang memanggilnya tidak akan berperilaku - seperti yang diharapkan. - x Penggambaran dan komposisi (obj.draw / obj.drawpoly), target obj.load - selain "figure" (berkas gambar, "text", "movie", dll.) dan obj.setfont - x Efek filter dan operasi buffer - (obj.effect / obj.copybuffer / obj.setoption, dll.) - x Pemuatan modul melalui require, dan akses file seperti io + Berikut ini berada di luar cakupan lapisan ini. Skrip yang memanggilnya tidak + akan berperilaku seperti yang diharapkan. + x Pemuatan modul melalui require, dan akses berkas sembarang seperti + io / dofile (pemuatan gambar / video via obj.load didukung dengan + validasi header). + x obj.setanchor, scene.set / scene.get, dll. - Fitur yang Tidak Didukung / Batasan - - x obj.effect(), obj.draw(), obj.drawpoly(), dll. dari AviUtl2 tidak didukung (hanya obj.load("figure", ...) yang didukung; lihat "Kompatibilitas Parsial Skrip AviUtl"). - x obj.rand1(), obj.setfont(), obj.mes(), dll. dari AviUtl2 tidak didukung. - x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), dll. dari AviUtl2 tidak didukung. + x obj.rand1(), obj.mes(), obj.setanchor(), dll. dari AviUtl2 tidak didukung. x Fungsi seperti scene.set() dan scene.get() dalam tabel scene AviUtl2 tidak didukung. (Hanya scene.width dan scene.height yang dapat dibaca) - x Akses file (require, dofile, io, dll.) tidak didukung. + x Akses berkas sembarang dari skrip (require, dofile, io, dll.) tidak didukung. + Hanya obj.load("image"/"movie") yang memuat berkas yang dipastikan sebagai + media asli melalui validasi header awal. x Memodifikasi obj.z tercermin dalam render (termasuk dalam ReadBack), tetapi dukungan render 3D terbatas. x Jika batas waktu skrip (5 detik) terlampaui, eksekusi dihentikan paksa. From 7dbe063ac8f00203c40fdccf8365451ebdaf0af7 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 29 Jun 2026 14:52:55 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=A2=E3=83=A9=E3=83=93=E3=82=A2=E8=AA=9E?= =?UTF-8?q?=E3=82=92AviUtl=E4=BA=92=E6=8F=9B=E5=AE=9F=E8=A3=85=E3=81=B8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/docs/LuaScript.ar-sa.txt | 120 ++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 27 deletions(-) diff --git a/LuaScript/docs/LuaScript.ar-sa.txt b/LuaScript/docs/LuaScript.ar-sa.txt index 2be06c4..452b05a 100644 --- a/LuaScript/docs/LuaScript.ar-sa.txt +++ b/LuaScript/docs/LuaScript.ar-sa.txt @@ -315,23 +315,87 @@ مثال: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame) ○ obj.load(الهدف، ...) - يستبدل مخزن الكائن بمحتوى مُولَّد. في هذا الإصدار يُدعم الهدف "figure" فقط. + يستبدل مخزن الكائن بمحتوى مُولَّد. تُدعم الأهداف "figure" و"text" + و"image" (ملف صورة) و"movie" (ملف فيديو). بعد التحميل تُحدَّث + obj.w / obj.h وغيرها إلى الحجم المُولَّد، ويمكن قراءتها بـ getpixel + مباشرة بعد التحميل. يعمل على محرك MoonSharp والمحرك السريع (LuaJIT). + obj.load("figure", name, color, size [, line [, aspect]]) - يُولّد شكلاً ويستبدل مخزن الكائن به - (يُعاد تحجيم الخرج ليطابق الشكل ويُتوسَّط). - name : اسم الشكل. أحد 円 / 四角形 / 三角形 / 五角形 / - 六角形 / 星形 (وتُقبل الأسماء الإنجليزية circle, rect, - triangle, pentagon, hexagon, star). + يُولّد شكلاً ويستبدل المخزن (متوسَّطاً). + name : 円 / 四角形 / 三角形 / 五角形 / 六角形 / 星形 + (وتُقبل الأسماء الإنجليزية circle, rect, triangle, + pentagon, hexagon, star). color : لون التعبئة 0xRRGGBB. size : الحجم الأساسي بالبكسل. - line : عرض الحد (اختياري). الحذف أو 0 يملأ الشكل، - والقيمة المساوية للحجم أو الأكبر منه تملؤه أيضاً. - aspect : التشويه -1.0 ~ 1.0 (اختياري). الموجب يقلّص العرض، - والسالب يقلّص الارتفاع. - مثال: obj.load("figure", "円", 0xff3366, 200) - ※ المُنفَّذ هو obj.load("figure", ...) فقط. الأهداف الأخرى - (ملفات الصور و"text" و"tempbuffer" و"movie" وغيرها) لا تفعل شيئاً. - ※ تُنفَّذ نصوص الرسم على محرك MoonSharp. + line : عرض الحد (اختياري). 0 يملأ الشكل. + aspect : التشويه -1.0 ~ 1.0 (اختياري). + مثال: obj.load("figure", "円", 0xff3366, 200) + + obj.load("text", string) + يرسم النص بالخط والحجم واللون المحددة بـ obj.setfont ويستبدل + المخزن (يُرسم بـ DirectWrite). + مثال: obj.setfont("Yu Gothic UI", 48); obj.load("text", "字幕") + + obj.load("image", path) + يحمّل ملف صورة ويستبدل المخزن. + ※ للأمان يُتحقَّق من الترويسة الأولى، ولا تُحمَّل إلا الصور + الأصلية (PNG / JPEG / GIF / BMP / TIFF / WebP). + مثال: obj.load("image", "C:\\img\\logo.png") + + obj.load("movie", path [, time]) + يحمّل الإطار عند الزمن المحدد من ملف فيديو ويستبدل المخزن + (يُفكَّك بـ Media Foundation). + time : بالثواني. الافتراضي obj.time عند الحذف. + ※ للأمان يُتحقَّق من الترويسة الأولى، ولا تُحمَّل إلا مقاطع + الفيديو الأصلية (MP4 / MOV / MKV / WebM / AVI / FLV / ASF). + مثال: obj.load("movie", "C:\\mov\\clip.mp4", obj.time) + + ○ obj.setfont(font [, size [, style [, color]]]) + يحدد الخط المستخدم في obj.load("text"). + style : أعلام بِتّية. 1=عريض، 2=مائل، 3=عريض+مائل. + color : 0xRRGGBB. + مثال: obj.setfont("Meiryo", 64, 1, 0xffffff) + + ○ obj.draw([ox, oy, oz [, zoom [, alpha [, aspect]]]]) + يدمج صورة الكائن الحالية في مخزن التراكم ويرسمها. + استدعاؤها عدة مرات يرسم نسخاً متراكبة (صور لاحقة، جزيئات، إلخ). + ox, oy, oz : الإزاحة من المركز (افتراضي 0). + zoom : 1.0 هو الحجم الأصلي (افتراضي 1.0). + alpha : 0.0 ~ 1.0 (افتراضي 1.0). + aspect : -1.0 ~ 1.0 (افتراضي 0). + ※ بعد الاستدعاء يُكبَت الرسم القياسي ويُخرَج الناتج المدموج. + + ○ obj.drawpoly(x0,y0,z0, x1,y1,z1, x2,y2,z2, x3,y3,z3 + [, u0,v0, u1,v1, u2,v2, u3,v3 [, alpha]]) + يطبّق صورة الكائن كنسيج على رباعي محدد بأربع رؤوس. + ترتيب الرؤوس: أعلى-يسار، أعلى-يمين، أسفل-يمين، أسفل-يسار. + عند حذف UV تُستخدم الصورة كاملة. + ※ يُسقَط بتحويل أفيني (دقيق لمتوازي الأضلاع، تقريبي لغيره). + + ○ obj.copybuffer(الوجهة، المصدر) + ينسخ صورة بين المخازن، يُحدَّد بالحرف الأول. + "obj" : مخزن صورة الكائن + "tmp" : مخزن مؤقت + "cache:الاسم" : ذاكرة مخبّأة مُسمّاة (تُحفظ بين الإطارات) + مثال: obj.copybuffer("tmp", "obj") -- حفظ + obj.copybuffer("obj", "tmp") -- استعادة + ※ "frm" (مخزن الإطار / الخلفية) لا يمكن الحصول عليه بسبب بنية YMM4. + + ○ obj.getvalue(الهدف) + يحصل على القيمة الحالية لـ obj (مثل obj.x و obj.track0). + الهدف : "x","y","z","ox","oy","rx","ry","rz","zoom","aspect", + "alpha","sx","sy","track0"~"track3","time","frame" إلخ. + المُرجَع : رقم (0 لهدف غير معروف). + + ○ obj.setoption(name, value) / obj.getoption(name) + يضبط / يحصل على خيار. الخيارات غير المدعومة تُقبَل كي لا توقف + النص (getoption يُرجع القيمة المحفوظة، و0 إن لم تُضبط). + الخيارات التي تؤثر على الرسم حالياً: + "antialias" : 0 = أقرب جار، وإلا استيفاء خطّي + (obj.draw / obj.drawpoly). + + ○ obj.pixeloption(name, value) + يحفظ خياراً لعمليات البكسل كحالة. @@ -503,27 +567,29 @@ دالة أرقام عشوائية صحيحة حتمية متوافقة مع AviUtl. انظر "جدول obj - الدوال" للتفاصيل. - ○ رسم الأشكال - obj.load("figure", ...) يُولّد دائرة أو مربعاً أو مثلثاً أو خماسياً أو - سداسياً أو نجمة، ويستبدل مخزن الكائن به. انظر "جدول obj - الدوال" للتفاصيل. + ○ الرسم والتركيب والتحميل + يُدعم الرسم والتركيب عبر obj.draw / obj.drawpoly، وعمليات المخزن + عبر obj.copybuffer، والتوليد والتحميل عبر + obj.load("figure"/"text"/"image"/"movie")، و obj.setfont، و obj.effect، + و obj.getvalue، و obj.setoption / obj.getoption / obj.pixeloption. + انظر "جدول obj - الدوال" للتفاصيل. - تتطلب الميزات التالية التكامل مع خط أنابيب الرسم، لذا فهي خارج نطاق هذه الطبقة. + الميزات التالية خارج نطاق هذه الطبقة. النصوص التي تستدعيها لن تعمل كما هو متوقع. - × الرسم والتركيب (obj.draw / obj.drawpoly)، وأهداف obj.load غير "figure" - (ملفات الصور و"text" و"movie" وغيرها)، وكذلك obj.setfont - × تأثيرات المرشّحات وعمليات المخزن المؤقت - (obj.effect / obj.copybuffer / obj.setoption وما شابه) - × تحميل الوحدات عبر require، والوصول إلى الملفات مثل io + × تحميل الوحدات عبر require، والوصول العشوائي إلى الملفات مثل + io / dofile (تحميل الصور / الفيديو عبر obj.load مدعوم مع التحقق + من الترويسة). + × obj.setanchor، scene.set / scene.get وما شابه. - الميزات غير المدعومة / القيود - - × obj.effect()، obj.draw()، obj.drawpoly() وما شابه من AviUtl2 غير مدعومة (يُدعم obj.load("figure", ...) فقط؛ انظر "التوافق الجزئي مع نصوص AviUtl"). - × obj.rand1()، obj.setfont()، obj.mes() وما شابه من AviUtl2 غير مدعومة. - × obj.setoption()، obj.getoption()، obj.getvalue()، obj.setanchor() وما شابه من AviUtl2 غير مدعومة. + × obj.rand1()، obj.mes()، obj.setanchor() وما شابه من AviUtl2 غير مدعومة. × الدوال مثل scene.set() و scene.get() في جدول scene الخاص بـ AviUtl2 غير مدعومة. (يمكن قراءة scene.width و scene.height فقط) - × الوصول إلى الملفات (require, dofile, io وما شابه) غير مدعوم. + × الوصول العشوائي إلى الملفات من النصوص (require, dofile, io وما شابه) غير مدعوم. + فقط obj.load("image"/"movie") يحمّل الملفات المؤكَّد أنها وسائط أصلية عبر + التحقق من الترويسة الأولى. × تعديل obj.z ينعكس في الرسم (مضمَّن في ReadBack)، لكن دعم الرسم ثلاثي الأبعاد محدود. × إذا تجاوز النص البرمجي مهلة الانتهاء (5 ثوانٍ)، يُنهى التنفيذ قسراً.