Here you can find the source of brighten(Color c, double f)
public static Color brighten(Color c, double f)
//package com.java2s; /*/*from w w w .j ava 2 s. com*/ * Copyright (C) 2015 University of Oregon * * You may distribute under the terms of either the GNU General Public * License or the Apache License, as specified in the LICENSE file. * * For more information, see the LICENSE file. */ import java.awt.*; public class Main { /** * Brighten a color by a given amount */ public static Color brighten(Color c, double f) { return mix(c, Color.white, f); } /** * Mix two colors by a given amount */ public static Color mix(Color c1, Color c2, double f) { if (f >= 1.0) return c2; if (f <= 0) return c1; double r1 = c1.getRed(); double g1 = c1.getGreen(); double b1 = c1.getBlue(); double r2 = c2.getRed(); double g2 = c2.getGreen(); double b2 = c2.getBlue(); double r = f * r2 + (1 - f) * r1; double g = f * g2 + (1 - f) * g1; double b = f * b2 + (1 - f) * b1; Color c3 = new Color(Math.min((int) (r), 255), Math.min((int) (g), 255), Math.min((int) (b), 255)); return c3; } }