From 56785bd94e36f45ad120c164302b0bf2bf369ca9 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sun, 31 Jan 2010 16:09:40 +0000 Subject: [PATCH] Lua: Added GetBackupColor, to read RGB values from the original palette (Useful if your script modifies the palette then reads pixels from backup) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1290 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- factory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/factory.c b/factory.c index f780618f..2b93b31d 100644 --- a/factory.c +++ b/factory.c @@ -246,6 +246,16 @@ int L_GetColor(lua_State* L) return 3; } +int L_GetBackupColor(lua_State* L) +{ + byte c=lua_tonumber(L,1); + + lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].R); + lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].G); + lua_pushinteger(L, Main_backups->Pages->Next->Palette[c].B); + return 3; +} + int L_MatchColor(lua_State* L) { int c = Best_color_nonexcluded(lua_tonumber(L,1), lua_tonumber(L, 2), lua_tonumber(L, 3)); @@ -349,6 +359,7 @@ void Button_Brush_Factory(void) lua_register(L,"getpicturesize",L_GetPictureSize); lua_register(L,"setcolor",L_SetColor); lua_register(L,"getcolor",L_GetColor); + lua_register(L,"getbackupcolor",L_GetBackupColor); lua_register(L,"matchcolor",L_MatchColor); lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);