Advertisement
Guest User

clust01.lua

a guest
Jul 11th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. w,h=getpicturesize()
  2. ok,op1,op2,op3,op4,op5=inputbox("primary-clusters",
  3.       "cluster 1",1,0,1,-1,"cluster 2",0,0,1,-1,"cluster 3",0,0,1,-1,"cluster 4",0,0,1,-1,"cluster 5",0,0,1,-1);
  4. if ok==true then
  5.   if op1==1 then
  6.     ampl=4;clust={};clust[0+1]={0,1,2,3};clust[1+1]={2,3,0,1};clust[2+1]={0,1,2,3};clust[3+1]={2,3,0,1}
  7.     end
  8.   if op2==1 then
  9.     ampl=4;clust={};clust[0+1]={0,2,0,2};clust[1+1]={1,3,1,3};clust[2+1]={2,0,2,0};clust[3+1]={3,1,3,1}
  10.     end
  11.   if op3==1 then
  12.     ampl=6;clust={};clust[0+1]={2,4,2,4};clust[1+1]={4,2,4,2};clust[2+1]={2,4,2,4};clust[3+1]={4,2,4,2}
  13.     end
  14.   if op4==1 then
  15.     ampl=16;clust={};clust[0+1]={00,12,03,15};clust[1+1]={08,04,11,07};clust[2+1]={02,14,01,13};clust[3+1]={10,06,09,05}
  16.     end
  17.   if op5==1 then
  18.     ampl=16;clust={};clust[0+1]={00,06,08,14};clust[1+1]={02,12,04,10};clust[2+1]={08,14,00,06};clust[3+1]={04,10,02,12}
  19.     end
  20.   for y=0,h-1,1 do
  21.     for x=0,w-1,1 do
  22.       c=getpicturepixel(x,y)
  23.       r,g,b=getcolor(c)
  24.       patgf=math.floor(((clust[x%4+1][y%4+1])*255)/ampl)
  25.       c2=0
  26.       if b>patgf then c2=c2+1;end
  27.       if r>patgf then c2=c2+2;end
  28.       if g>patgf then c2=c2+4;end
  29.       putpicturepixel(x,y,c2)
  30.       end;end
  31.   for c=0,255,1 do setcolor(c,0,0,0);end
  32.   setcolor(1,0x00,0x00,0xFF);setcolor(2,0xFF,0x00,0x00);setcolor(3,0xFF,0x00,0xFF)
  33.   setcolor(4,0x00,0xFF,0x00);setcolor(5,0x00,0xFF,0xFF);setcolor(6,0xFF,0xFF,0x00)
  34.   setcolor(7,0xFF,0xFF,0xFF)
  35.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement