예제 #1
0
        internal static void ToColorSpace(IRgb color, ICmyk item)
        {
            var cmy = new Cmy();

            cmy.Initialize(color);

            var k = 1.0;

            if (cmy.C < k)
            {
                k = cmy.C;
            }
            if (cmy.M < k)
            {
                k = cmy.M;
            }
            if (cmy.Y < k)
            {
                k = cmy.Y;
            }
            item.K = k;

            if (k.BasicallyEqualTo(1))
            {
                item.C = 0;
                item.M = 0;
                item.Y = 0;
            }
            else
            {
                item.C = (cmy.C - k) / (1 - k);
                item.M = (cmy.M - k) / (1 - k);
                item.Y = (cmy.Y - k) / (1 - k);
            }
        }
예제 #2
0
        public static void ToColorSpace(IRgb color, ICmyk item)
        {
            var cmy = new Cmy();
            cmy.Initialize(color);

            var k = 1.0;
            if (cmy.C < k)
                k = cmy.C;
            if (cmy.M < k)
                k = cmy.M;
            if (cmy.Y < k)
                k = cmy.Y;
            item.K = k;

            if (k.BasicallyEqualTo(1))
            {
                item.C = 0;
                item.M = 0;
                item.Y = 0;
            }
            else
            {
                item.C = (cmy.C - k) / (1 - k);
                item.M = (cmy.M - k) / (1 - k);
                item.Y = (cmy.Y - k) / (1 - k);
            }
        }
예제 #3
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor)
        {
            var target = knownColor.To<Cmyk>();

            Assert.IsTrue(CloseEnough(expectedColor.C,target.C),"(C)" + expectedColor.C + " != " + target.C);
            Assert.IsTrue(CloseEnough(expectedColor.M,target.M),"(M)" + expectedColor.M + " != " + target.M);
            Assert.IsTrue(CloseEnough(expectedColor.Y,target.Y),"(Y)" + expectedColor.Y + " != " + target.Y);
            Assert.IsTrue(CloseEnough(expectedColor.K,target.K),"(K)" + expectedColor.K + " != " + target.K);
        }
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor)
        {
            var target = knownColor.To <Cmyk>();

            Assert.IsTrue(CloseEnough(expectedColor.C, target.C), "(C)" + expectedColor.C + " != " + target.C);
            Assert.IsTrue(CloseEnough(expectedColor.M, target.M), "(M)" + expectedColor.M + " != " + target.M);
            Assert.IsTrue(CloseEnough(expectedColor.Y, target.Y), "(Y)" + expectedColor.Y + " != " + target.Y);
            Assert.IsTrue(CloseEnough(expectedColor.K, target.K), "(K)" + expectedColor.K + " != " + target.K);
        }
예제 #5
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor)
        {
            var target = knownColor.To <Cmyk>();

            Assert.AreEqual(expectedColor.C, target.C, 0.005, "(C)" + expectedColor.C + " != " + target.C);
            Assert.AreEqual(expectedColor.M, target.M, 0.005, "(M)" + expectedColor.M + " != " + target.M);
            Assert.AreEqual(expectedColor.Y, target.Y, 0.005, "(Y)" + expectedColor.Y + " != " + target.Y);
            Assert.AreEqual(expectedColor.K, target.K, 0.005, "(K)" + expectedColor.K + " != " + target.K);
        }
예제 #6
0
        internal static IRgb ToColor(ICmyk item)
        {
            var cmy = new Cmy
            {
                C = (item.C * (1 - item.K) + item.K),
                M = (item.M * (1 - item.K) + item.K),
                Y = (item.Y * (1 - item.K) + item.K)
            };

            return(cmy.ToRgb());
        }
예제 #7
0
 public static IRgb ToColor(ICmyk item, Uri profile)
 {
     var points = new[] { (float)item.C, (float)item.M, (float)item.Y, (float)item.K };
     var color = Color.FromValues(points, profile);
     return new Rgb
         {
             R = color.R,
             G = color.G,
             B = color.B
         };
 }
예제 #8
0
        public static IRgb ToColor(ICmyk item)
        {
            var cmy = new Cmy
                {
                    C = (item.C * (1 - item.K) + item.K),
                    M = (item.M * (1 - item.K) + item.K),
                    Y = (item.Y * (1 - item.K) + item.K)
                };

            return cmy.ToRgb();
        }
        public static IRgb ToColor(ICmyk item)
        {
            var cmy = new Cmy
            {
                C = item.C * (1 - item.K) + item.K,
                M = item.M * (1 - item.K) + item.K,
                Y = item.Y * (1 - item.K) + item.K
            };

            return(cmy.ToRgb());
        }
예제 #10
0
        public static IRgb ToColor(ICmyk item, Uri profile)
        {
            var points = new[] { (float)item.C, (float)item.M, (float)item.Y, (float)item.K };
            var color  = Color.FromValues(points, profile);

            return(new Rgb
            {
                R = color.R,
                G = color.G,
                B = color.B
            });
        }
예제 #11
0
        public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile, Uri rgbProfile)
        {
            if (rgbProfile == null)
            {
                ToColorSpace(color, item, cmykProfile);
                return;
            }

            var cmyk = WindowsColorSystem.TranslateColor(color, cmykProfile, rgbProfile);
            item.C = cmyk.C;
            item.M = cmyk.M;
            item.Y = cmyk.Y;
            item.K = cmyk.K;
        }
예제 #12
0
        public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile)
        {
            if (cmykProfile == null)
            {
                ToColorSpace(color, item);
                return;
            }

            var cmyk = CmykProfileConverter.TranslateColor(color, cmykProfile);
            item.C = cmyk.C;
            item.M = cmyk.M;
            item.Y = cmyk.Y;
            item.K = cmyk.K;
        }
예제 #13
0
        public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile, Uri rgbProfile)
        {
            if (rgbProfile == null)
            {
                ToColorSpace(color, item, cmykProfile);
                return;
            }

            var cmyk = CmykProfileConverter.TranslateColor(color, cmykProfile, rgbProfile);

            item.C = cmyk.C;
            item.M = cmyk.M;
            item.Y = cmyk.Y;
            item.K = cmyk.K;
        }
예제 #14
0
 public CmyColor(ICmyk cmyk)
 {
     Initialize(cmyk.ToRgb());
 }
예제 #15
0
 public HunterLabColor(ICmyk cmyk)
 {
     Initialize(cmyk.ToRgb());
 }
예제 #16
0
 public CmykColor(ICmyk cmyk)
 {
     Ordinals = cmyk.Ordinals;
 }