# HG changeset patch # User Robert McIntyre # Date 1340416984 18000 # Node ID a00981db92dad1f008e0f1f2f92aeded0949c35d # Parent 3dbb863eb801d4affebf95117b2166898d595aa8 can now display black and white images (still working on color). diff -r 3dbb863eb801 -r a00981db92da clojure/com/aurellem/run/image.clj --- a/clojure/com/aurellem/run/image.clj Fri Jun 22 18:58:47 2012 -0500 +++ b/clojure/com/aurellem/run/image.clj Fri Jun 22 21:03:04 2012 -0500 @@ -284,6 +284,12 @@ (ImageIO/read (File. user-home "/proj/vba-clojure/images/test-gb-image.png"))) +(def test-image-2 + (ImageIO/read + (File. user-home "/proj/vba-clojure/images/test-gb-image-2.png"))) + + + (defn rgb->triplet [rgb] (let [r (bit-shift-right (bit-and rgb 0xFF0000) 16) g (bit-shift-right (bit-and rgb 0xFF00) 8) @@ -299,7 +305,7 @@ (defn gb-tiles [^BufferedImage image] (for [tile (range 360)] - (for [x (range 8) y (range 8)] + (for [y (range 8) x (range 8)] (vga-rgb->gb-rgb (rgb->triplet (.getRGB image (+ x (* 8 (rem tile 20))) @@ -463,7 +469,7 @@ data]))) (defn write-image - "Assume the image data is 160x144 pixels specified as 360 blocks." + "Assume the image data is specified as 360 blocks." [base-address target-address image-data] (let [len (count image-data) @@ -511,7 +517,7 @@ 0x1D ;; dec E 0x20 - (->signed-8-bit -18) ;; contunue writing picture + (->signed-8-bit -18) ;; contunue writing image 0xC3 (reverse @@ -609,10 +615,10 @@ D [;; [ ] specifiy pallets for each character (select-LCD-bank 1) - (write-image - (+ base-address (+ (count A) (count B) (count C))) - BG-1-address - (map second (:data gb-image))) + ;;(write-image + ;; (+ base-address (+ (count A) (count B) (count C))) + ;; BG-1-address + ;;(map second (:data gb-image))) ;; [X] reactivate the LCD display diff -r 3dbb863eb801 -r a00981db92da images/test-gb-image-2.png Binary file images/test-gb-image-2.png has changed diff -r 3dbb863eb801 -r a00981db92da images/test-gb-image-2.xcf Binary file images/test-gb-image-2.xcf has changed