Java Color Brighten adjustColorBrightness(Color base, float brightness)

Here you can find the source of adjustColorBrightness(Color base, float brightness)

Description

adjust Color Brightness

License

Open Source License

Declaration

public static Color adjustColorBrightness(Color base, float brightness) 

Method Source Code


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

import java.awt.Color;

public class Main {

    public static Color adjustColorBrightness(Color base, float brightness) {
        float hsb[] = Color.RGBtoHSB(base.getRed(), base.getGreen(), base.getBlue(), null);
        hsb[2] += brightness;//from w w  w  . j av a 2  s  .co m
        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]);
    }
}

Related

  1. adjustBrightness(Color c, float difference)
  2. adjustHSB(Color inputColor, float hue, float saturation, float brightness)
  3. brighten(Color c, double f)
  4. brighten(Color color)
  5. brighten(final Color color, final double percentage)