Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2010 09:49
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 anonymous/305415 to your computer and use it in GitHub Desktop.
Save anonymous/305415 to your computer and use it in GitHub Desktop.
(def rob (java.awt.Robot.))
(def rect (java.awt.Rectangle. 0 0 500 500))
(def image (. rob createScreenCapture rect))
(defn display-image
[image]
(let [frame (doto (javax.swing.JFrame. "Display Image")
(.setBounds 0 0 (. image getWidth) (. image getHeight))
(.setVisible true))
cv (proxy [java.awt.Canvas] []
(paint [g] (. g drawImage image nil nil))
(update [g] (. g drawImage image nil nil)))]
(.add (.getContentPane frame) cv)))
(display-image image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment