summaryrefslogtreecommitdiff
path: root/src/nvg/scissor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvg/scissor.c')
-rw-r--r--src/nvg/scissor.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nvg/scissor.c b/src/nvg/scissor.c
new file mode 100644
index 0000000..7413c46
--- /dev/null
+++ b/src/nvg/scissor.c
@@ -0,0 +1,35 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include <nanovg.h>
+#include <nanovg_gl.h>
+#include "nvg.h"
+
+
+int nvgScissor_bind(lua_State *L)
+{
+ NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
+ float x = luaL_checknumber(L, 2);
+ float y = luaL_checknumber(L, 3);
+ float w = luaL_checknumber(L, 4);
+ float h = luaL_checknumber(L, 5);
+ nvgScissor(*ctx, x, y, w, h);
+ return 0;
+}
+
+int nvgIntersectScissor_bind(lua_State *L)
+{
+ NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
+ float x = luaL_checknumber(L, 2);
+ float y = luaL_checknumber(L, 3);
+ float w = luaL_checknumber(L, 4);
+ float h = luaL_checknumber(L, 5);
+ nvgIntersectScissor(*ctx, x, y, w, h);
+ return 0;
+}
+
+int nvgResetScissor_bind(lua_State *L)
+{
+ NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
+ nvgResetScissor(*ctx);
+ return 0;
+}