Created
October 18, 2010 19:18
-
-
Save Serabe/632849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user> (.setComposite g-clj (src-out)) | |
; Evaluation aborted. | |
user> (.setComposite g-clj (src-out 1)) | |
; Evaluation aborted. | |
user> (def a (src-out)) | |
#'user/a | |
user> (.setComposite g-clj a) | |
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can't embed object in code, maybe print-dup not defined: java.awt.AlphaComposite@b0800007 | |
[Thrown class java.lang.RuntimeException] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro with-composite | |
"Sets the composite of the dest to comp, and restores original composite value after executing the body. | |
Body executes inside a doto bounded to a Graphics2D object." | |
[img comp & body] | |
(let [eval-comp comp] | |
`(let [ni# (clone-image ~img) | |
g2# ^Graphics2D (.. (:image ni#) getGraphics) | |
orig-comp# (.. g2# getComposite)] | |
(doto g2# | |
(.setComposite ~eval-comp) | |
~@body | |
(.setComposite orig-comp#)) | |
ni#))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment