Here you can find the source of mix(Color a, Color b, double percent)
Parameter | Description |
---|---|
a | Base colour. |
b | Colour to mix in. |
percent | Percentage of the old colour to keep around. |
public static Color mix(Color a, Color b, double percent)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { /**/*from w ww . ja va2s . c o m*/ * Mixes two colours. * * @param a Base colour. * @param b Colour to mix in. * @param percent Percentage of the old colour to keep around. * @return the mixed Color */ public static Color mix(Color a, Color b, double percent) { return new Color((int) (a.getRed() * percent + b.getRed() * (1.0 - percent)), (int) (a.getGreen() * percent + b.getGreen() * (1.0 - percent)), (int) (a.getBlue() * percent + b.getBlue() * (1.0 - percent))); } }