Calculate the color at a given point on a gradient between two colors?

You simply linearly interpolate the red, the green, and the blue channels like this:

double resultRed = color1.red + percent * (color2.red - color1.red);
double resultGreen = color1.green + percent * (color2.green - color1.green);
double resultBlue = color1.blue + percent * (color2.blue - color1.blue);

where percent is a value between 0 and 1 (location in your first method prototype).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)