/// <summary> /// Mixes two colors based on the specified amount. If the amount is 0.0, /// the resulting color will be A. If the amount is 1.0, the resulting color /// will be B. Values in between will cause the color to be interpolated. /// </summary> public static Color Mix(Color A, Color B, double Amount) { double rd = B.R - A.R; double gd = B.G - A.G; double bd = B.B - A.B; double ad = B.A - A.A; return RGBA( A.R + (rd * Amount), A.G + (gd * Amount), A.B + (bd * Amount), A.A + (ad * Amount)); }
/// <summary> /// Creates a color from its RGBA representation. Values should be between /// 0.0 and 1.0. /// </summary> public static Color RGBA(double R, double G, double B, double A) { Color c = new Color(); c.R = R; c.G = G; c.B = B; c.A = A; return c; }