sharpen.lua
function init()
setName("Sharpen")
setDesc("Sharpen texture")
setSize(80,24+64+8+8+7+4+18)
addOutput(24+32)
addInput("Texture",24+64+8+8)
addParameter("Intensity","Intensity",24+64+8+8+18,1,1,5)
end
-- Ugly way to use channels
function apply()
tileSize = getTileSize()
inte = getValue(1,0,0,1)
for i=0, tileSize*tileSize-1 do
x = i%tileSize
y = math.floor(i/tileSize)
cr, cg, cb = getValue(0, x, y, 1.0)
cr=cr*5*inte
cg=cg*5*inte
cb=cb*5*inte
crL, cgL, cbL = getValue(0,x-1,y,1.0)
crR, cgR, cbR = getValue(0,x+1,y,1.0)
crU, cgU, cbU = getValue(0,x,y-1,1.0)
crD, cgD, cbD = getValue(0,x,y+1,1.0)
cr = cr-((crL+crR+crU+crD)*inte)
cg = cg-((cgL+cgR+cgU+cgD)*inte)
cb = cb-((cbL+cbR+cbU+cbD)*inte)
setPixel(0,x,y,cr,cg,cb)
end
end
sine.lua
function init()
setName("Sine")
setDesc("Puts texture into sin(x)")
setSize(80,24+64+8+8+7+4+18+18)
addOutput(24+32)
addInput("Texture",24+64+8+8)
addParameter("Freq","Frequency",24+64+8+8+18,1,1,50)
addParameter("Positive","Absolute number",24+64+8+8+18+18,1,0,1)
end
function apply()
tileSize = getTileSize()
pos = getValue(2,0,0,1)
for i=0, tileSize*tileSize-1 do
x = i%tileSize
y = math.floor(i/tileSize)
cr, cg, cb = getValue(0, x, y, 1.0)
setPixel(0,x,y,(math.sin(cr*freq)+pos)/(pos+1),(math.sin(cg*freq)+pos)/(pos+1),(math.sin(cb*freq)+pos)/(pos+1))
end
end
