 
 ; ImageProcessor-related utilities
 
+(defn clone
+  "Duplicates and ImageProcessor."
+  [processor]
+  (when processor
+    (.duplicate processor)))
+
 (defn insert-image!
   "Inserts one ImageProcessor into another."
   [proc-host proc-guest x-host y-host]

(defn gaussian-blur
  "Applys a gaussian blur to ImageProcessor, with given radius."
  [processor radius]
  (let [new-proc (.duplicate processor)]
    (.blurGaussian (GaussianBlur.) new-proc radius radius 0.0002)
    new-proc))



(defn insert-half-tile
  [tile [left? upper?] mosaic]
  (let [dest (or (clone mosaic) (black-processor-like tile))]
    (insert-half-tile! dest tile [left? upper?])))

;; stats
