duck

duck

Feb 2nd, 2010
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public static Color[] ToColorArray(string str)
  2. {
  3. int NumberChars = str.Length;
  4. Color[] colors = new Color[NumberChars / 6];
  5. for (int i = 0; i < NumberChars; i += 6)
  6. {
  7. float r = System.Convert.ToInt32(str.Substring(i, 2), 16);
  8. float g = System.Convert.ToInt32(str.Substring(i+2, 2), 16);
  9. float b = System.Convert.ToInt32(str.Substring(i+4, 2), 16);
  10. colors[i / 6] = new Color(r, g, b);
  11. }
  12. return colors;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment