Java Color Brighten perceivedBrightness(Color c)

Here you can find the source of perceivedBrightness(Color c)

Description

This is a color's perceived brightness by the human eye

License

Open Source License

Parameter

Parameter Description
c a parameter

Return

brightness from 0.0 to 1.0

Declaration

public static float perceivedBrightness(Color c) 

Method Source Code


//package com.java2s;
import java.awt.Color;

public class Main {
    /**/*  ww  w  . j a v a  2s.c  o m*/
     * This is a color's perceived brightness by the human eye
     * @param c
     * @return brightness from 0.0 to 1.0
     */
    public static float perceivedBrightness(Color c) {
        return (c == null) ? 1.0f : ((float) (299 * c.getRed() + 587 * c.getGreen() + 114 * c.getBlue())) / 255000f;
    }
}

Related

  1. HSBtoRGB(float hue, float saturation, float brightness)
  2. HSBtoRGB(float parHue, float parSaturation, float parBrightness)
  3. increaseBrightness(Image image)
  4. makeColorBrighter(Color color)
  5. modifyBrightness(Color c, float brightness)
  6. setBrightness(Color color, float brightness)
  7. setBrightness(Color color, float brightness)
  8. setColorBrightness(Color c, double y)
  9. shiftHSB(java.awt.Color color, double hueDelta, double saturationDelta, double brightnessDelta)