CSharp examples for System.Drawing:Color
Interpolate color to new color
using System.Drawing; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from w w w. j a v a 2s . co m public class Main{ public static Color Interpolate(this Color from, float ratio, Color to) { var ratioNeg = 1 - ratio; return Color.FromArgb( (int)(from.A * ratioNeg + to.A * ratio), (int)(from.R * ratioNeg + to.R * ratio), (int)(from.G * ratioNeg + to.G * ratio), (int)(from.B * ratioNeg + to.B * ratio)); } }