java.lang.Object | |
↳ | cyanogenmod.util.ColorUtils |
Helper class for colorspace conversions, and color-related algorithms which may be generally useful.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Calculate the colour difference value between two colours in lab space.
| |||||||||||
Converts an RGB packed int into L*a*b space, which is well-suited for finding
perceptual differences in color
| |||||||||||
Drop the alpha component from an RGBA packed int and return
a non sign-extended RGB int.
| |||||||||||
Finds the "perceptually nearest" color from a list of colors to
the given RGB value.
| |||||||||||
Convenience method to find the nearest "solid" color (having RGB components
of either 0 or 255) to the given color.
| |||||||||||
Takes a drawable and uses Palette to generate a suitable "alert"
color which can be used for an external notification mechanism
such as an RGB LED.
| |||||||||||
Given a Palette, pick out the dominant swatch based on population
| |||||||||||
Convert a color temperature value (in Kelvin) to a RGB units as floats.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Calculate the colour difference value between two colours in lab space. This code is from OpenIMAJ under BSD License
L1 | first colour's L component |
---|---|
a1 | first colour's a component |
b1 | first colour's b component |
L2 | second colour's L component |
a2 | second colour's a component |
b2 | second colour's b component |
Converts an RGB packed int into L*a*b space, which is well-suited for finding perceptual differences in color
rgb | A 32-bit value of packed RGB ints |
---|
Drop the alpha component from an RGBA packed int and return a non sign-extended RGB int.
Finds the "perceptually nearest" color from a list of colors to the given RGB value. This is done by converting to L*a*b colorspace and using the CIE2000 deltaE algorithm.
rgb | The original color to start with |
---|---|
colors | An array of colors to test |
Convenience method to find the nearest "solid" color (having RGB components of either 0 or 255) to the given color. This is useful for cases such as LED notification lights which may not be able to display the full range of colors due to hardware limitations.
Takes a drawable and uses Palette to generate a suitable "alert" color which can be used for an external notification mechanism such as an RGB LED. This will always pick a solid color having RGB components of 255 or 0.
drawable | The drawable to generate a color for |
---|
Given a Palette, pick out the dominant swatch based on population
Convert a color temperature value (in Kelvin) to a RGB units as floats. This can be used in a transform matrix or hardware gamma control.