From 030695e0dbf62c06f5d497c3dd2e3341f297de58 Mon Sep 17 00:00:00 2001 From: rxi Date: Mon, 26 Sep 2016 20:33:26 +0100 Subject: [PATCH] Removed Image:mapPixel(), updated doc/api.md --- doc/api.md | 5 ----- src/image.c | 20 -------------------- 2 files changed, 25 deletions(-) diff --git a/doc/api.md b/doc/api.md index 8960dc3..7784e0f 100644 --- a/doc/api.md +++ b/doc/api.md @@ -220,11 +220,6 @@ position is outside of the image then 0 is returned. Sets the pixel of the image at the position `x`, `y` to `color`. If the position is outside of the image then no change is made. -##### Image:mapPixel(fn) -Takes the function `fn` which is called for each pixel of the image and is -given the arguments `x`, `y` and `color`: The position of the current pixel and -its color. Each pixel will be set to the color returned by this function. - ### Quad A rectangle used to represent the clipping region of an image when drawing. diff --git a/src/image.c b/src/image.c index 0d3b35b..5643621 100644 --- a/src/image.c +++ b/src/image.c @@ -301,25 +301,6 @@ int l_image_setPixel(lua_State *L) { } -int l_image_mapPixel(lua_State *L) { - image_t *self = luaobj_checkudata(L, 1, CLASS_TYPE); - luaL_argcheck(L, lua_isfunction(L, 2), 2, "expected function"); - int y, x; - for (y = 0; y < self->height; y++) { - for (x = 0; x < self->width; x++) { - lua_pushvalue(L, 2); - lua_pushinteger(L, x); - lua_pushinteger(L, y); - lua_pushinteger(L, self->data[x + y * self->width]); - lua_call(L, 3, 1); - self->data[x + y * self->width] = lua_tointeger(L, -1); - lua_pop(L, 1); - } - } - return 0; -} - - int luaopen_image(lua_State *L) { luaL_Reg reg[] = { { "new", l_image_new }, @@ -329,7 +310,6 @@ int luaopen_image(lua_State *L) { { "getHeight", l_image_getHeight }, { "getPixel", l_image_getPixel }, { "setPixel", l_image_setPixel }, - { "mapPixel", l_image_mapPixel }, { 0, 0 }, }; luaobj_newclass(L, CLASS_NAME, NULL, l_image_new, reg);