Effectuer une interpolation linéaire entre 2 cou...5 octobre 2011

La fonction gère également la variation de Alpha qui pourrait y avoir entre les couleurs.
private Color GetGradientColor(Color from, Color to, double ratio)
{
var aDiff = to.A - from.A;
var rDiff = to.R - from.R;
var gDiff = to.G - from.G;
var bDiff = to.B - from.B;
return Color.FromArgb((byte)(from.A + ratio * aDiff), (byte)(from.R + ratio * rDiff),
(byte)(from.G + ratio * gDiff), (byte)(from.B + ratio * bDiff));
}
Aucun commentaire pour le moment. Soyez le/la premi(er/ère).