(defn color
"
Examples:
(use 'incanter.processing)
(color 255 0 255)
(color 255 0 255 255) ;; with alpha value
(color \"0xFF00FF\")
(color 0xFF00FF)
(color -65281)
(color 0xFFFF00FF true) ;; with alpha? true
(color 0xFF 0x00 0xFF)
(color 0xFF 0x00 0xFF 0xFF) ;; with alpha value
(color 1.0 0.0 1.0)
(color 1.0 0.0 1.0 1.0) ;; with alpha value
"
([rgb]
(.getRGB (java.awt.Color. (int rgb))))
;; (cond
;; (string? rgb)
;; (.getRGB (java.awt.Color/decode rgb))
;; (or (integer? rgb) (float? rgb))
;; (.getRGB (java.awt.Color. (int rgb)))))
([rgb alpha?]
;;(.getRGB (java.awt.Color. (color rgb) alpha?)))
(.getRGB (java.awt.Color. (int rgb) alpha?)))
([x y z]
(if (or (float? x) (float? y) (float? z))
(.getRGB (java.awt.Color. (float x) (float y) (float z)))
(.getRGB (java.awt.Color. (int x) (int y) (int z)))))
([x y z alpha]
(if (or (float? x) (float? y) (float? z))
(.getRGB (java.awt.Color. (float x) (float y) (float z) (float alpha)))
(.getRGB (java.awt.Color. (int x) (int y) (int z) (int alpha))))))
Used in 0 other vars
Comments top
No comments for color. Log in to add a comment.