Here you can find the source of interpolateColor(float[] result, float[] color0, float[] color1, double s)
(1-s) color0 + s color1
and places the result in result
.
Parameter | Description |
---|---|
result | result value |
color0 | first color |
color1 | second color |
s | interpolation parameter |
public static void interpolateColor(float[] result, float[] color0, float[] color1, double s)
//package com.java2s; //License from project: BSD License public class Main { /**/*from www.j av a2s.c o m*/ * Computes <code>(1-s) color0 + s color1</code> and places the result * in <code>result</code>. Only the first three array entries are used. * * @param result result value * @param color0 first color * @param color1 second color * @param s interpolation parameter */ public static void interpolateColor(float[] result, float[] color0, float[] color1, double s) { float a = (float) (1 - s); float b = (float) (s); result[0] = a * color0[0] + b * color1[0]; result[1] = a * color0[1] + b * color1[1]; result[2] = a * color0[2] + b * color1[2]; } }