mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 09:41:04 +00:00
[lua] Add GraphicsContext:drawImage(image, srcRect, dstRect)
This commit is contained in:
parent
f23adb0b1a
commit
cdab75beed
@ -184,8 +184,14 @@ int GraphicsContext_drawImage(lua_State* L)
|
||||
int dh = lua_tointeger(L, 10);
|
||||
gc->drawImage(img, gfx::Rect(x, y, w, h), gfx::Rect(dx, dy, dw, dh));
|
||||
}
|
||||
else {
|
||||
gc->drawImage(img, x, y);
|
||||
else if (lua_gettop(L) >= 3) {
|
||||
const auto srcRect = may_get_obj<gfx::Rect>(L, 3);
|
||||
const auto dstRect = may_get_obj<gfx::Rect>(L, 4);
|
||||
if (srcRect && dstRect)
|
||||
gc->drawImage(img, *srcRect, *dstRect);
|
||||
else {
|
||||
gc->drawImage(img, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user