CSharp examples for System.Drawing:Color
Returns the result of combining the specified colors
using System.Windows.Media; using System.Windows; using System.Drawing; using System.Text; using System.Collections.Generic; using System;//w ww .j a v a2 s .co m public class Main{ #region Static /// <summary> /// Returns the result of combining the specified colors /// </summary> /// <param name="c1">First color to combine</param> /// <param name="c2">Second olor to combine</param> /// <returns>Average of both colors</returns> public static Color Combine(Color c1, Color c2) { return Color.FromArgb( Convert.ToByte((c1.R + c2.R) / 2), Convert.ToByte((c1.G + c2.G) / 2), Convert.ToByte((c1.B + c2.B) / 2), Convert.ToByte((c1.A + c2.A) / 2) ); } }