Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created October 18, 2010 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Serabe/632852 to your computer and use it in GitHub Desktop.
Save Serabe/632852 to your computer and use it in GitHub Desktop.
(defmacro porter-duff-rule
"Defines a composite. A composite accepts an optional parameter. If given, it is the factor to multiply the alpha of the source."
[name]
(let [field-name (.. (str name) toUpperCase (replace \- \_))
alpha (symbol (str "AlphaComposite/" field-name))]
`(defn ~name
([] (AlphaComposite/getInstance ~alpha))
([factor#] (AlphaComposite/getInstance ~alpha factor#)))))
(porter-duff-rule src-out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment