changeset 515:f68d600b089c

colors now work properly.
author Robert McIntyre <rlm@mit.edu>
date Fri, 22 Jun 2012 21:21:48 -0500
parents a00981db92da
children 7eac27143ab9
files clojure/com/aurellem/run/image.clj images/colors-test.png images/colors-test.xcf images/test-gb-image-2.png
diffstat 4 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/image.clj	Fri Jun 22 21:03:04 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/image.clj	Fri Jun 22 21:21:48 2012 -0500
     1.3 @@ -233,7 +233,8 @@
     1.4                       
     1.5                        (seq (set (vals gb-color-map)))))))))
     1.6          ;;view (cortex.sense/view-image)
     1.7 -        target (File. user-home "proj/vba-clojure/gb-color-map-unique.png")]
     1.8 +        target
     1.9 +        (File. user-home "proj/vba-clojure/gb-color-map-unique.png")]
    1.10      (dorun (for [x (range 68) y (range 69)]
    1.11               (let [[r g b] (get pix (+ x (* 68 y)) [0 0 0])
    1.12                     rgb (+ (bit-shift-left r 16)
    1.13 @@ -288,6 +289,11 @@
    1.14    (ImageIO/read
    1.15     (File. user-home "/proj/vba-clojure/images/test-gb-image-2.png")))
    1.16  
    1.17 +(def test-image-color
    1.18 +  (ImageIO/read
    1.19 +   (File. user-home "/proj/vba-clojure/images/colors-test.png")))
    1.20 +
    1.21 +
    1.22  
    1.23  
    1.24  (defn rgb->triplet [rgb]
    1.25 @@ -601,7 +607,8 @@
    1.26              (+ base-address (count A))
    1.27              character-data-address
    1.28              (flatten
    1.29 -             (map gb-tile->bytes (:tiles gb-image))))]
    1.30 +             (map gb-tile->bytes (:tiles gb-image))))
    1.31 +           (select-LCD-bank 1)]
    1.32          B (flatten B)
    1.33  
    1.34          
    1.35 @@ -609,17 +616,18 @@
    1.36             (write-image
    1.37              (+ base-address (+ (count A) (count B)))
    1.38              BG-1-address
    1.39 -            (map first (:data gb-image)))]
    1.40 +            (map second (:data gb-image)))
    1.41 +           (select-LCD-bank 0)]
    1.42  
    1.43          C (flatten C)
    1.44  
    1.45          D [;; [ ] specifiy pallets for each character
    1.46 -           (select-LCD-bank 1)
    1.47 -           ;;(write-image
    1.48 -           ;; (+ base-address (+ (count A) (count B) (count C)))
    1.49 -           ;; BG-1-address
    1.50 -           ;;(map second (:data gb-image)))
    1.51  
    1.52 +           (write-image
    1.53 +            (+ base-address (+ (count A) (count B) (count C)))
    1.54 +            BG-1-address
    1.55 +            (map first (:data gb-image)))
    1.56 +           
    1.57  
    1.58             ;; [X] reactivate the LCD display
    1.59             ;; we're using only BG images, located at
     2.1 Binary file images/colors-test.png has changed
     3.1 Binary file images/colors-test.xcf has changed
     4.1 Binary file images/test-gb-image-2.png has changed