 (defn draw-primitives [g2d items]
   (enable-anti-aliasing g2d)
   (doseq [[type params inner] items]
-    (println type params inner)
-    (set-style g2d params)
-    (draw-primitive g2d type (complete-coordinates params))
-    ))
+    (let [params+ (complete-coordinates params)]
+      (with-g2d-state [g2d params+]
+                      (draw-primitive g2d type params+)))))
 
 (defn paint-canvas-graphics [^Graphics graphics data]
   (draw-primitives graphics data))

                  (if-not (empty? dashes)
                    (BasicStroke. width cap-code join-code miter-limit
                                  dashes-array dash-phase)
                    (BasicStroke. width cap-code join-code miter-limit))))))

(defn- -? [a b]
  (when (and a b)

   :round BasicStroke/JOIN_ROUND
   :bevel BasicStroke/JOIN_BEVEL})

(defn set-g2d-state [g2d {:keys [alpha color stroke rotate x y]}]
  (doto g2d
    (.setColor (if color color Color/BLACK))
    (.setComposite (if (or (not alpha) 
                           (= alpha 1))
                     AlphaComposite/Src
                     (AlphaComposite/getInstance AlphaComposite/SRC_ATOP alpha)))
    (.setStroke (let [{:keys [width cap join miter-limit dashes dash-phase]
                       :or {width 1.0 cap :square
                            join :miter miter-limit 10.0
