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

                         (assoc-in [0 :params :h] (+ i 100)))
                     ))))

(reset!
  grafix 
  [
   [:primitive-round-rect
    {:l 20 :t 10 :w 300 :h 300
     :arc-radius 100
     :filled true :color Color/PINK
     :rotate 50}]
   [:primitive-round-rect
    {:l 20 :t 10 :w 300 :h 300
     :arc-radius 100 :rotate 50
     :filled false :color Color/DARK_GRAY
     :stroke {:width 5
              :cap :round
              :dashes [11 10] :dash-phase 0}}]
   [:primitive-ellipse
    {:l 25 :t 15 :w 110 :h 90
     :filled true :color Color/YELLOW :alpha 0.5}]
   [:primitive-polygon
    {:vertices [{:x 100 :y 100}
                {:x 50 :y 150}
                {:x 50 :y 220}
                {:x 160 :y 250}]
     :filled false
     :closed false
     :color Color/ORANGE
     :alpha 0.8
     :stroke {:width 25
              :dashes [20 3 10 3 5 3]
              :cap :butt
              :join :bevel
              :miter-limit 10.0}}]
   [:primitive-text
    {:x 180 :y 120 :text "Testing..."
     :color Color/BLUE
     :alpha 0.4
     :font {:name "Arial"
            :bold true
            :italic false
            :underline false
            :strikethrough false
            :size 60}}]
   [:primitive-line
    {:x 180 :y 220 :w 0 :h 50 :color Color/RED
     :stroke {:width 10 :cap :round}
     :alpha 0.7}]
   [:primitive-line
    {:x 180 :y 220 :w 30 :h 0 :color Color/GREEN
     :alpha 0.6
     :stroke {:width 4}}]
   [:primitive-arc
    {:l 30 :t 20 :w 150 :h 100
     :start-angle 30 :arc-angle 100 :color Color/GREEN
     :filled true
     :alpha 0.7}]
   ])


