Parse() public static method

public static Parse ( string value ) : List
value string
return List
Beispiel #1
0
        private static MagickColor CreateColor(string color)
        {
            Throw.IfNullOrEmpty(nameof(color), color);

            if (color[0] == '#')
            {
                List <QuantumType> colors = HexColor.Parse(color);

                if (colors.Count == 4)
                {
                    return(new MagickColor(colors[0], colors[1], colors[2], colors[3], Quantum.Max));
                }
            }

            throw new ArgumentException("Invalid color specified", nameof(color));
        }
Beispiel #2
0
        private void ParseHexColor(string color)
        {
            List <QuantumType> colors = HexColor.Parse(color);

            if (colors.Count == 1)
            {
                Initialize(colors[0], colors[0], colors[0], Quantum.Max);
            }
            else if (colors.Count == 3)
            {
                Initialize(colors[0], colors[1], colors[2], Quantum.Max);
            }
            else
            {
                Initialize(colors[0], colors[1], colors[2], colors[3]);
            }
        }