Lua: added 'matchcolor2' that uses DawnBringer's perceptual formula. Updated scripts numbering to 2.4

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1797 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2011-06-12 19:03:14 +00:00
parent 17ce3a602b
commit 2f3e1e3294
40 changed files with 47 additions and 30 deletions

View File

@@ -690,6 +690,22 @@ int L_MatchColor(lua_State* L)
return 1;
}
int L_MatchColor2(lua_State* L)
{
double r, g, b;
int c;
int nb_args=lua_gettop(L);
LUA_ARG_LIMIT (3, "matchcolor2");
LUA_ARG_NUMBER(1, "matchcolor2", r, -DBL_MAX, DBL_MAX);
LUA_ARG_NUMBER(2, "matchcolor2", g, -DBL_MAX, DBL_MAX);
LUA_ARG_NUMBER(3, "matchcolor2", b, -DBL_MAX, DBL_MAX);
c = Best_color_perceptual(clamp_byte(r),clamp_byte(g),clamp_byte(b));
lua_pushinteger(L, c);
return 1;
}
int L_GetForeColor(lua_State* L)
{
lua_pushinteger(L, Fore_color);
@@ -1506,6 +1522,7 @@ void Run_script(const char *script_subdirectory, const char *script_filename)
lua_register(L,"gettranscolor",L_GetTransColor);
lua_register(L,"matchcolor",L_MatchColor);
lua_register(L,"matchcolor2",L_MatchColor2);
// ui
lua_register(L,"inputbox",L_InputBox);