diff options
author | sanine-a <sanine.not@pm.me> | 2020-12-19 01:16:29 -0600 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-12-19 01:16:29 -0600 |
commit | 34603bb6d538ab1b0edbe10feeef27b80b1b7f7a (patch) | |
tree | 44c53074c732ce69f479d40eceb865fb6843b885 /src | |
parent | 86e562d59eb26f305cb183d29b82123f944dd328 (diff) |
add curveTo function
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo_bindings.c | 19 | ||||
-rw-r--r-- | src/cairo_bindings.h | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/cairo_bindings.c b/src/cairo_bindings.c index 3b7bacb..3a4893b 100644 --- a/src/cairo_bindings.c +++ b/src/cairo_bindings.c @@ -9,7 +9,7 @@ int honey_setup_cairo(lua_State* L) { honey_lua_create_table (L, 2, - HONEY_TABLE, "__index", 17, + HONEY_TABLE, "__index", 18, HONEY_FUNCTION, "getTexture", honey_cairo_get_texture, HONEY_FUNCTION, "updateTexture", honey_cairo_update_texture, @@ -28,6 +28,7 @@ int honey_setup_cairo(lua_State* L) /* drawing functions */ HONEY_FUNCTION, "moveTo", honey_cairo_move_to, HONEY_FUNCTION, "lineTo", honey_cairo_line_to, + HONEY_FUNCTION, "curveTo", honey_cairo_curve_to, HONEY_FUNCTION, "arc", honey_cairo_arc, HONEY_FUNCTION, "stroke", honey_cairo_stroke, HONEY_FUNCTION, "fill", honey_cairo_fill, @@ -431,6 +432,22 @@ int honey_cairo_line_to(lua_State* L) /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +int honey_cairo_curve_to(lua_State* L) +{ + cairo_t** cr; + float x1, y1, x2, y2, x3, y3; + honey_lua_parse_arguments + (L, 1, 7, HONEY_USERDATA, &cr, + HONEY_NUMBER, x1, HONEY_NUMBER, y1, + HONEY_NUMBER, x2, HONEY_NUMBER, y2, + HONEY_NUMBER, x3, HONEY_NUMBER, y3); + + cairo_curve_to(*cr, x1, y1, x2, y2, x3, y3); + return 0; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + int honey_cairo_arc(lua_State* L) { cairo_t** cr; diff --git a/src/cairo_bindings.h b/src/cairo_bindings.h index b2eaa69..8f23bb6 100644 --- a/src/cairo_bindings.h +++ b/src/cairo_bindings.h @@ -48,6 +48,8 @@ int honey_cairo_move_to(lua_State* L); int honey_cairo_line_to(lua_State* L); +int honey_cairo_curve_to(lua_State* L); + int honey_cairo_arc(lua_State* L); int honey_cairo_stroke(lua_State* L); |