Here you can find the source of premultiplyAlpha(Color fgColor, Color bgColor)
public static final Color premultiplyAlpha(Color fgColor, Color bgColor)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static final Color premultiplyAlpha(Color fgColor, Color bgColor) { int r, g, b; r = fgColor.getRed() * fgColor.getAlpha() + bgColor.getRed() * (255 - fgColor.getAlpha()); g = fgColor.getGreen() * fgColor.getAlpha() + bgColor.getGreen() * (255 - fgColor.getAlpha()); b = fgColor.getBlue() * fgColor.getAlpha() + bgColor.getBlue() * (255 - fgColor.getAlpha()); Color result = new Color(r / 255, g / 255, b / 255); return result; }/*from www . ja v a2s .c o m*/ }