Пример #1
0
        public void GetColorFromImage()
        {
            Form_SelectColorFromImage fsci = new Form_SelectColorFromImage()
            {
                Owner = Application.Current.MainWindow
            };

            if (fsci.ShowDialog() != true)
            {
                return;
            }
            Color c     = fsci.GetSelectedColor();
            XY    color = ColorConversion.ConvertRGBToXY(System.Drawing.Color.FromArgb(c.A, c.R, c.G, c.B));

            if (CurrentState.xy == null)
            {
                CurrentState.xy = new XY();
            }
            CurrentState.sat  = 255;
            CurrentState.xy.x = color.x;
            CurrentState.xy.y = color.y;
            OnPropertyChanged("X");
            OnPropertyChanged("Y");
            OnPropertyChanged("Sat");
        }
Пример #2
0
        public void GetColorFromImage()
        {
            Form_SelectColorFromImage fsci = new Form_SelectColorFromImage()
            {
                Owner = Application.Current.MainWindow
            };

            if (fsci.ShowDialog() != true)
            {
                return;
            }
            Color   c     = fsci.GetSelectedColor();
            CGPoint color = HueColorConverter.CalculateXY(c, ((Light)_selectedAvailableLight).modelid);

            if (CurrentState.xy == null)
            {
                CurrentState.xy = new XY();
            }
            CurrentState.sat  = 255;
            CurrentState.xy.x = Convert.ToDecimal(color.x);
            CurrentState.xy.y = Convert.ToDecimal(color.y);
            OnPropertyChanged("X");
            OnPropertyChanged("Y");
            OnPropertyChanged("Sat");
        }