[lua] Add GraphicsContext:oval() function

This commit is contained in:
David Capello 2023-03-23 14:56:01 -03:00
parent 44729b27a7
commit 53c851c547
3 changed files with 13 additions and 1 deletions

2
laf

@ -1 +1 @@
Subproject commit f59032bfcfbccedc107006ddca814f46ef0eb27f
Subproject commit 511de99c370eb7bfd8cfdb1307dbef3bb2557c0d

View File

@ -306,6 +306,14 @@ int GraphicsContext_cubicTo(lua_State* L)
return 1;
}
int GraphicsContext_oval(lua_State* L)
{
auto gc = get_obj<GraphicsContext>(L, 1);
const gfx::Rect rc = convert_args_into_rect(L, 2);
gc->oval(rc);
return 0;
}
int GraphicsContext_rect(lua_State* L)
{
auto gc = get_obj<GraphicsContext>(L, 1);
@ -447,6 +455,7 @@ const luaL_Reg GraphicsContext_methods[] = {
{ "moveTo", GraphicsContext_moveTo },
{ "lineTo", GraphicsContext_lineTo },
{ "cubicTo", GraphicsContext_cubicTo },
{ "oval", GraphicsContext_oval },
{ "rect", GraphicsContext_rect },
{ "roundedRect", GraphicsContext_roundedRect },
{ "stroke", GraphicsContext_stroke },

View File

@ -102,6 +102,9 @@ public:
void cubicTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) {
m_path.cubicTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
void oval(const gfx::Rect& rc) {
m_path.oval(rc);
}
void rect(const gfx::Rect& rc) {
m_path.rect(rc);
}