Mercurial > lasercutter
comparison src/laser/rasterize.clj @ 6:4ae2497acf7d
saving progress
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 20 Aug 2010 03:18:05 -0400 |
parents | 8cc418e04b87 |
children | 5e167f275a93 |
comparison
equal
deleted
inserted
replaced
5:8cc418e04b87 | 6:4ae2497acf7d |
---|---|
113 (defn raster-comment [string] | 113 (defn raster-comment [string] |
114 (str "(" (re-gsub #"[()]" "" string) ")")) | 114 (str "(" (re-gsub #"[()]" "" string) ")")) |
115 | 115 |
116 (defn filter-keys [fun m] | 116 (defn filter-keys [fun m] |
117 (select-keys m (filter fun (keys m)))) | 117 (select-keys m (filter fun (keys m)))) |
118 | |
118 (def filter-keys (preserve-meta filter-keys)) | 119 (def filter-keys (preserve-meta filter-keys)) |
119 | 120 |
120 (defn filter-vals [fun m] | 121 (defn filter-vals [fun m] |
121 (into {} (filter (comp fun val) m))) | 122 (into {} (filter (comp fun val) m))) |
123 | |
122 (def filter-vals (preserve-meta filter-vals)) | 124 (def filter-vals (preserve-meta filter-vals)) |
123 | 125 |
124 (defn frame-hash->bufferedImage | 126 (defn frame-hash->bufferedImage |
125 [frame-hash] | 127 [frame-hash] |
126 (let [data (meta frame-hash) | 128 (let [data (meta frame-hash) |
137 image)) | 139 image)) |
138 | 140 |
139 (defmulti display "Creates a JFrame and displays a buffered image" class) | 141 (defmulti display "Creates a JFrame and displays a buffered image" class) |
140 | 142 |
141 (defn- makePanel [image] (proxy [Panel] [] (paint [g] (.drawImage g image 0 0 nil)))) | 143 (defn- makePanel [image] (proxy [Panel] [] (paint [g] (.drawImage g image 0 0 nil)))) |
144 | |
145 (defn select-row [x window] | |
146 (filter-keys (comp (partial = x) first) window)) | |
147 | |
142 | 148 |
143 | 149 |
144 (defmethod display | 150 (defmethod display |
145 BufferedImage [image] | 151 BufferedImage [image] |
146 (let [panel (makePanel image) | 152 (let [panel (makePanel image) |