diff clojure/com/aurellem/run/image.clj @ 496:a6d060a64246

pixel introspection. but entire image is upside down.
author Robert McIntyre <rlm@mit.edu>
date Mon, 11 Jun 2012 06:04:25 -0500
parents 1d81ddd4fa41
children 554883a95de0
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/image.clj	Mon Jun 11 00:55:51 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/image.clj	Mon Jun 11 06:04:25 2012 -0500
     1.3 @@ -143,7 +143,21 @@
     1.4          (PC! kernel-address))))
     1.5  
     1.6  
     1.7 +(require 'cortex.sense)
     1.8 +(import java.awt.image.BufferedImage)
     1.9  
    1.10 +(defn show-screenshot []
    1.11 +  (let [im (BufferedImage. 160 144 BufferedImage/TYPE_INT_RGB)
    1.12 +        pix (vec (pixels))
    1.13 +        view (cortex.sense/view-image)]
    1.14 +    (dorun (for [x (range 160) y (range 144)]
    1.15 +             (.setRGB im x y
    1.16 +                      ;0
    1.17 +                      (pix (+ x (* 160 y)))
    1.18 +                      )))
    1.19 +    (view im)))
    1.20 +
    1.21 +     
    1.22    
    1.23  (defn write-palette-color [palette-num r g b]
    1.24    (let [[byte-1 byte-2] (gb-rgb->bits r g b)]