public static int interp(int c1,int c2,double frac){
  double ifrac=1 - frac;
  return rgba((int)Math.round(frac * red(c2) + ifrac * red(c1)),(int)Math.round(frac * green(c2) + ifrac * green(c1)),(int)Math.round(frac * blue(c2) + ifrac * blue(c1)),(int)Math.round(frac * alpha(c2) + ifrac * alpha(c1)));
}

public static int interp ( int c1 , int c2 , double frac ) { double ifrac = 1 - frac ; return rgba ( ( int ) Math . round ( frac * red ( c2 ) + ifrac * red ( c1 ) ) , ( int ) Math . round ( frac * green ( c2 ) + ifrac * green ( c1 ) ) , ( int ) Math . round ( frac * blue ( c2 ) + ifrac * blue ( c1 ) ) , ( int ) Math . round ( frac * alpha ( c2 ) + ifrac * alpha ( c1 ) ) ) ; }
interpolate between two color values by the given mixing proportion . a mixing fraction of 0 will result in c1 , a value of 1 . 0 will result in c2 , and value of 0 . 5 will result in the color mid - way between the two in rgb color space .
