v9958screen12_cielab.lua 935 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. xc=8;yc=8;lp2=8;ap2=16;bp2=16 -- lp=32;ap=64;bp=64
  2. lp=255/lp2
  3. ap=255/ap2
  4. bp=255/bp2
  5. function INT(a)
  6. return(a-a%1)
  7. end
  8. for y1=0,height-1,yc do
  9. progress(y1/height)
  10. for x1=0,width-1,xc do
  11. as=0
  12. bs=0
  13. sd=0
  14. for y2=0,yc-1,1 do
  15. for x2=0,xc-1,1 do
  16. x=x1+x2
  17. y=y1+y2
  18. lq,aq,bq=get_lab(x,y)
  19. lr=(lq*255)/100
  20. ar=((100+aq)*255)/200
  21. br=((100+bq)*255)/200
  22. print (lr)
  23. print (ar)
  24. print (br)
  25. as=as+ar
  26. bs=bs+br
  27. sd=sd+1
  28. end;end
  29. af=as/sd
  30. bf=bs/sd
  31. az=(INT(af/ap))*ap
  32. bz=(INT(bf/bp))*bp
  33. for y2=0,yc-1,1 do
  34. for x2=0,xc-1,1 do
  35. x=x1+x2
  36. y=y1+y2
  37. lq,aq,bq=get_lab(x,y)
  38. lr=(lq*255)/100
  39. ar=((100+aq)*255)/200
  40. br=((100+bq)*255)/200
  41. lz=(INT(lr/lp))*lp
  42. set_lab(x,y,(lz*100)/255,((az*200)/255)-100,((bz*200)/255)-100)
  43. end;end;end;end
  44. flush()