Here you can find the source of interpolateColors(int a, int b, float lerp)
public static int interpolateColors(int a, int b, float lerp)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Yancarlo Ramsey and CJ Bowman * Licensed as open source with restrictions. Please see attached LICENSE.txt. ******************************************************************************/ public class Main { public static int interpolateColors(int a, int b, float lerp) { final int MASK1 = 0xff00ff; final int MASK2 = 0x00ff00; int f2 = (int) (256 * lerp); int f1 = 256 - f2; return (((((a & MASK1) * f1) + ((b & MASK1) * f2)) >> 8) & MASK1) | (((((a & MASK2) * f1) + ((b & MASK2) * f2)) >> 8) & MASK2); }/*www.j a v a 2 s. c o m*/ }