Here you can find the source of interpolateColor(int c1, int c2, int st, int sts)
public static int interpolateColor(int c1, int c2, int st, int sts)
//package com.java2s; //License from project: Open Source License public class Main { public static int interpolateColor(int c1, int c2, int st, int sts) { return combine(interpolate(getR(c1), getR(c2), st, sts), interpolate(getG(c1), getG(c2), st, sts), interpolate(getB(c1), getB(c2), st, sts)); }/*from www . j a v a 2 s.c o m*/ public static int combine(int r, int g, int b) { int rgb = (r & 0xFF) << 16 | (g & 0xFF) << 8 | b & 0xFF; return rgb; } public static int interpolate(float firstColor, float secondColor, float stage, float maxStages) { return (int) (firstColor + (secondColor - firstColor) * stage / maxStages); } public static int getR(int color) { return color >> 16 & 255; } public static int getG(int color) { return color >> 8 & 255; } public static int getB(int color) { return color & 255; } }