Fix really stupid parameter-related bug in box blur, and update documentation.

Originally committed to SVN as r1480.
This commit is contained in:
Niels Martin Hansen 2007-08-12 23:21:45 +00:00
parent c55dea23aa
commit c68a782820
2 changed files with 4 additions and 6 deletions

View File

@ -143,11 +143,9 @@ raster.gaussian_blur(surface, sigma)
Applies a strength sigma gaussian blur on the surface. Applies a strength sigma gaussian blur on the surface.
raster.box3(surface, repetitions) raster.box(surface, size, repetitions)
raster.box5(sutface, repetitions)
raster.box15(surface, repetitions)
Applies a box filter (blur) of various sizes to the surface as many times as Applies a box filter (blur) of variable size to the surface as many times as
specified. Please note that no specific optimisation is done for applying specified. Please note that no specific optimisation is done for applying
box filters over more general filters and using box blur over gaussian blur box filters over more general filters and using box blur over gaussian blur
is probably no faster and might even be slower. is probably no faster and might even be slower.

View File

@ -329,9 +329,9 @@ static int gaussian_blur(lua_State *L)
static int box_blur(lua_State *L) static int box_blur(lua_State *L)
{ {
LuaCairoSurface *surfobj = LuaCairoSurface::GetObjPointer(L, 1); LuaCairoSurface *surfobj = LuaCairoSurface::GetObjPointer(L, 1);
int width = luaL_checkint(L, 1); int width = luaL_checkint(L, 2);
if (width <= 0) { luaL_error(L, "Width of box kernel for raster.box must be larger than zero, specified to %d.", width); return 0; } if (width <= 0) { luaL_error(L, "Width of box kernel for raster.box must be larger than zero, specified to %d.", width); return 0; }
int applications = luaL_optint(L, 1, 1); int applications = luaL_optint(L, 3, 1);
int *kernel = new int[width]; int *kernel = new int[width];
for (int i = 0; i < width; i++) for (int i = 0; i < width; i++)
kernel[i] = 1; kernel[i] = 1;