Ejemplo n.º 1
0
 void updateHSV()
 {
     H = TruncateFloat(hue * 240, 0, 239);
     S = TruncateFloat(sat * 240, 0, 240);
     L = TruncateFloat(lig * 240, 0, 240);
     HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
     STextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
     LTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
 }
Ejemplo n.º 2
0
 private void HTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (!HSVfreez)
     {
         RGBfreez = true;
         if (H >= 240)
         {
             H = 239;
             HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
         }
         hue = H / 240.0f;
         ChangeHSV();
         updateRGB();
         buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B));
         RGBfreez = false;
     }
 }
Ejemplo n.º 3
0
        void SetCross(Point p)
        {
            CrossTranslate.X = p.X / image1.ActualWidth;
            CrossTranslate.Y = p.Y / image1.ActualWidth;
            if (!HSVfreez)
            {
                RGBfreez = true;
                hue      = (float)CrossTranslate.X;
                sat      = 1 - (float)CrossTranslate.Y;
                if (hue < 0.001)
                {
                    hue = 0.001f;
                }
                if (sat < 0.001)
                {
                    sat = 0.001f;
                }
                if (hue >= 1)
                {
                    hue = 0.999f;
                }
                if (sat >= 1)
                {
                    sat = 0.999f;
                }
                H        = (byte)(hue * 240);
                S        = (byte)(sat * 240);
                HSVfreez = true;
                HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
                STextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
                HSVfreez = false;

                ChangeHSV();
                updateRGB();
                buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B));
                GradientStop.Color     = GetMaxColor();
                RGBfreez = false;
            }
        }