Guest User

XCompose

a guest
May 9th, 2020
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function init()
  2.     setName("XCompose")
  3.     setDesc("Simple 90 Rotations")
  4.     setSize(100,32+64+64+18+24+64+8+8+7+4)
  5.     addOutput(24+32)
  6.     addOutput(64+24+32)
  7.     addOutput(64+64+24+32)
  8.     addOutput(64+64+64+24+32)
  9.     addInput("R",24+32)
  10.     addInput("G",64+24+32)
  11.     addInput("B",64+64+24+32)
  12.     addInput("C",64+64+64+24+32)
  13. end
  14. -- Ugly way to use channels
  15. function apply()
  16.     isR, isG, isB = 0
  17.     x = 0
  18.     y = 0
  19.     tileSize = getTileSize()
  20.     for i=0, tileSize*tileSize-1 do
  21.         x = i%tileSize
  22.         y = math.floor(i/tileSize)
  23.         if (getValue(0,x,y,1)>0) then
  24.             isR = 1;
  25.             break
  26.         end
  27.     end
  28.     for i=0, tileSize*tileSize-1 do
  29.         x = i%tileSize
  30.         y = math.floor(i/tileSize)
  31.         if (getValue(1,x,y,1)>0) then
  32.             isG = 1;
  33.             break
  34.         end
  35.     end
  36.     for i=0, tileSize*tileSize-1 do
  37.         x = i%tileSize
  38.         y = math.floor(i/tileSize)
  39.         if (getValue(2,x,y,1)>0) then
  40.             isB = 1;
  41.             break
  42.         end
  43.     end
  44.     for i=0, tileSize*tileSize-1 do
  45.         x = i%tileSize
  46.         y = math.floor(i/tileSize)
  47.         outr,outg,outb = getValue(3,x,y,1)
  48.         if (isR == 1) then
  49.             outr = getValue(0,x,y,1)
  50.         end
  51.         if (isG == 1) then
  52.             outg = getValue(1,x,y,1)
  53.         end
  54.         if (isB == 1) then
  55.             outb = getValue(2,x,y,1)
  56.         end
  57.         setPixel(0,x,y,outr,outr,outr)
  58.         setPixel(1,x,y,outg,outg,outg)
  59.         setPixel(2,x,y,outb,outb,outb)
  60.         setPixel(3,x,y,outr,outg,outb)
  61.     end
  62. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×