       (let [params (merge default-primitive-params
                                         (:params item))]
       (set-style g2d params)
-      (draw-primitive g2d (:type item) params)))))
+      (draw-primitive g2d (:type item) (complete-coordinates params))))))
 
 (defn paint-canvas-graphics [^Graphics graphics data]
   (draw-primitives graphics data))

  (doto g2d
    (.setColor (:color params))))

(defmulti draw-primitive (fn [g2d shape params] shape))

(defmethod draw-primitive :primitive-arc
  [g2d shape {:keys [x y w h filled start-angle arc-angle]}]
  (if filled
    (.fillArc g2d x y w h start-angle arc-angle)
    (.drawArc g2d x y w h start-angle arc-angle)))

(defmethod draw-primitive :primitive-ellipse
  [g2d shape {:keys [x y w h filled]}]
  (if filled
    (.fillOval g2d x y w h)
    (.drawOval g2d x y w h)))

(defmethod draw-primitive :primitive-image
  [g2d shape {:keys [image x y w h]}]
  (.drawImage g2d
              image x y
              (or w (.getWidth image))
              (or h (.getHeight image)) nil))

(defmethod draw-primitive :primitive-line
  [g2d shape {:keys [x y w h filled]}]
  (.drawLine g2d x y (+ x w) (+ x h)))

(defmethod draw-primitive :primitive-polygon
  [g2d shape {:keys [vertices filled closed]}]

(ns slide-explorer.core
  (:import (java.awt Color Font Graphics Graphics2D Polygon RenderingHints)
           (java.awt.font TextAttribute)
           (javax.swing JFrame JPanel)))

;; possible 
; draggable
; clickable
; hoverable
; rotatable
; resizable
; shearable
;
; gradients
; affine transforms

(defn enable-anti-aliasing
  "Turn on (off) anti-aliasing for a graphics context."
