private void CalcCoordsAndUpdate(ColourHandler.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. colourPoint = 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; selectedColour = ColourHandler.HSVtoColour(HSV); RGB = ColourHandler.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. fullColour = ColourHandler.HSVtoColour(HSV.Hue, HSV.Saturation, 255); }
private void SetHSV(ColourHandler.HSV HSV) { // Update the HSV values on the form. RefreshValue(ksbHue, HSV.Hue); RefreshValue(ksbSaturation, HSV.Saturation); RefreshValue(ksbBrightness, HSV.value); SetHSVLabels(HSV); }
public void Draw(Graphics g, ColourHandler.RGB RGB) { // Given RGB values, calculate HSV and then update the screen. this.g = g; this.HSV = ColourHandler.RGBtoHSV(RGB); CalcCoordsAndUpdate(this.HSV); UpdateDisplay(); }
public void Draw(Graphics g, ColourHandler.HSV HSV) { // Given HSV values, update the screen. this.g = g; this.HSV = HSV; CalcCoordsAndUpdate(this.HSV); UpdateDisplay(); }
private void SetHSV(ColourHandler.HSV hsv) { SetIsUpdating(true); RefreshValue(knumHue, hsv.Hue); RefreshValue(knumSaturation, hsv.Saturation); RefreshValue(knumBrightness, hsv.value); SetIsUpdating(false); }
private void SetHSV(ColourHandler.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(knumHue, HSV.Hue); RefreshValue(knumSaturation, HSV.Saturation); RefreshValue(knumBrightness, HSV.value); isInUpdate = false; }
private void HandleHSVScroll(object sender, ScrollEventArgs e) { _changeStyle = ChangeStyle.HSV; _HSV = new ColourHandler.HSV(ksbHue.Value, ksbSaturation.Value, ksbBrightness.Value); SetRGB(ColourHandler.HSVtoRGB(_HSV)); SetHSV(_HSV); Invalidate(); }
private void HandleHSVScroll(object sender, ScrollEventArgs 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. { changeType = ChangeStyle.HSV; HSV = new ColourHandler.HSV(ksbHue.Value, ksbSaturation.Value, ksbBrightness.Value); SetRGB(ColourHandler.HSVtoRGB(HSV)); SetHSVLabels(HSV); this.Invalidate(); }
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 ColourHandler.HSV((int)(knumHue.Value), (int)(knumSaturation.Value), (int)(knumBrightness.Value)); SetRGB(ColourHandler.HSVtoRGB(HSV)); this.Invalidate(); } }
private void SetHSVLabels(ColourHandler.HSV HSV) { RefreshText(klblHue, HSV.Hue); RefreshText(klblSaturation, HSV.Saturation); RefreshText(klblBrightness, HSV.value); }
protected void OnColourChangedExtended(ColourHandler.RGB rgb, ColourHandler.HSV hsv) { ColourChangedEventArgs cce = new ColourChangedEventArgs(rgb, hsv); ColourChangedExtended(this, cce); }
protected void OnColourChanged(ColourHandler.RGB RGB, ColourHandler.HSV HSV) { ColourChangedEventArgs e = new ColourChangedEventArgs(RGB, HSV); ColourChanged(this, e); }