mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 21:26:26 +01:00
move color_to_rgba to LuaAPI for consistency
This commit is contained in:
parent
c40ccd5aae
commit
4755c703f4
3 changed files with 43 additions and 0 deletions
|
|
@ -502,6 +502,32 @@ ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L)
|
|||
return 4;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::LuaAPI::color_to_rgba (lua_State *L)
|
||||
{
|
||||
int top = lua_gettop (L);
|
||||
if (top < 1) {
|
||||
return luaL_argerror (L, 1, "invalid number of arguments, color_to_rgba (uint32_t)");
|
||||
}
|
||||
uint32_t color = luabridge::Stack<uint32_t>::get (L, 1);
|
||||
double r, g, b, a;
|
||||
|
||||
/* libardour is no user of libcanvas, otherwise
|
||||
* we could just call
|
||||
* ArdourCanvas::color_to_rgba (color, r, g, b, a);
|
||||
*/
|
||||
r = ((color >> 24) & 0xff) / 255.0;
|
||||
g = ((color >> 16) & 0xff) / 255.0;
|
||||
b = ((color >> 8) & 0xff) / 255.0;
|
||||
a = ((color >> 0) & 0xff) / 255.0;
|
||||
|
||||
luabridge::Stack <double>::push (L, r);
|
||||
luabridge::Stack <double>::push (L, g);
|
||||
luabridge::Stack <double>::push (L, b);
|
||||
luabridge::Stack <double>::push (L, a);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::LuaAPI::build_filename (lua_State *L)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue