예제 #1
0
        public static Color CMYKToColor(CMYK cmyk)
        {
            if (cmyk.Cyan == 0 && cmyk.Magenta == 0 && cmyk.Yellow == 0 && cmyk.Key == 1)
            {
                return(Color.FromArgb(cmyk.Alpha, 0, 0, 0));
            }

            double c = (cmyk.Cyan * (1 - cmyk.Key)) + cmyk.Key;
            double m = (cmyk.Magenta * (1 - cmyk.Key)) + cmyk.Key;
            double y = (cmyk.Yellow * (1 - cmyk.Key)) + cmyk.Key;

            int r = (int)Math.Round((1 - c) * 255);
            int g = (int)Math.Round((1 - m) * 255);
            int b = (int)Math.Round((1 - y) * 255);

            return(Color.FromArgb(cmyk.Alpha, r, g, b));
        }
예제 #2
0
        public static Color CMYKToColor(CMYK cmyk)
        {
            if (cmyk.Cyan == 0 && cmyk.Magenta == 0 && cmyk.Yellow == 0 && cmyk.Key == 1)
            {
                return Color.FromArgb(cmyk.Alpha, 0, 0, 0);
            }

            double c = cmyk.Cyan * (1 - cmyk.Key) + cmyk.Key;
            double m = cmyk.Magenta * (1 - cmyk.Key) + cmyk.Key;
            double y = cmyk.Yellow * (1 - cmyk.Key) + cmyk.Key;

            int r = (int)Math.Round((1 - c) * 255);
            int g = (int)Math.Round((1 - m) * 255);
            int b = (int)Math.Round((1 - y) * 255);

            return Color.FromArgb(cmyk.Alpha, r, g, b);
        }
예제 #3
0
        private void tsmiCopyCMYK_Click(object sender, EventArgs e)
        {
            CMYK cmyk = colorPicker.SelectedColor.CMYK;

            ClipboardHelpers.CopyText($"{cmyk.Cyan100:0.0}%, {cmyk.Magenta100:0.0}%, {cmyk.Yellow100:0.0}%, {cmyk.Key100:0.0}%");
        }
예제 #4
0
 public void HSBUpdate()
 {
     RGBA = HSB;
     CMYK = HSB;
 }
예제 #5
0
 public void RGBAUpdate()
 {
     HSB  = RGBA;
     CMYK = RGBA;
 }
예제 #6
0
 public MyColor(Color color)
 {
     RGBA = color;
     HSB  = color;
     CMYK = color;
 }
예제 #7
0
 public void HSBUpdate()
 {
     RGBA = HSB;
     CMYK = HSB;
 }
예제 #8
0
 public void RGBAUpdate()
 {
     HSB = RGBA;
     CMYK = RGBA;
 }
예제 #9
0
 public MyColor(Color color)
 {
     RGBA = color;
     HSB = color;
     CMYK = color;
 }