Liking cljdoc? Tell your friends :D

mikera.image.colours

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
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
raw docstring

argbclj

(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)
raw docstring

argb-from-componentscljmacro

(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.
raw docstring

blackclj


blueclj


boxed-double-valuecljmacro

(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.
raw docstring

clearclj


colorclj

(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
raw docstring

components-argbclj

(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)
raw docstring

components-rgbclj

(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)
raw docstring

cyanclj


darkGrayclj


DOUBLE-CACHEclj


extract-alphacljmacro

(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
raw docstring

extract-bluecljmacro

(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
raw docstring

extract-greencljmacro

(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
raw docstring

extract-redcljmacro

(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
raw docstring

grayclj


greenclj


JAVA-COLOURSclj


lightGrayclj


long-colourcljmacro

(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.
raw docstring

magentaclj


orangeclj


pinkclj


rand-colourclj

(rand-colour)

Returns a random RGB colour value with 100% alpha

Returns a random RGB colour value with 100% alpha
raw docstring

rand-grayscaleclj

(rand-grayscale)

Returns a random grayscale colour value with 100% alpha

Returns a random grayscale colour value with 100% alpha
raw docstring

redclj


rgbclj

(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)
raw docstring

rgb-from-componentscljmacro

(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.
raw docstring

to-java-colorclj

(to-java-color colour)

Coerces a colour value to a Java Color instance

Coerces a colour value to a Java Color instance
raw docstring

values-argbclj

(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)
raw docstring

values-rgbclj

(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)
raw docstring

whiteclj


with-componentscljmacro

(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] .....)
raw docstring

yellowclj

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close