Пример #1
0
        public void test_rgb_to_hsv(double r, double g, double b, double h, double s, double v)
        {
            var    rgb   = new CS.ColorRGB(r, g, b);
            var    hsv   = new CS.ColorHSV(rgb);
            double delta = 0.0000000000000001;

            Assert.AreEqual(h, hsv.H, delta);
            Assert.AreEqual(s, hsv.S, delta);
            Assert.AreEqual(v, hsv.V, delta);
        }
Пример #2
0
        public void TestHueRotation_HSV()
        {
            // Spin 0xff0000 around by hue +1.0 - it should end up in 0x00ffff
            var c1 = new CS.ColorRGB32Bit(255, 0, 0);
            var c2 = new CS.ColorRGB(c1);
            var c3 = new CS.ColorHSV(c2);
            var c4 = new CS.ColorHSV(0.5, c3.S, c3.V);
            var c5 = new CS.ColorRGB(c4);
            var c6 = new CS.ColorRGB32Bit(c5);

            Assert.AreEqual(255, c6.Alpha);
            Assert.AreEqual(0, c6.R);
            Assert.AreEqual(255, c6.G);
            Assert.AreEqual(255, c6.B);
        }