Skip to content

Instantly share code, notes, and snippets.

@swannodette
Forked from alamar/image.clj
Created December 12, 2011 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1469123 to your computer and use it in GitHub Desktop.
Save swannodette/1469123 to your computer and use it in GitHub Desktop.
a slow cycle
(import '[java.awt.image BufferedImage])
(defn create-image [w h]
(let [image (BufferedImage. w h BufferedImage/TYPE_INT_RGB)]
(loop [x (dec w)]
(when (>= x 0)
(loop [y (dec h)]
(when (>= y 0)
(.setRGB image (int x) (int y) (int 0))
(recur (dec y))))
(recur (dec x))))
image))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment