tiles128x128to256x64.lua 713 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --enlarge canvas size first
  2. function INT(a)
  3. return(a-a%1)
  4. end
  5. function BAR(tx1,ty1,tx2,ty2,tcl)
  6. tr1=(INT(tcl/65536))%256
  7. tg1=(INT(tcl/256))%256
  8. tb1=tcl%256
  9. for tx3=tx1,tx2,1 do
  10. for ty3=ty1,ty2,1 do
  11. set_rgb(tx3,ty3,tr1/255,tg1/255,tb1/255)
  12. end;end
  13. end
  14. function COPY(tx1,ty1,tx2,ty2,tx3,ty3)
  15. for ty4=ty1,ty2,1 do
  16. for tx4=tx1,tx2,1 do
  17. r,g,b=get_rgb(tx4,ty4)
  18. set_rgb(tx3+tx4-tx1,ty3+ty4-ty1,r,g,b)
  19. end;end
  20. end
  21. for y1=0,(height/16)-1,1 do
  22. COPY(0,y1*16+8,127,y1*16+15,128,y1*16)
  23. BAR(0,y1*16+8,127,y1*16+15,0xFFFFFF)
  24. end
  25. flush()
  26. for y1=1,(height/16)-1,1 do
  27. COPY(0,y1*16+0,255,y1*16+7,0,y1*8+0)
  28. BAR(0,y1*16+0,255,y1*16+7,0xFFFFFF)
  29. end
  30. flush()