private void setColor(Color newColor)
        {
            double hue = 0.0;

            double saturation = 0.0;

            double value = 0.5;

            ColorUtil.RgbToHsv(newColor.R, newColor.G, newColor.B, out hue, out saturation, out value);

            lastValue = new HSVvalues()
            {
                alpha = newColor.A, hue = hue, saturation = saturation, value = value
            };

            setColorPicker(hue, saturation, value);
        }
        private void setColorPicker(double hue, double saturation, double value)
        {
            do
            {
                UIElement pick;

                if (backCanvas.Children.Count == 0)
                {
                    Ellipse rect = new Ellipse();

                    rect.Fill = Brushes.Black;

                    rect.Width = 5;

                    rect.Height = 5;

                    backCanvas.Children.Add(rect);

                    rect.RenderTransform = new TranslateTransform(-2.0, -2.0);
                }

                pick = backCanvas.Children[0];


                double minDuametr = hsImage.ActualWidth;

                if (hsImage.ActualWidth > hsImage.ActualHeight)
                {
                    minDuametr = hsImage.ActualHeight;
                }

                double radius = (minDuametr / 2);

                if (hue > 180.0)
                {
                    hue = hue - 360.0;
                }

                double angleRadians = hue / (180.0 / Math.PI);

                double ltang = Math.Tan(angleRadians);

                double yRel = Math.Sqrt((saturation * radius) * (saturation * radius) / (1 + ltang * ltang));

                double xRel = yRel * ltang;

                if (hue > -90.0 && hue < 90.0)
                {
                    xRel = -xRel;

                    yRel = -yRel;
                }

                lastValue = new HSVvalues()
                {
                    alpha = lastValue.alpha, hue = hue, saturation = saturation, value = value
                };

                Canvas.SetTop(pick, -xRel + radius - 2.0);

                Canvas.SetLeft(pick, -yRel + radius - 1.0);

                if ((value * 100.0) > valueSlider.Minimum)
                {
                    isNeedModify = true;
                }

                valueSlider.Value = value * 100.0;

                valueSlider_ValueChanged(null, null);

                isNeedModify = false;
            } while (false);
        }