Exemple #1
0
 public void TestADD()
 {
     var c0   = CS.ColorRGB32Bit.ParseWebColorString("#ff0000");
     var c1   = new CS.ColorRGB(c0);
     var hsl  = new CS.ColorHSL(c1);
     var hsl2 = hsl.Add(-2.3, 0, 0);
 }
Exemple #2
0
        public void test_rgb_to_hsl(double r, double g, double b, double h, double s, double l)
        {
            var    rgb   = new CS.ColorRGB(r, g, b);
            var    hsl   = new CS.ColorHSL(rgb);
            double delta = 0.0000000000000001;

            Assert.AreEqual(h, hsl.H, delta);
            Assert.AreEqual(s, hsl.S, delta);
            Assert.AreEqual(l, hsl.L, delta);
        }
Exemple #3
0
        public void TestHueRotation_HSL()
        {
            // 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.ColorHSL(c2);
            var c4 = new CS.ColorHSL(0.5, c3.S, c3.L);
            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);
        }