コード例 #1
0
ファイル: ColorSpaceTest.cs プロジェクト: skataben/ColorMine
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor)
        {
            var target = knownColor.To<Yxy>();

            Assert.IsTrue(CloseEnough(expectedColor.Y1,target.Y1),"(Y1)" + expectedColor.Y1 + " != " + target.Y1);
            Assert.IsTrue(CloseEnough(expectedColor.X,target.X),"(X)" + expectedColor.X + " != " + target.X);
            Assert.IsTrue(CloseEnough(expectedColor.Y2,target.Y2),"(Y2)" + expectedColor.Y2 + " != " + target.Y2);
        }
コード例 #2
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor)
        {
            var target = knownColor.To <Yxy>();

            Assert.IsTrue(CloseEnough(expectedColor.Y1, target.Y1), "(Y1)" + expectedColor.Y1 + " != " + target.Y1);
            Assert.IsTrue(CloseEnough(expectedColor.X, target.X), "(X)" + expectedColor.X + " != " + target.X);
            Assert.IsTrue(CloseEnough(expectedColor.Y2, target.Y2), "(Y2)" + expectedColor.Y2 + " != " + target.Y2);
        }
コード例 #3
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor)
        {
            var target = knownColor.To <Yxy>();

            Assert.AreEqual(expectedColor.Y1, target.Y1, 0.5, "(Y1)" + expectedColor.Y1 + " != " + target.Y1);
            Assert.AreEqual(expectedColor.X, target.X, 0.005, "(X)" + expectedColor.X + " != " + target.X);
            Assert.AreEqual(expectedColor.Y2, target.Y2, 0.005, "(Y2)" + expectedColor.Y2 + " != " + target.Y2);
        }
コード例 #4
0
 internal static IRgb ToColor(IYxy item)
 {
     var xyz = new Xyz
         {
             X = item.X * (item.Y1 / item.Y2),
             Y = item.Y1,
             Z = (1.0 - item.X - item.Y2) * (item.Y1 / item.Y2)
         };
     return xyz.ToRgb();
 }
コード例 #5
0
        internal static IRgb ToColor(IYxy item)
        {
            var xyz = new Xyz
            {
                X = item.X * (item.Y1 / item.Y2),
                Y = item.Y1,
                Z = (1.0 - item.X - item.Y2) * (item.Y1 / item.Y2)
            };

            return(xyz.ToRgb());
        }
コード例 #6
0
        internal static void ToColorSpace(IRgb color, IYxy item)
        {
            var xyz = new Xyz();
            xyz.Initialize(color);

            item.Y1 = xyz.Y;

            var xDividend = xyz.X + xyz.Y + xyz.Z;
            item.X = xDividend.BasicallyEqualTo(0) ? 0.0 : xyz.X / xDividend;

            var y2Dividend = xyz.X + xyz.Y + xyz.Z;
            item.Y2 = y2Dividend.BasicallyEqualTo(0) ? 0.0 : xyz.Y / (xyz.X + xyz.Y + xyz.Z);
        }
コード例 #7
0
        internal static void ToColorSpace(IRgb color, IYxy item)
        {
            var xyz = new Xyz();

            xyz.Initialize(color);

            item.Y1 = xyz.Y;

            var xDividend = xyz.X + xyz.Y + xyz.Z;

            item.X = xDividend.BasicallyEqualTo(0) ? 0.0 : xyz.X / xDividend;

            var y2Dividend = xyz.X + xyz.Y + xyz.Z;

            item.Y2 = y2Dividend.BasicallyEqualTo(0) ? 0.0 : xyz.Y / (xyz.X + xyz.Y + xyz.Z);
        }
コード例 #8
0
 public CmyColor(IYxy yxy)
 {
     Initialize(yxy.ToRgb());
 }
コード例 #9
0
 public YxyColor(IYxy yxy)
 {
     Ordinals = yxy.Ordinals;
 }
コード例 #10
0
 public HunterLabColor(IYxy yxy)
 {
     Initialize(yxy.ToRgb());
 }