Mercurial > cortex
diff org/util.org @ 199:305439cec54d
added video to sense.org
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 06 Feb 2012 01:40:22 -0700 |
parents | fc0bf33bded2 |
children | d3a2abfac405 |
line wrap: on
line diff
1.1 --- a/org/util.org Sun Feb 05 14:01:47 2012 -0700 1.2 +++ b/org/util.org Mon Feb 06 01:40:22 2012 -0700 1.3 @@ -486,35 +486,6 @@ 1.4 #+begin_src clojure :results silent 1.5 (in-ns 'cortex.util) 1.6 1.7 -(defn view-image 1.8 - "Initailizes a JPanel on which you may draw a BufferedImage. 1.9 - Returns a function that accepts a BufferedImage and draws it to the 1.10 - JPanel." 1.11 - [] 1.12 - (let [image 1.13 - (atom 1.14 - (BufferedImage. 1 1 BufferedImage/TYPE_4BYTE_ABGR)) 1.15 - panel 1.16 - (proxy [JPanel] [] 1.17 - (paint 1.18 - [graphics] 1.19 - (proxy-super paintComponent graphics) 1.20 - (.drawImage graphics @image 0 0 nil))) 1.21 - frame (JFrame. "Display Image")] 1.22 - (SwingUtilities/invokeLater 1.23 - (fn [] 1.24 - (doto frame 1.25 - (-> (.getContentPane) (.add panel)) 1.26 - (.pack) 1.27 - (.setLocationRelativeTo nil) 1.28 - (.setResizable true) 1.29 - (.setVisible true)))) 1.30 - (fn [#^BufferedImage i] 1.31 - (reset! image i) 1.32 - (.setSize frame (+ 8 (.getWidth i)) (+ 28 (.getHeight i))) 1.33 - (.repaint panel 0 0 (.getWidth i) (.getHeight i)) 1.34 - i))) 1.35 - 1.36 (defprotocol Viewable 1.37 (view [something])) 1.38