Java Color Brighten makeColorBrighter(Color color)

Here you can find the source of makeColorBrighter(Color color)

Description

Makes a color get brighter.

License

Open Source License

Parameter

Parameter Description
color the color to change.

Return

the brighter color.

Declaration

public static Color makeColorBrighter(Color color) 

Method Source Code

//package com.java2s;
/**/*from w ww .  j av a2  s  .  com*/
 * This file is part of emf2gv : an eclipse plugin that allows to
 * generate a graphical representation of an EMF model.
 *
 * Copyright 2010-2011 Jean-Francois Brazeau
 * 
 * emf2gv is free software: you can redistribute it and/or modify
 * it under the terms of either:
 * 
 *      a) the GNU Lesser General Public License as published by
 *       the Free Software Foundation, either version 3 of the License, or
 *       (at your option) any later version.
 *  or
 *      b) the Eclipse Public License version 1.0 as published by
 *       the Eclipse Foundation.
 * 
 * emf2gv is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with emf2gv.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You should have received a copy of the  Eclipse Public License
 * along with emf2gv.  If not, see <http://www.eclipse.org/legal/epl-v10.html>.
 */

import java.awt.Color;

public class Main {
    /**
     * Makes a color get brighter.
     * 
     * @param color
     *            the color to change.
     * @return the brighter color.
     */
    public static Color makeColorBrighter(Color color) {
        int r = makeBaseColorBrighter(color.getRed());
        int g = makeBaseColorBrighter(color.getGreen());
        int b = makeBaseColorBrighter(color.getBlue());
        return new Color((int) r, (int) g, (int) b);
    }

    /**
     * Makes a base color (red, green or blue) get brighter.
     * 
     * @param baseColor
     *            the base color.
     * @return the brighter base color.
     */
    private static int makeBaseColorBrighter(int baseColor) {
        return (int) (255d - ((255d - ((double) baseColor)) / 3));
    }
}

Related

  1. getSlightlyBrighter(Color color)
  2. hsbToRgB(double hue, double sat, double brightness)
  3. HSBtoRGB(float hue, float saturation, float brightness)
  4. HSBtoRGB(float parHue, float parSaturation, float parBrightness)
  5. increaseBrightness(Image image)
  6. modifyBrightness(Color c, float brightness)
  7. perceivedBrightness(Color c)
  8. setBrightness(Color color, float brightness)
  9. setBrightness(Color color, float brightness)