Created
July 22, 2011 19:49
-
-
Save pcomans/1100269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn xors | |
"Returns bitwise XORs" | |
[max-x max-y] | |
(for [x (range max-x) | |
y (range max-y)] | |
[x y (bit-xor x y)])) | |
(def frame (java.awt.Frame.)) | |
(.setVisible frame true) | |
(.setSize frame (java.awt.Dimension. 512 512)) | |
(def gfx (.getGraphics frame)) | |
(doseq [[x y xor] (xors 512 512)] | |
(.setColor gfx (java.awt.Color. (mod xor 256) (mod xor 256) (mod xor 256))) | |
(.fillRect gfx x y 1 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(doseq [[x y xor] (xors 512 512) | |
grey (mod xor 256)] | |
(.setColor gfx (java.awt.Color. grey grey grey)) | |
(.fillRect gfx x y 1 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(doseq [[x y xor] (xors 512 512)] | |
(let [grey (mod xor 256)] | |
(.setColor gfx (java.awt.Color. grey grey grey)) | |
(.fillRect gfx x y 1 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment