diff clojure/com/aurellem/run/final_cut.clj @ 531:c6ad363e36f7

trying to find out map problem.
author Robert McIntyre <rlm@mit.edu>
date Sun, 24 Jun 2012 17:18:22 -0500
parents 8d3177d19d5f
children a3bdff5554ad
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/final_cut.clj	Sun Jun 24 16:47:18 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/final_cut.clj	Sun Jun 24 17:18:22 2012 -0500
     1.3 @@ -49,5 +49,37 @@
     1.4       (render-files! render-dir initial-state moves))
     1.5    ([moves]
     1.6       (render-files! (root) moves)))
     1.7 -                           
     1.8  
     1.9 +(defn file-names [#^File dir]
    1.10 +   (mapv #(.getCanonicalPath %) (next (sort (file-seq dir)))))
    1.11 +
    1.12 +(defn composite-frames-command
    1.13 +  [screenshot ram-map target]
    1.14 +  ["convert"
    1.15 +   "-size" "318x276" "xc:white"
    1.16 +   screenshot   "-geometry" "+10+10"  "-composite"
    1.17 +   ram-map      "-geometry" "+180+10" "-composite"
    1.18 +   target])
    1.19 +
    1.20 +(defn generate-composite-frames!
    1.21 +  ([^File rendered-dir]
    1.22 +     (let [final-frames (File. rendered-dir "final")
    1.23 +           _ (.mkdir final-frames)
    1.24 +           screenshots (file-names (File. rendered-dir "frames"))
    1.25 +           ram-maps    (file-names (File. rendered-dir "ram-map"))
    1.26 +           targets (map #(File. final-frames (format "%07d.png"))
    1.27 +                        (range (count screenshots)))]
    1.28 +       (dorun
    1.29 +        (map
    1.30 +         ;;         (comp ;;clojure.java.shell/sh
    1.31 +         ;;          println
    1.32 +         ;;          flatten
    1.33 +         composite-frames-command
    1.34 +         screenshots ram-maps targets))
    1.35 +
    1.36 +       ))
    1.37 +  ([] (generate-composite-frames! render-dir)))
    1.38 +  
    1.39 +
    1.40 +
    1.41 +  
    1.42 \ No newline at end of file