Java Color Brighten getBrightness(int red, int green, int blue)

Here you can find the source of getBrightness(int red, int green, int blue)

Description

get Brightness

License

Open Source License

Declaration

public static float getBrightness(int red, int green, int blue) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

public class Main {
    public static final int MAX_RGB_COMPONENT_VALUE = 255;

    public static float getBrightness(Color colour) {
        return getBrightness(colour.getRed(), colour.getGreen(), colour.getBlue());
    }/*from   www. j  ava  2  s  .co  m*/

    public static float getBrightness(int rgb) {
        return getBrightness((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF);
    }

    public static float getBrightness(int red, int green, int blue) {
        double cMax = (red > green) ? red : green;
        if (cMax < blue)
            cMax = blue;
        return ((float) cMax / (float) MAX_RGB_COMPONENT_VALUE);
    }
}

Related

  1. getBrightness(Color c)
  2. getBrightness(Color c)
  3. getBrightness(Color color)
  4. getBrightness(Color color)
  5. getBrightness(Color color)
  6. getBrightness(java.awt.Color color)
  7. getGradientBrightColors(Color baseColor, float step, float max)
  8. getRandomBrightColor()
  9. getSlightlyBrighter(Color color)