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
This commit is contained in:
Yves Rizoud 2010-01-31 16:09:40 +00:00
parent fa15037a42
commit 56785bd94e

View File

@ -246,6 +246,16 @@ int L_GetColor(lua_State* L)
return 3; 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 L_MatchColor(lua_State* L)
{ {
int c = Best_color_nonexcluded(lua_tonumber(L,1), lua_tonumber(L, 2), lua_tonumber(L, 3)); 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,"getpicturesize",L_GetPictureSize);
lua_register(L,"setcolor",L_SetColor); lua_register(L,"setcolor",L_SetColor);
lua_register(L,"getcolor",L_GetColor); lua_register(L,"getcolor",L_GetColor);
lua_register(L,"getbackupcolor",L_GetBackupColor);
lua_register(L,"matchcolor",L_MatchColor); lua_register(L,"matchcolor",L_MatchColor);
lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor); lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);