1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
#include <lua.h>
#include <lauxlib.h>
#include <nanovg.h>
#include <nanovg_gl.h>
#include "nvg.h"
/* --===== paths =====-- */
int nvgBeginPath_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
nvgBeginPath(*ctx);
return 0;
}
int nvgMoveTo_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float x = luaL_checknumber(L, 2);
float y = luaL_checknumber(L, 3);
nvgMoveTo(*ctx, x, y);
return 0;
}
int nvgLineTo_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float x = luaL_checknumber(L, 2);
float y = luaL_checknumber(L, 3);
nvgLineTo(*ctx, x, y);
return 0;
}
int nvgBezierTo_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float c1x = luaL_checknumber(L, 2);
float c1y = luaL_checknumber(L, 3);
float c2x = luaL_checknumber(L, 4);
float c2y = luaL_checknumber(L, 5);
float x = luaL_checknumber(L, 6);
float y = luaL_checknumber(L, 7);
nvgBezierTo(*ctx, c1x, c1y, c2x, c2y, x, y);
return 0;
}
int nvgQuadTo_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float cx = luaL_checknumber(L, 2);
float cy = luaL_checknumber(L, 3);
float x = luaL_checknumber(L, 4);
float y = luaL_checknumber(L, 5);
nvgQuadTo(*ctx, cx, cy, x, y);
return 0;
}
int nvgArcTo_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float x1 = luaL_checknumber(L, 2);
float y1 = luaL_checknumber(L, 3);
float x2 = luaL_checknumber(L, 4);
float y2 = luaL_checknumber(L, 5);
float radius = luaL_checknumber(L, 6);
nvgArcTo(*ctx, x1, y1, x2, y2, radius);
return 0;
}
int nvgClosePath_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
nvgClosePath(*ctx);
return 0;
}
int nvgPathWinding_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
int dir = luaL_checkinteger(L, 2);
nvgPathWinding(*ctx, dir);
return 0;
}
int nvgArc_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float cx = luaL_checknumber(L, 2);
float cy = luaL_checknumber(L, 3);
float r = luaL_checknumber(L, 4);
float a0 = luaL_checknumber(L, 5);
float a1 = luaL_checknumber(L, 6);
int dir = luaL_checkinteger(L, 7);
nvgArc(*ctx, cx, cy, r, a0, a1, dir);
return 0;
}
int nvgRect_bind(lua_State *L)
{
struct 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);
nvgRect(*ctx, x, y, w, h);
return 0;
}
int nvgRoundedRect_bind(lua_State *L)
{
struct 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);
float r = luaL_checknumber(L, 6);
nvgRoundedRect(*ctx, x, y, w, h, r);
return 0;
}
int nvgRoundedRectVarying_bind(lua_State *L)
{
struct 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);
float rtl = luaL_checknumber(L, 6);
float rtr = luaL_checknumber(L, 7);
float rbl = luaL_checknumber(L, 8);
float rbr = luaL_checknumber(L, 9);
nvgRoundedRectVarying(*ctx, x, y, w, h, rtl, rtr, rbl, rbr);
return 0;
}
int nvgEllipse_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float cx = luaL_checknumber(L, 2);
float cy = luaL_checknumber(L, 3);
float rx = luaL_checknumber(L, 4);
float ry = luaL_checknumber(L, 5);
nvgEllipse(*ctx, cx, cy, rx, ry);
return 0;
}
int nvgCircle_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
float cx = luaL_checknumber(L, 2);
float cy = luaL_checknumber(L, 3);
float r = luaL_checknumber(L, 4);
nvgCircle(*ctx, cx, cy, r);
return 0;
}
int nvgFill_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
nvgFill(*ctx);
return 0;
}
int nvgStroke_bind(lua_State *L)
{
struct NVGcontext **ctx = luaL_checkudata(L, 1, nvg_ctx_tname);
nvgStroke(*ctx);
return 0;
}
|