Render a graphical pattern where each pixel is colored by the value of 'x xor y' from an arbitrary color table.

link printf
 
procedure main(A)   #: XOR graphic
   wsize := 512
   cmax  := 32768
   wparms := ["Xmas Xor Graphic","g",sprintf("size=%d,%d",wsize),"bg=black"]
   &window := open!wparms | stop("Unable to open window")
 
   every y := 0 to wsize - 1 do
      every x := 0 to wsize - 1 do {
         c := cmax/wsize * iand(wsize-1,ixor(x,y))
         Fg(sprintf("%d,%d,%d",c,cmax-c,0))
         DrawPoint(x,y)
         }
 
  until Event() == &lpress     # wait for left button to quit
  close(&window)
end