mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
lua: Add Color.rgbaPixel and .grayPixel
This commit is contained in:
parent
98080544cf
commit
1f7f5415cd
@ -288,6 +288,24 @@ int Color_get_index(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Color_get_rgbaPixel(lua_State* L)
|
||||
{
|
||||
auto color = get_obj<app::Color>(L, 1);
|
||||
auto pixelColor = color_utils::color_for_target_mask(
|
||||
*color, ColorTarget(ColorTarget::TransparentLayer, IMAGE_RGB, 0));
|
||||
lua_pushinteger(L, pixelColor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Color_get_grayPixel(lua_State* L)
|
||||
{
|
||||
auto color = get_obj<app::Color>(L, 1);
|
||||
auto pixelColor = color_utils::color_for_target_mask(
|
||||
*color, ColorTarget(ColorTarget::TransparentLayer, IMAGE_GRAYSCALE, 0));
|
||||
lua_pushinteger(L, pixelColor);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Color_set_red(lua_State* L)
|
||||
{
|
||||
auto color = get_obj<app::Color>(L, 1);
|
||||
@ -441,6 +459,8 @@ const Property Color_properties[] = {
|
||||
{ "lightness", Color_get_hslLightness, Color_set_hslLightness },
|
||||
{ "index", Color_get_index, Color_set_index },
|
||||
{ "gray", Color_get_gray, Color_set_gray },
|
||||
{ "rgbaPixel", Color_get_rgbaPixel, nullptr },
|
||||
{ "grayPixel", Color_get_grayPixel, nullptr },
|
||||
{ nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user