make Color Brighter - Java 2D Graphics

Java examples for 2D Graphics:Color Dark

Description

make Color Brighter

Demo Code


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

public class Main {
    public static Color makeBrighter(Color curColor, int distance) {
        int red = curColor.getRed();
        int green = curColor.getGreen();
        int blue = curColor.getBlue();

        red += distance;//from w ww  .j a v  a 2  s  .c  o m
        green += distance;
        blue += distance;

        if (red > 255)
            red = 255;
        if (green > 255)
            green = 255;
        if (blue > 255)
            blue = 255;

        return new Color(red, green, blue);
    }
}

Related Tutorials