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

inthsbToRgB(double hue, double sat, double brightness)
hsb To Rg B
return java.awt.Color.HSBtoRGB((float) hue, (float) sat, (float) brightness);
intHSBtoRGB(float hue, float saturation, float brightness)
Taken from java.awt.Color
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.
int r = 0, g = 0, b = 0;
if (saturation == 0) {
    r = g = b = (int) (brightness * 255.0f + 0.5f);
} else {
    float h = (hue - (float) Math.floor(hue)) * 6.0f;
    float f = h - (float) java.lang.Math.floor(h);
    float p = brightness * (1.0f - saturation);
    float q = brightness * (1.0f - saturation * f);
...
intHSBtoRGB(float parHue, float parSaturation, float parBrightness)
Get HSB from RGB
return Color.HSBtoRGB(parHue, parSaturation, parBrightness);
ImageincreaseBrightness(Image image)
Aumenta el brillo de una imagen.
BufferedImage result = new BufferedImage(image.getWidth(null), image.getHeight(null),
        BufferedImage.TYPE_INT_ARGB);
result.getGraphics().drawImage(image, 0, 0, null);
for (int x = 0; x < image.getWidth(null); x++) {
    for (int y = 0; y < image.getHeight(null); y++) {
        Color c = new Color(result.getRGB(x, y));
        result.setRGB(x, y, new Color(verifyRange(c.getRed() + 100), verifyRange(c.getGreen() + 100),
                verifyRange(c.getBlue() + 100)).getRGB());
...
ColormakeColorBrighter(Color color)
Makes a color get brighter.
int r = makeBaseColorBrighter(color.getRed());
int g = makeBaseColorBrighter(color.getGreen());
int b = makeBaseColorBrighter(color.getBlue());
return new Color((int) r, (int) g, (int) b);
ColormodifyBrightness(Color c, float brightness)
Modifies an existing brightness level of a color
float hsbVals[] = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
return Color.getHSBColor(hsbVals[0], hsbVals[1], brightness * hsbVals[2]);
floatperceivedBrightness(Color c)
This is a color's perceived brightness by the human eye
return (c == null) ? 1.0f : ((float) (299 * c.getRed() + 587 * c.getGreen() + 114 * c.getBlue())) / 255000f;
ColorsetBrightness(Color color, float brightness)
Modifies the passed in color by changing it's brightness using HSB calculations.
int alpha = color.getAlpha();
float[] cols = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
cols[2] = brightness;
Color c2 = color.getHSBColor(cols[0], cols[1], cols[2]);
return setAlpha(c2, alpha);
ColorsetBrightness(Color color, float brightness)
Returns a new color equal to the old one, except the brightness is set to the new value.
if (brightness < 0f || brightness > 1f) {
    throw new IllegalArgumentException("invalid brightness value");
int alpha = color.getAlpha();
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
Color c = Color.getHSBColor(hsb[0], hsb[1], brightness);
return setAlpha(c, alpha);
ColorsetColorBrightness(Color c, double y)
set Color Brightness
double i = (c.getRed() * 0.596 - c.getGreen() * 0.275 - c.getBlue() * 0.321);
double q = (c.getRed() * 0.212 - c.getGreen() * 0.523 + c.getBlue() * 0.311);
int r = max(0, min(255, (int) round(y + i * 0.956 + q * 0.621)));
int g = max(0, min(255, (int) round(y - i * 0.272 - q * 0.647)));
int b = max(0, min(255, (int) round(y - i * 1.105 + q * 1.702)));
return new Color(r, g, b);