                     (iterate inc 0)
                     (map pos)
                     (map cons color-swatch))
-        g2d       (create-context g2d-target width height)]
+        target    (g2d-target)
+        g2d       (create-context target width height)]
 
     (doto g2d
       (.setBackground Color/WHITE)

      (doseq [[c x y] generator]
        (draw-cell g2d x y w h (color/coerce c))))

    (close g2d-target)))

^:clj
(defn bitmap []

(ns inkspot.palette
  (:require [inkspot.color :as color])
  ^:clj
  (:import (java.awt Color Graphics2D GraphicsEnvironment RenderingHints)
           (java.awt.image BufferedImage)
           (java.io StringWriter)
           (org.apache.batik.dom GenericDOMImplementation)
           (org.apache.batik.svggen SVGGraphics2D)))

(defprotocol IGraphics2DTarget
  (create-context [this width height])
