 (def default-primitive-params
   {:filled false :color Color/BLACK})
 
-(defn set-style [g2d {:keys [alpha color]}]
+(def stroke-caps
+  {:butt BasicStroke/CAP_BUTT
+   :round BasicStroke/CAP_ROUND
+   :square BasicStroke/CAP_SQUARE})
+
+(def stroke-joins
+  {:miter BasicStroke/JOIN_MITER
+   :round BasicStroke/JOIN_ROUND
+   :bevel BasicStroke/JOIN_BEVEL})
+
+(defn set-style [g2d {:keys [alpha color stroke]}]
   (doto g2d
     (.setComposite (if (or (not alpha) 
                            (= alpha 1))
                      AlphaComposite/Src
                      (AlphaComposite/getInstance AlphaComposite/SRC_ATOP alpha)))
-    (.setColor (if color color Color/BLACK))))
+    (.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
+                            dashes [] dash-phase 0.0}} stroke
+                      cap-code (stroke-caps cap)
+                      join-code (stroke-joins join)
+                      dashes-array (float-array dashes)]
+                  (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)

    :params {:x 180 :y 120 :text "TEST"
             :color Color/BLUE
             :alpha 0.5
             :font {:name "Courier New"
                    :bold true
                    :italic false
                    :underline true
                    :strikethrough false
                    :size 100}}}
   {:type :primitive-line
    :params {:x 180 :y 120 :w 0 :h 300 :color Color/RED}}
   {:type :primitive-line
    :params {:x 180 :y 120 :w 10 :h 0 :color Color/RED}}
   {:type :primitive-arc
    :params {:l 40 :t 30 :w 100 :h 100
             :start-angle 10 :arc-angle 100 :color Color/GREEN

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

