Here you can find the source of blend(Color c0, Color c1)
public static Color blend(Color c0, Color c1)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static Color blend(Color c0, Color c1) { double totalAlpha = c0.getAlpha() + c1.getAlpha(); double weight0 = c0.getAlpha() / totalAlpha; double weight1 = c1.getAlpha() / totalAlpha; double r = weight0 * c0.getRed() + weight1 * c1.getRed(); double g = weight0 * c0.getGreen() + weight1 * c1.getGreen(); double b = weight0 * c0.getBlue() + weight1 * c1.getBlue(); double a = Math.max(c0.getAlpha(), c1.getAlpha()); return new Color((int) r, (int) g, (int) b, (int) a); }//w ww . j a v a 2 s . c o m }