tiles256x64to128x128.lua 699 B

1234567891011121314151617181920212223242526272829303132
  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=(height/16)-1,1,-1 do
  22. COPY(0,y1*8+0,255,y1*8+7,0,y1*16+0)
  23. BAR(0,y1*8+0,255,y1*8+7,0xFFFFFF)
  24. end
  25. flush()
  26. for y1=(height/16)-1,0,-1 do
  27. COPY(128,y1*16,255,y1*16+7,0,y1*16+8)
  28. BAR(128,y1*16,255,y1*16+7,0xFFFFFF)
  29. end
  30. flush()