Beispiel #1
0
        public static Cmyk ToCMYK(Color color)
        {
            var cmyk = new Cmyk();
            var low  = 1.0;

            cmyk.Cyan = (double)(255 - color.R) / 255;
            if (low > cmyk.Cyan)
            {
                low = cmyk.Cyan;
            }

            cmyk.Magenta = (double)(255 - color.G) / 255;
            if (low > cmyk.Magenta)
            {
                low = cmyk.Magenta;
            }

            cmyk.Yellow = (double)(255 - color.B) / 255;
            if (low > cmyk.Yellow)
            {
                low = cmyk.Yellow;
            }

            if (low > 0.0)
            {
                cmyk.Key = low;
            }

            return(cmyk);
        }
Beispiel #2
0
        public static Color ToColor(Cmyk cmyk)
        {
            var red   = ColorHelper.Round(255 - (255 * cmyk.Cyan));
            var green = ColorHelper.Round(255 - (255 * cmyk.Magenta));
            var blue  = ColorHelper.Round(255 - (255 * cmyk.Yellow));

            return(Color.FromArgb(red, green, blue));
        }
Beispiel #3
0
 public void HsbUpdate()
 {
     this.Rgb  = this.Hsb;
     this.Cmyk = this.Hsb;
 }
Beispiel #4
0
 public void RgbUpdate()
 {
     this.Hsb  = this.Rgb;
     this.Cmyk = this.Rgb;
 }
Beispiel #5
0
 public MyColor(Color color)
 {
     this.Rgb  = color;
     this.Hsb  = color;
     this.Cmyk = color;
 }