コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #4
0
ファイル: HueLamp.cs プロジェクト: 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;
        }
コード例 #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);
 }