shithub: slug

Download patch

ref: b1fa4d619f1ffab63ffa774489900192bf17996a
parent: 50d825d128cdfbf499069b554ce9761fa11fa999
author: phil9 <telephil9@gmail.com>
date: Fri Dec 2 11:27:50 EST 2022

fix units on strokeWeight() and circle()/ellipse()

	in order to be compatible with Processing, strokeWeight() is thinner
	circle() and ellipse() parameters are diameters and not radius so they need to be divided by 2

--- a/api.c
+++ b/api.c
@@ -62,7 +62,7 @@
 	nostroke = 0;
 	strokecap = Endsquare;
 	stroke = display->black;
-	strokeweight = 1;
+	strokeweight = 0;
 	nofill = 0;
 	fill = display->white;
 	origin = ZP;
@@ -240,7 +240,7 @@
 	int n;
 
 	n = luaL_checkinteger(L, 1);
-	strokeweight = n;
+	strokeweight = n/2;
 	return 0;
 }
 
@@ -330,7 +330,7 @@
 
 	x = luaL_checkinteger(L, 1);
 	y = luaL_checkinteger(L, 2);
-	a = luaL_checkinteger(L, 3);
+	a = luaL_checkinteger(L, 3) / 2;
 	p = canvaspt(x, y);
 	if(!nofill)
 		fillellipse(canvas, p, a, a, fill, ZP);
@@ -347,8 +347,8 @@
 
 	x = luaL_checkinteger(L, 1);
 	y = luaL_checkinteger(L, 2);
-	a = luaL_checkinteger(L, 3);
-	b = luaL_checkinteger(L, 4);
+	a = luaL_checkinteger(L, 3) / 2;
+	b = luaL_checkinteger(L, 4) / 2;
 	p = canvaspt(x, y);
 	if(!nofill)
 		fillellipse(canvas, p, a, b, fill, ZP);