Advertisement
Ningow

Stacker

Dec 14th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. function init()
  2.     setName("Stacker")
  3.     setDesc("Stacks 2 images using black as transparency")
  4.     setSize(80,8+24+64)
  5.     addOutput(24+32)
  6.     addInput("",24+32-24)
  7.     addInput("",24+32+24)
  8. end
  9. -- Ugly way to use channels
  10. function apply()
  11.     math.randomseed (getValue(5,0,0,1))
  12.     x = 0
  13.     y = 0
  14.     tileSize = getTileSize()
  15.     for i=0, tileSize*tileSize-1 do
  16.         x = i%tileSize
  17.         y = math.floor(i/tileSize)
  18.         outr, outg, outb = getValue(1,x,y,1)
  19.         a = outr + outg + outb
  20.         --if a > 0 then
  21.             setPixel(0,x,y,outr,outg,outb)
  22.         --end
  23.        
  24.         outr, outg, outb = getValue(0,x,y,1)
  25.         b = outr + outg + outb
  26.         if b > 0 then
  27.             setPixel(0,x,y,outr,outg,outb)
  28.         end
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement