-Fixed brush factory : it was unable to draw on the picture !
-Added a script that do a convolution of the image with a matrix. Not sure it works perfect yet. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1252 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
3294a304bf
commit
3b3bb3b2ec
@ -87,8 +87,10 @@ int L_GetPictureSize(lua_State* L)
|
|||||||
|
|
||||||
int L_PutPicturePixel(lua_State* L)
|
int L_PutPicturePixel(lua_State* L)
|
||||||
{
|
{
|
||||||
Pixel_in_current_layer(lua_tonumber(L, 1), lua_tonumber(L, 2),
|
int x = lua_tonumber(L,1);
|
||||||
lua_tonumber(L, 3));
|
int y = lua_tonumber(L,2);
|
||||||
|
int c = lua_tonumber(L,3);
|
||||||
|
Pixel_figure_permanent(x, y, c);
|
||||||
return 0; // no values returned for lua
|
return 0; // no values returned for lua
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +234,7 @@ void Button_Brush_Factory(void)
|
|||||||
if(message)
|
if(message)
|
||||||
Verbose_error_message(message);
|
Verbose_error_message(message);
|
||||||
else
|
else
|
||||||
Warning_message("Unknown error loading script!");
|
Warning_message("Unknown error running script!");
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
|
|||||||
25
scripts/aafilter.lua
Normal file
25
scripts/aafilter.lua
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
-- Get the picture size
|
||||||
|
w, h = getpicturesize();
|
||||||
|
|
||||||
|
-- Here is the filtering matrix
|
||||||
|
matrix = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
|
||||||
|
|
||||||
|
-- Loop trough all the pixels
|
||||||
|
-- To make this script simpler we don't handle the picture borders
|
||||||
|
-- (the matrix would get pixels outside the picture space)
|
||||||
|
-- for var = start_value, end_value, step do ...
|
||||||
|
for y = 1, h - 2, 1 do
|
||||||
|
for x = 1, w - 2, 1 do
|
||||||
|
filtered =
|
||||||
|
matrix[1][1] * getpicturepixel(x - 1, y - 1) +
|
||||||
|
matrix[1][2] * getpicturepixel(x , y - 1) +
|
||||||
|
matrix[1][3] * getpicturepixel(x + 1, y - 1) +
|
||||||
|
matrix[2][1] * getpicturepixel(x - 1, y ) +
|
||||||
|
matrix[2][2] * getpicturepixel(x , y ) +
|
||||||
|
matrix[2][3] * getpicturepixel(x + 1, y ) +
|
||||||
|
matrix[3][1] * getpicturepixel(x - 1, y + 1) +
|
||||||
|
matrix[3][2] * getpicturepixel(x , y + 1) +
|
||||||
|
matrix[3][3] * getpicturepixel(x + 1, y + 1);
|
||||||
|
putpicturepixel(x,y,filtered);
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user