Here you can find the source of mixColors(Color a, Color b, double r)
public static Color mixColors(Color a, Color b, double r)
//package com.java2s; // modify it under the terms of the GNU General Public License import java.awt.Color; public class Main { public static Color mixColors(Color a, Color b, double r) { double s = 1.0f - r; return new Color(boundColor((a.getRed() * r + b.getRed() * s) / 255.0), boundColor((a.getGreen() * r + b.getGreen() * s) / 255.0), boundColor((a.getBlue() * r + b.getBlue() * s) / 255.0)); }/*from w ww. j av a2 s .c o m*/ private static float boundColor(double c) { if (!(c > 0)) return 0; if (c > 1.0) return 1.0f; return (float) c; } }