ordered-dither.k 189 B

12345678910
  1. sh:-1_#'*:\
  2. B:(0 2;3 1)
  3. mtx:{(*/(x+1)#4;x{,/,'/'x+\:\:4*y}[B]/B)} / (factor;Bayer matrix)
  4. dth:{(f;m):x;(h;w):sh y;((h#w#/:m)%f)>y}
  5. /
  6. [[https://en.wikipedia.org/wiki/Ordered_dithering]]