    :round BasicStroke/JOIN_ROUND
    :bevel BasicStroke/JOIN_BEVEL})
 
-(defn set-style [g2d {:keys [alpha color stroke]}]
+(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)))
-    (.setColor (if color color Color/BLACK))
     (.setStroke (let [{:keys [width cap join miter-limit dashes dash-phase]
                        :or {width 1.0 cap :square
                             join :miter miter-limit 10.0

                  (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)

(defn draw-primitives [g2d items]
  (enable-anti-aliasing g2d)
  (doseq [[type params inner] items]
    (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))
