Java Utililty Methods Color Brighten

List of utility methods to do Color Brighten

Description

The list of methods to do Color Brighten are organized into topic(s).

Method

intgetBrightness(Color c)
Returns a value between 0 and 255 where 0 is darkest and 255 is brightest
return (int) Math.sqrt(c.getRed() * c.getRed() * .241 + c.getGreen() * c.getGreen() * .691
        + c.getBlue() * c.getBlue() * .068);
intgetBrightness(Color color)
Compute a brightness value.
return (color.getRed() * 299 + color.getGreen() * 578 + color.getBlue() * 114) / 1000;
intgetBrightness(Color color)
Obtiene un valor entre 0 y 255 que indica el brillo de un Color.
return (int) Math.sqrt(color.getRed() * color.getRed() * 0.241D
        + color.getGreen() * color.getGreen() * 0.691D + color.getBlue() * color.getBlue() * 0.068D);
intgetBrightness(Color color)
Uses the method described at http://alienryderflex.com/hsp.html to get the perceived brightness of a color.
final double cr = 0.241;
final double cg = 0.691;
final double cb = 0.068;
double r, g, b;
r = color.getRed();
g = color.getGreen();
b = color.getBlue();
double result = Math.sqrt(cr * r * r + cg * g * g + cb * b * b);
...
floatgetBrightness(int red, int green, int blue)
get Brightness
double cMax = (red > green) ? red : green;
if (cMax < blue)
    cMax = blue;
return ((float) cMax / (float) MAX_RGB_COMPONENT_VALUE);
floatgetBrightness(java.awt.Color color)
get Brightness
synchronized (s_hsbBuffer) {
    java.awt.Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), s_hsbBuffer);
    return s_hsbBuffer[2];
Color[]getGradientBrightColors(Color baseColor, float step, float max)
get Gradient Bright Colors
List<Color> list = new ArrayList<Color>();
float color[] = Color.RGBtoHSB(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), null);
list.add(baseColor);
for (; (color[2] += step) < (max);) {
    list.add(Color.getHSBColor(color[0], color[1], color[2]));
return list.toArray(new Color[] {});
ColorgetRandomBrightColor()
get Random Bright Color
final Color mix = Color.WHITE;
final Random random = new Random();
int red = random.nextInt(256);
int green = random.nextInt(256);
int blue = random.nextInt(256);
if (mix != null) {
    red = (red + mix.getRed()) / 2;
    green = (green + mix.getGreen()) / 2;
...
ColorgetSlightlyBrighter(Color color)
Computes and returns a Color that is slightly brighter than the specified Color.
return getSlightlyBrighter(color, 1.1f);
ColorgetSlightlyBrighter(Color color)
get Slightly Brighter
return getSlightlyBrighter(color, 1.1F);