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

ColoradjustBrightness(Color c, float difference)
Increases/decreases brightness of the given color by the specified difference.
if (difference < -1.0 || difference > 1.0) {
    throw new IllegalArgumentException("Difference parameter outside of expected range: "
            + "Difference parameter should be floating-point values between -1 and 1");
Color retVal = null;
if (c != null) {
    float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
    float brightness = Math.min(1.0f, Math.max(0.0f, hsb[2] + difference));
...
ColoradjustColorBrightness(Color base, float brightness)
adjust Color Brightness
float hsb[] = Color.RGBtoHSB(base.getRed(), base.getGreen(), base.getBlue(), null);
hsb[2] += brightness;
hsb[2] = hsb[2] < 0.0f ? 0.0f : (hsb[2] > 1.0f ? 1.0f : hsb[2]);
return Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
ColoradjustHSB(Color inputColor, float hue, float saturation, float brightness)
Method description
float[] hsbvals = new float[3];
Color.RGBtoHSB(inputColor.getRed(), inputColor.getGreen(), inputColor.getBlue(), hsbvals);
return Color.getHSBColor(hue * hsbvals[0], saturation * hsbvals[1], brightness * hsbvals[2]);
Colorbrighten(Color c, double f)
Brighten a color by a given amount
return mix(c, Color.white, f);
Colorbrighten(Color color)
brighten
return brighten(color, colorComponentChangeFactor);
Colorbrighten(final Color color, final double percentage)
Returns a new color that is percentage brighter than the original.
if (percentage < 0.01 || percentage > 1.00) {
    throw new IllegalArgumentException("Percentage must be between [0.01 - 1.00]");
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
r = Math.min((int) (r * (1.00 + percentage)), 255);
g = Math.min((int) (g * (1.00 + percentage)), 255);
...
intbrighten(final int color)
brighten
final int r = getRed(color);
final int g = getGreen(color);
final int b = getBlue(color);
int newR = (int) (r + (255 - r) * BRIGHTNESS_FACTOR);
int newG = (int) (g + (255 - g) * BRIGHTNESS_FACTOR);
int newB = (int) (b + (255 - b) * BRIGHTNESS_FACTOR);
return getColor(getAlpha(color), newR, newG, newB);
intbrighten(final int cValue, double colorBrigthnessFactor)
brighten
if (colorBrigthnessFactor < 1) {
    return cValue;
} else {
    return (int) (cValue + (colorBrigthnessFactor - 1) * ((255 - cValue) / colorBrigthnessFactor));
float[]brighten(float[] rgb, float luminosity)
Returns a copy of the rgb colour brightened up by the given amount.
float[] hsl = rgbToHsl(rgb);
hsl[2] = luminosity;
return hslToRgb(hsl);
ColorbrightenColor(Color color, double factor)
Brightens each of the RGB components of color by the specified factor.
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
int i = (int) (1.0 / (1.0 - factor));
if (r == 0 && g == 0 && b == 0) {
    return new Color(i, i, i);
if (r > 0 && r < i) {
...