Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 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);
 }
Example #4
0
File: HueLamp.cs Project: in18/hics
        /// <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;
        }
Example #5
0
 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);
 }