Exemplo n.º 1
0
        private void CalcCoordsAndUpdate(ColorManagerWheel.HSV HSV)
        {
            // Convert color to real-world coordinates and then calculate
            // the various points. HSV.Hue represents the degrees (0 to 360),
            // HSV.Saturation represents the radius.
            // This procedure doesn't draw anything--it simply
            // updates class-level variables. The UpdateDisplay
            // procedure uses these values to update the screen.

            // Given the angle (HSV.Hue), and distance from
            // the center (HSV.Saturation), and the center,
            // calculate the point corresponding to
            // the selected color, on the color wheel.
            colorPoint = GetPoint((double)HSV.Hue / 255 * 360,
                                  (double)HSV.Saturation / 255 * radius,
                                  centerPoint);

            // Given the brightness (HSV.value), calculate the
            // point corresponding to the brightness indicator.
            brightnessPoint = CalcBrightnessPoint(HSV.value);

            // Store information about the selected color.
            brightness    = HSV.value;
            selectedColor = ColorManagerWheel.HSVtoColor(HSV);
            RGB           = ColorManagerWheel.HSVtoRGB(HSV);

            // The full color is the same as HSV, except that the
            // brightness is set to full (255). This is the top-most
            // color in the brightness gradient.
            fullColor = ColorManagerWheel.HSVtoColor(HSV.Hue, HSV.Saturation, 255);
            //fullColor = ColorManager.SetBrightness(selectedColor, 0.999);
        }
Exemplo n.º 2
0
 public void Draw(Graphics g, ColorManagerWheel.RGB RGB)
 {
     // Given RGB values, calculate HSV and then update the screen.
     this.g   = g;
     this.HSV = ColorManagerWheel.RGBtoHSV(RGB);
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
Exemplo n.º 3
0
 public void Draw(Graphics g, ColorManagerWheel.HSV HSV)
 {
     // Given HSV values, update the screen.
     this.g   = g;
     this.HSV = HSV;
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
 private void SetHSV(ColorManagerWheel.HSV HSV)
 {
     // Update the HSV values on the form, but don't trigger
     // the ValueChanged event of the form. The isInUpdate
     // variable ensures that the event procedures
     // exit without doing anything.
     isInUpdate = true;
     RefreshValue(nudHue, HSV.Hue);
     RefreshValue(nudSaturation, HSV.Saturation);
     RefreshValue(nudBrightness, HSV.value);
     isInUpdate = false;
 }
        private void HandleHSVChange(object sender, EventArgs e)
        {
            // If the H, S, or V values change, use this
            // code to update the RGB values and invalidate
            // the color wheel (so it updates the pointers).
            // Check the isInUpdate flag to avoid recursive events
            // when you update the NumericUpdownControls.
            if (!isInUpdate)
            {
                changeType = ChangeStyle.HSV;
                HSV        = new ColorManagerWheel.HSV((int)(nudHue.Value), (int)(nudSaturation.Value), (int)(nudBrightness.Value));
                ColorManagerWheel.RGB rgb = ColorManagerWheel.HSVtoRGB(HSV);
                SetRGB(rgb);
                this.Invalidate();

                ColorUIEditorPaletteCtrl.ColorPickEventArgs rgs = new ColorUIEditorPaletteCtrl.ColorPickEventArgs();
                rgs.Color = Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue);

                if (ColorChanged != null)
                {
                    ColorChanged(Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue), rgs);
                }
            }
        }
Exemplo n.º 6
0
        protected void OnColorChanged(ColorManagerWheel.RGB RGB, ColorManagerWheel.HSV HSV)
        {
            ColorChangedEventArgs e = new ColorChangedEventArgs(RGB, HSV);

            ColorChanged(this, e);
        }
Exemplo n.º 7
0
		private void HandleHSVChange(object sender, EventArgs e)
		{
			// If the H, S, or V values change, use this 
			// code to update the RGB values and invalidate
			// the color wheel (so it updates the pointers).
			// Check the isInUpdate flag to avoid recursive events
			// when you update the NumericUpdownControls.
			if (! isInUpdate)
			{
				changeType = ChangeStyle.HSV;
				HSV = new ColorManagerWheel.HSV((int) (nudHue.Value), (int) (nudSaturation.Value), (int) (nudBrightness.Value));
				ColorManagerWheel.RGB rgb = ColorManagerWheel.HSVtoRGB(HSV);
				SetRGB(rgb);
				this.Invalidate();

				ColorUIEditorPaletteCtrl.ColorPickEventArgs rgs = new ColorUIEditorPaletteCtrl.ColorPickEventArgs();
				rgs.Color = Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue);

				if (ColorChanged != null)
					ColorChanged(Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue), rgs);
			}
		}
Exemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="RGB"></param>
 /// <param name="HSV"></param>
 public ColorChangedEventArgs(ColorManagerWheel.RGB RGB, ColorManagerWheel.HSV HSV)
 {
     mRGB = RGB;
     mHSV = HSV;
 }
Exemplo n.º 9
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="RGB"></param>
		/// <param name="HSV"></param>
		public ColorChangedEventArgs ( ColorManagerWheel.RGB RGB,  ColorManagerWheel.HSV HSV) 
		{
			mRGB = RGB;
			mHSV = HSV;
		}
Exemplo n.º 10
0
		public void Draw(Graphics g, ColorManagerWheel.RGB RGB)
		{
			// Given RGB values, calculate HSV and then update the screen.
			this.g = g;
			this.HSV = ColorManagerWheel.RGBtoHSV(RGB);
			CalcCoordsAndUpdate(this.HSV);
			UpdateDisplay();
		}
Exemplo n.º 11
0
		public void Draw(Graphics g, ColorManagerWheel.HSV HSV)
		{
			// Given HSV values, update the screen.
			this.g = g;
			this.HSV = HSV;
			CalcCoordsAndUpdate(this.HSV);
			UpdateDisplay();
		}