Пример #1
0
 public RandomColorGenerator()
 {
     _random      = new Random();
     currentColor = new ColorMine.ColorSpaces.Hsv {
         H = 0.0d, S = 1.0d, V = 1.0d
     };
 }
Пример #2
0
            public void GoldenrodRgbToHsv()
            {
                var knownColor = new Rgb { R = 218, G = 165, B = 32, };
                var expectedColor = new Hsv { H = 42.903, S = .85, V = .85, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #3
0
            public void BlackRgbToHsv()
            {
                var knownColor = new Rgb { R = 0, G = 0, B = 0, };
                var expectedColor = new Hsv { H = 0, S = 0, V = 0, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #4
0
            public void AquamarineHsvToYxy()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Yxy { Y1 = 80.785, X = .26591, Y2 = .38090, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #5
0
            public void AquamarineHsvToXyz()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Xyz { X = 56.396, Y = 80.785, Z = 74.908, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #6
0
            public void AquamarineHsvToRgb()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Rgb { R = 127, G = 255, B = 212, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #7
0
            public void AquamarineHsvToLuv()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Luv { L = 92.036, U = -55.917, V = 21.99756, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #8
0
            public void AquamarineHsvToLch()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Lch { L = 92.036, C = 46.545, H = 167.957, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #9
0
            public void AquamarineHsvToLab()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Lab { L = 92.036, A = -45.521, B = 9.49689, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #10
0
            public void AquamarineHsvToHsl()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Hsl { H = 160, S = 100, L = 74.9019, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #11
0
            public void AquamarineHsvToCmyk()
            {
                var knownColor = new Hsv { H = 160, S = .5, V = 1, };
                var expectedColor = new Cmyk { C = .5, M = 0, Y = .16666, K = 0, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
Пример #12
0
            public void WhiteRgbToHsv()
            {
                var knownColor = new Rgb { R = 255, G = 255, B = 255, };
                var expectedColor = new Hsv { H = 0, S = 0, V = 1, };

                ExpectedValuesForKnownColor(knownColor,expectedColor);
            }
        private void UpdateRgbFromHsv()
        {
            Hsv hsv = new Hsv() { H = this.hue, S = this.saturation / 100.0, V = this.value / 100.0 };
            Rgb rgb = hsv.To<Rgb>();

            if (this.red != (int)rgb.R)
            {
                this.red = (int)rgb.R;
                this.OnPropertyChanged("Red");
            }

            if (this.green != (int)rgb.G)
            {
                this.green = (int)rgb.G;
                this.OnPropertyChanged("Green");
            }

            if (this.blue != (int)rgb.B)
            {
                this.blue = (int)rgb.B;
                this.OnPropertyChanged("Blue");
            }
        }