public static bool ParseCMYK(string input, out CMYK color) { Match matchCMYK = Regex.Match(input, @"^([0-9]?[0-9](?:[.][0-9]?[0-9]?[0-9]|)|100)(?:\s|,)+([0-9]?[0-9](?:[.][0-9]?[0-9]?[0-9]|)|100)(?:\s|,)+([0-9]?[0-9](?:[.][0-9]?[0-9]?[0-9]|)|100)(?:\s|,)+([0-9]?[0-9](?:[.][0-9]?[0-9]?[0-9]|)|100)(?:\s)?$"); if (matchCMYK.Success) { color = new CMYK(float.Parse(matchCMYK.Groups[1].Value), float.Parse(matchCMYK.Groups[2].Value), float.Parse(matchCMYK.Groups[3].Value), float.Parse(matchCMYK.Groups[4].Value)); return(true); } color = Color.Empty; return(false); }
/// <summary> /// Convert the current color to a CMYK color. /// </summary> /// <returns>An CMYK representation of this color.</returns> public CMYK ToCMYK() { return(CMYK.FromARGB(A, R, G, B)); }