Here you can find the source of combineColors(int fgColor, int bgColor, int pctFg)
public static int combineColors(int fgColor, int bgColor, int pctFg)
//package com.java2s; public class Main { public static int combineColors(int fgColor, int bgColor, int pctFg) { int resColor = 0; if (pctFg < 1) { resColor = bgColor;//from www .ja v a 2 s.c o m } else if (pctFg == 100) { resColor = fgColor; } else { int pctBg = 100 - pctFg; resColor = // Red (((((((fgColor >> 16) & 0xff) * pctFg) + (((bgColor >> 16) & 0xff) * pctBg))) / 100) << 16) | // Green (((((((fgColor >> 8) & 0xff) * pctFg) + (((bgColor >> 8) & 0xff) * pctBg))) / 100) << 8) | // Blue (((((fgColor & 0xff) * pctFg) + ((bgColor & 0xff) * pctBg))) / 100); } return resColor; } }