THE_LORD

Combine Colors

Dec 8th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. public static Color Mix2Colors(Color C1, Color C2)
  2. {
  3.     int[] Colors = new int[] {C1.R,C2.R,C1.G,C2.G,C1.B,C2.B };
  4.     return Color.FromArgb(Convert.ToInt32((Colors[0] + Colors[1]) / 2), Convert.ToInt32((Colors[2] + Colors[3]) / 2), Convert.ToInt32((Colors[4] + Colors[5]) / 2));
  5. }
  6.  
  7. public static Color Mix3Colors(Color C1, Color C2, Color C3)
  8. {
  9.     int[] Colors = new int[] {C1.R,C2.R,C3.R,C1.G,C2.G, C3.G,C1.B,C2.B,C3.B };
  10.     return Color.FromArgb(Convert.ToInt32((Colors[0] + Colors[1] + Colors[2]) / 3), Convert.ToInt32((Colors[3] + Colors[4] + Colors[5]) / 3), Convert.ToInt32((Colors[6] + Colors[7] + Colors[8]) / 3));
  11. }
  12.  
  13. public static Color Mix4Colors(Color C1, Color C2, Color C3, Color C4)
  14. {
  15.     int[] Colors = new int[] {C1.R,C2.R,C3.R,C4.R,C1.G,C2.G,C3.G,C4.G,C1.B,C2.B,C3.B,C4.B};
  16.     return Color.FromArgb(Convert.ToInt32((Colors[0] + Colors[1] + Colors[2] + Colors[3]) / 4), Convert.ToInt32((Colors[4] + Colors[5] + Colors[6] + Colors[7]) / 4), Convert.ToInt32((Colors[8] + Colors[9] + Colors[10] + Colors[11]) / 4));
  17. }
Advertisement
Add Comment
Please, Sign In to add comment