CubicSpline colour interpolation


(David Rutten) #1

I’m using CubicSpline at the moment to create colour gradients. Gradients are basically defined as sorted tuples of doubles and colours. At the moment I’m creating four separate cubics (one for red, one for green, one for blue and one for alpha), but I’d rather move to a system that supports various colour models and in this wider scheme it would be a lot easier if I could get the contribution of each of the surrounding colours.

Is it possible to achieve this using the CubicSpline class? Something like the following:

void CubicSpline.GetContribution(double t, 
                          out int index0, out double weight0, 
                          out int index1, out double weight1, 
                          out int index2, out double weight2, 
                          out int index3, out double weight3);