public void ConvertToRGBTestGreen()
 {
     HSVRGB target = new HSVRGB();
     int r, g, b;
     target.ConvertToRGB(120.0, 1.0, 0.250, out r, out g, out b);
     Assert.AreEqual(0, r);
     Assert.AreEqual(127, g);
     Assert.AreEqual(0, b);
 }
 public void ConvertToRGBTestRed()
 {
     HSVRGB target = new HSVRGB();
     int r, g, b;
     target.ConvertToRGB(0.0, 1.0, 0.5, out r, out g, out b);
     Assert.AreEqual(255, r);
     Assert.AreEqual(0, g);
     Assert.AreEqual(0, b);
 }
 public void ConvertToRGBTestBlack()
 {
     HSVRGB target = new HSVRGB();
     int r, g, b;
     target.ConvertToRGB(180.0, 0.0, 0.0, out r, out g, out b);
     Assert.AreEqual(0, r);
     Assert.AreEqual(0, g);
     Assert.AreEqual(0, b);
 }
Beispiel #4
0
        /// <summary>
        /// Farbwert einer Lampe mittels RGB-System setzen
        /// </summary>
        /// <param name="r">Rot-Wert</param>
        /// <param name="g">Grün-Wert</param>
        /// <param name="b">Blau-Wert</param>
        public void SetColor(int r, int g, int b)
        {
            HSVRGB hsvrgb = new HSVRGB();
            double hue, sat, bri;

            hsvrgb.ConvertToHSL(r, g, b, out hue, out sat, out bri);

            this.hue = hue;
            this.saturation = sat;
            this.brightness = bri;
        }
 public void ConvertToRGBTestWhite()
 {
     HSVRGB target = new HSVRGB();
     int r, g, b;
     target.ConvertToRGB(180.0, 0.0, 1.0, out r, out g, out b);
     Assert.AreEqual(255, r);
     Assert.AreEqual(255, g);
     Assert.AreEqual(255, b);
 }