Beispiel #1
0
 /// <summary>
 /// Interpolates between the given colors using the given extended interpolation function.
 /// </summary>
 /// <param name="past">The past value.</param>
 /// <param name="bottom">The bottom value.</param>
 /// <param name="top">The top value.</param>
 /// <param name="future">The future value.</param>
 /// <param name="mu">The mu value.</param>
 /// <param name="func">The extended interpolation function to use.</param>
 /// <returns>The resulting color.</returns>
 public static ARGB Interpolate(ARGB past, ARGB bottom, ARGB top, ARGB future, double mu, ExtendedInterpFunction func)
 {
     return new ARGB(InterpByte(past.A, bottom.A, top.A, future.A, mu, func),
                     InterpByte(past.R, bottom.R, top.R, future.R, mu, func),
                     InterpByte(past.G, bottom.G, top.G, future.G, mu, func),
                     InterpByte(past.B, bottom.B, top.B, future.B, mu, func));
 }
Beispiel #2
0
 /// <summary>
 /// Interpolates the given bytes.
 /// </summary>
 /// <param name="past">The past value.</param>
 /// <param name="bottom">The bottom value.</param>
 /// <param name="top">The top value.</param>
 /// <param name="future">The future value.</param>
 /// <param name="mu">The mu value.</param>
 /// <param name="interpFunc">The extended interpolation function.</param>
 /// <returns>The interpolated byte.</returns>
 private static byte InterpByte(byte past, byte bottom, byte top, byte future, double mu, ExtendedInterpFunction interpFunc)
 {
     return (byte)Util.Clip(interpFunc(past, bottom, top, future, mu), 0, 255);
 }