From a35b7c1be57036a4a10c04e6fc2f8ecd872e56b6 Mon Sep 17 00:00:00 2001 From: "Raimon @ quifisraimon" Date: Tue, 13 Oct 2026 10:23:02 +0200 Subject: [PATCH] =?UTF-8?q?VERSI=C3=93:=201.6.0:=20-=20[NEW]=20pal.mask()?= =?UTF-8?q?=20i=20pal.lut(),=20per=20a=20tocaments=20de=20paleta=20avan?= =?UTF-8?q?=C3=A7ats.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/mini/lua/lua.wrappers.cpp | 27 +++++++++++++++++++++++++++ source/mini/pal/pal.cpp | 24 ++++++++++++++++++++++++ source/mini/pal/pal.h | 4 ++++ source/mini/version.h | 2 +- vscode/library.lua | 12 ++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) diff --git a/source/mini/lua/lua.wrappers.cpp b/source/mini/lua/lua.wrappers.cpp index a30d9f2..c9671cf 100644 --- a/source/mini/lua/lua.wrappers.cpp +++ b/source/mini/lua/lua.wrappers.cpp @@ -396,6 +396,31 @@ namespace mini } return 0; } + + static int lut(lua_State *L) { + const int index = luaL_checkinteger(L, 1); + if (index<0 || index>255) return 0; + + uint8_t tabla[256]; + for (int i = 0; i < 256; ++i) tabla[i] = i; + + if (!lua_isnil(L, 2) && lua_gettop(L) >= 2) { + luaL_checktype(L, 2, LUA_TTABLE); + const int len = std::min(256, (int)lua_rawlen(L, 2)); + for (int i=0;i @@ -81,5 +82,28 @@ namespace mini for (int i=0;i<256;++i) draw::state.draw_palette[i]=i; } } + + namespace mask { + uint8_t tables[256][256]; + + void apply() { + surf::surface_t& source = surf::state.surfaces[surf::state.source_surface]; + surf::surface_t& dest = surf::state.surfaces[surf::state.dest_surface]; + + const int width = source.w < dest.w ? source.w : dest.w; + const int height = source.h < dest.h ? source.h : dest.h; + + for (int y=0; y