ref: d4e9ed1e23f08ffc95abc4143c3af6713f67bf69
parent: a149216460c3b1c809bab5eb461375e6a036012c
author: phil9 <telephil9@gmail.com>
date: Thu Dec 1 13:49:56 EST 2022
simplify color api
--- a/a.h
+++ b/a.h
@@ -16,7 +16,6 @@
void registerapi(lua_State*);
Image* color(int, int, int);
-Image* grayscale(int);
extern int drawing;
extern Image *canvas;
--- a/api.c
+++ b/api.c
@@ -63,17 +63,18 @@
c = lua_gettop(L);
if(c == 1){
- g = luaL_checkinteger(L, 1);
- i = grayscale(g);
+ r = luaL_checkinteger(L, 1);
+ g = r;
+ b = r;
}else if(c == 3){
r = luaL_checkinteger(L, 1);
g = luaL_checkinteger(L, 2);
b = luaL_checkinteger(L, 3);
- i = color(r, g, b);
}else{
fprint(2, "invalid color request\n");
return nil;
}
+ i = color(r, g, b);
return i;
}
--- a/color.c
+++ b/color.c
@@ -48,9 +48,3 @@
return c;
}
-Image*
-grayscale(int n)
-{
- return color(n, n, n);
-}
-