changeset 122:17aa55059b07

Added with-stroke macro.
author Mikhail Kryshen <mikhail@kryshen.net>
date Fri, 06 Apr 2012 19:19:13 +0400
parents b5ac04d5fc8a
children 7b22c6d585f4
files src/net/kryshen/indyvon/core.clj
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/net/kryshen/indyvon/core.clj	Fri Apr 06 18:59:04 2012 +0400
+++ b/src/net/kryshen/indyvon/core.clj	Fri Apr 06 19:19:13 2012 +0400
@@ -399,6 +399,15 @@
          (finally
           (.setColor g# old-color#))))))
 
+(defmacro with-stroke [stroke & body]
+  `(let [g# *graphics*
+         old-stroke# (.getStroke g#)]
+     (try
+       (.setStroke g# ~stroke)
+       ~@body
+       (finally
+        (.setStroke g# old-stroke#)))))
+
 (defn with-hints*
   [hints f & args]
   (if hints