shithub: slug

Download patch

ref: bb6cf18bf2918149d80e8649a046bb2255c0afc8
parent: 738012524b8f90c8e824b2d5ee965cd22a0ac8ed
author: phil9 <telephil9@gmail.com>
date: Wed Nov 30 16:48:47 EST 2022

implement point()

--- a/api.c
+++ b/api.c
@@ -135,6 +135,21 @@
 }
 
 int
+cpoint(lua_State *L)
+{
+	Point p1, p2;
+	int x, y;
+
+	x = luaL_checkinteger(L, 1);
+	y = luaL_checkinteger(L, 2);
+	p1 = addpt(origin, Pt(x, y));
+	p2 = addpt(p1, Pt(strokewidth, strokewidth));
+	if(!nostroke)
+		draw(canvas, Rpt(p1, p2), stroke, nil, ZP);
+	return 0;
+}
+
+int
 cline(lua_State *L)
 {
 	Point p1, p2;
@@ -297,6 +312,7 @@
 	registerfunc(L, "strokeWidth", cstrokewidth);
 	registerfunc(L, "noFill", cnofill);
 	registerfunc(L, "fill", cfill);
+	registerfunc(L, "point", cpoint);
 	registerfunc(L, "line", cline);
 	registerfunc(L, "square", csquare);
 	registerfunc(L, "rect", crect);