Beispiel #1
0
        public static bool TryParse(string name, out Color color)
        {
            uint val;

            if (!TryParseColourFromHex(name, out val))
            {
                color = Colors.White;
                return(false);
            }
            color = Color.FromBytes((byte)(val >> 24), (byte)((val >> 16) & 0xff), (byte)((val >> 8) & 0xff), (byte)(val & 0xff));
            return(true);
        }
Beispiel #2
0
        public static bool TryParse(string name, out Color color)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            uint val;

            if (name.Length == 0 || !TryParseColourFromHex(name, out val))
            {
                color = default(Color);
                return(false);
            }
            color = Color.FromBytes((byte)(val >> 24), (byte)((val >> 16) & 0xff), (byte)((val >> 8) & 0xff), (byte)(val & 0xff));
            return(true);
        }
Beispiel #3
0
 //
 // Color
 //
 public static Color ToXwtColor(this SW.Media.Color color)
 {
     return(Color.FromBytes(color.R, color.G, color.B, color.A));
 }
Beispiel #4
0
 public static Color FromArgb(byte r, byte g, byte b)
 {
     return(Color.FromBytes(r, g, b));
 }