Ejemplo n.º 1
0
        /// <summary>
        /// Converts this colour to a web-compatible hexadecimal string value.
        /// </summary>
        /// <returns>A hex colour string.</returns>
        public override string ToHexColor()
        {
            /* please note that this is only an approximate conversion
             * and will probably not match exactly what appears in
             * Photoshop/Illustrator; it's intended to be used for quick
             * display and preview purposes only.
             *
             * algorithm kindly provided by http://www.rapidtables.com/convert/color/cmyk-to-rgb.htm
             * */

            var r = TryConvertToByte(255 * (1 - Cyan) * (1 - Black));
            var g = TryConvertToByte(255 * (1 - Magenta) * (1 - Black));
            var b = TryConvertToByte(255 * (1 - Yellow) * (1 - Black));

            return(XmpSwatch.RgbToHex(r, g, b));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts this colour to a web-compatible hexadecimal string value.
 /// </summary>
 /// <returns>A hex colour string.</returns>
 public override string ToHexColor()
 {
     // TODO: implement a formula for a very basic conversion to sRGB
     return(XmpSwatch.RgbToHex(0, 0, 0));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts this colour to a web-compatible hexadecimal string value.
 /// </summary>
 /// <returns>A hex colour string.</returns>
 public override string ToHexColor()
 {
     return(XmpSwatch.RgbToHex(Gray, Gray, Gray));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Converts this colour to a web-compatible hexadecimal string value.
 /// </summary>
 /// <returns>A hex colour string.</returns>
 public override string ToHexColor()
 {
     return(XmpSwatch.RgbToHex(Red, Green, Blue));
 }