Namespace for colour handling and conversion functions.
Note there are 4 different ways to specify colours:
Care should be taken to use the appropriate function. Typically:
Namespace for colour handling and conversion functions. Note there are 4 different ways to specify colours: 1. long colour values (entire colour expressed as a single long) - e.g. 0xFF00FF00 2. long component values (individual alpha, red, green, blue) - e.g. [255 234 0 101] 3. double colour values (individual alpha, red, green, blue) - e.g. [0.5 0.5 0.5] 4. Java Color instances - e.g. java.awt.Color/BLACK Care should be taken to use the appropriate function. Typically: 1. Offers the best performance 2. Useful for manipulating 1. 3. Useful for high precision computations, or colours outside normal ranges 4. Useful for Java interop
(argb colour)
(argb r g b)
(argb r g b a)
Get the long ARGB colour value specified by the ARGB colour values (expresed in range 0.0-1.0).
If not specified specified the Alpha value of the resulting colour will be 1.0 (fully opaque)
Get the long ARGB colour value specified by the ARGB colour values (expresed in range 0.0-1.0). If not specified specified the Alpha value of the resulting colour will be 1.0 (fully opaque)
(argb-from-components r g b)
(argb-from-components r g b a)
Gets the long colour value from combining red, green and blue long component values. If not specified specified the Alpha value of the resulting colour will be 255 (fully opaque) This is implemented as a macro for performance reasons.
Gets the long colour value from combining red, green and blue long component values. If not specified specified the Alpha value of the resulting colour will be 255 (fully opaque) This is implemented as a macro for performance reasons.
(boxed-double-value x)
Convenient macro to convert a long component value to a boxed java.lang.Double. Uses a cache of Double values.
Convenient macro to convert a long component value to a boxed java.lang.Double. Uses a cache of Double values.
(color argb)
Creates a java.awt.Color instance representing the given ARGB long colour values
Creates a java.awt.Color instance representing the given ARGB long colour values
(components-argb argb)
Gets the red, green, blue and alpha components of a long colour value. Returns a 4-element vector of long component values (range 0-255)
Gets the red, green, blue and alpha components of a long colour value. Returns a 4-element vector of long component values (range 0-255)
(components-rgb rgb)
Return the RGB components of a long colour value, in a 3-element vector of long component values (range 0-255)
Return the RGB components of a long colour value, in a 3-element vector of long component values (range 0-255)
(extract-alpha argb)
Extracts the long alpha component (range 0-255) from a long colour
Extracts the long alpha component (range 0-255) from a long colour
(extract-blue argb)
Extracts the long blue component (range 0-255) from a long colour
Extracts the long blue component (range 0-255) from a long colour
(extract-green argb)
Extracts the long green component (range 0-255) from a long colour
Extracts the long green component (range 0-255) from a long colour
(extract-red argb)
Extracts the long red component (range 0-255) from a long colour
Extracts the long red component (range 0-255) from a long colour
(long-colour x)
Convenience macro to cast an integer ARGB value to a long colour value.
Convenience macro to cast an integer ARGB value to a long colour value.
(rand-colour)
Returns a random RGB colour value with 100% alpha
Returns a random RGB colour value with 100% alpha
(rand-grayscale)
Returns a random grayscale colour value with 100% alpha
Returns a random grayscale colour value with 100% alpha
(rgb colour)
(rgb r g b)
(rgb r g b a)
Get the long ARGB colour value specified by the RGB colour values (expresed in range 0.0-1.0).
The Alpha value of the resulting colour will be 1.0 (fully opaque)
Get the long ARGB colour value specified by the RGB colour values (expresed in range 0.0-1.0). The Alpha value of the resulting colour will be 1.0 (fully opaque)
(rgb-from-components r g b)
(rgb-from-components r g b a)
Gets the long colour value from combining red, green and blue long component values. The Alpha value of the resulting colour will be fixed at 255 (fully opaque) This is implemented as a macro for performance reasons.
Gets the long colour value from combining red, green and blue long component values. The Alpha value of the resulting colour will be fixed at 255 (fully opaque) This is implemented as a macro for performance reasons.
(to-java-color colour)
Coerces a colour value to a Java Color instance
Coerces a colour value to a Java Color instance
(values-argb argb)
Gets the red, green, blue and alpha components of a long colour value. Returns a 4-element vector of double values (range 0.0-1.0)
Gets the red, green, blue and alpha components of a long colour value. Returns a 4-element vector of double values (range 0.0-1.0)
(values-rgb rgb)
Return the RGB components of a long colour value, in a 3-element vector of double values (range 0.0-1.0)
Return the RGB components of a long colour value, in a 3-element vector of double values (range 0.0-1.0)
(with-components [syms argb] & body)
Macro which extracts the ARGB colour components from a long colour value and binds them to the specified symbols. This is implemented as a macro for performance reasons.
Intended usage: (with-components [[r g b] some-argb-value] .....)
Macro which extracts the ARGB colour components from a long colour value and binds them to the specified symbols. This is implemented as a macro for performance reasons. Intended usage: (with-components [[r g b] some-argb-value] .....)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close