spritestoandorshapes.lua 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. COPY(0,0,width,height/2,0,height/2)
  22. flush()
  23. for y=0,(height/2)-1,1 do
  24. for x=0,width-1,1 do
  25. r0,g0,b0=get_rgb(x,y)
  26. set_rgb(x,y,0,0,0)
  27. if r0>(240/255) and g0<(15/255) and b0>(240/255) then
  28. set_rgb(x,y,1,1,1)
  29. end
  30. end
  31. progress(y/height)
  32. end
  33. flush()
  34. for y=(height/2),height-1,1 do
  35. for x=0,width-1,1 do
  36. r0,g0,b0=get_rgb(x,y)
  37. -- set_rgb(x,y,0,0,0)
  38. if r0>(240/255) and g0<(15/255) and b0>(240/255) then
  39. set_rgb(x,y,0,0,0)
  40. end
  41. end
  42. progress(y/height)
  43. end
  44. flush()