private void CalcCoordsAndUpdate(ColorHandler.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 = ColorHandler.HSVtoColor(HSV); argb = ColorHandler.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 = ColorHandler.HSVtoColor(HSV.Alpha, HSV.Hue, HSV.Saturation, 255); }
public void Draw(Graphics g, ColorHandler.ARGB argb) { // Given RGB values, calculate HSV and then update the screen. this.g = g; HSV = ColorHandler.RGBtoHSV(argb); CalcCoordsAndUpdate(HSV); UpdateDisplay(); }
public void Draw(Graphics g, ColorHandler.HSV hsv) { // Given HSV values, update the screen. _g = g; _hsv = hsv; CalcCoordsAndUpdate(_hsv); UpdateDisplay(); }
public void Draw(Graphics g, ColorHandler.HSV HSV) { // Given HSV values, update the screen. this.g = g; this.HSV = HSV; CalcCoordsAndUpdate(this.HSV); UpdateDisplay(); }
/// <summary> /// The handle hsv scroll. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void HandleHSVScroll(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. this.changeType = ChangeStyle.HSV; this.hsv = new ColorHandler.HSV(this.tbAlpha.Value, this.tbHue.Value, this.tbSaturation.Value, this.tbValue.Value); this.SetRGB(ColorHandler.HSVtoRGB(this.hsv)); this.SetHSVLabels(this.hsv); this.Invalidate(); }
public ColorChangedEventArgs(ColorHandler.ARGB argb, ColorHandler.HSV HSV) { ARGB = argb; this.HSV = HSV; }
protected void OnColorChanged(ColorHandler.ARGB argb, ColorHandler.HSV HSV) { var e = new ColorChangedEventArgs(argb, HSV); ColorChanged(this, e); }
public ColorChangedEventArgs(ColorHandler.ARGB argb, ColorHandler.HSV hsv) { ARGB = argb; HSV = hsv; }
// 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. private void HandleHSVScroll(object sender, EventArgs e) { changeType = ChangeStyle.HSV; hsv = new ColorHandler.HSV(tbAlpha.Value, tbHue.Value, tbSaturation.Value, tbValue.Value); SetRGB(ColorHandler.HSVtoRGB(hsv)); SetHSVLabels(hsv); Invalidate(); }
public void Draw(Graphics g, ColorHandler.ARGB argb) { // Given RGB values, calculate HSV and then update the screen. this.g = g; hsv = ColorHandler.RGBtoHSV(argb); CalcCoordsAndUpdate(hsv); UpdateDisplay(); }
public void Draw(Graphics g, ColorHandler.HSV HSV) { // Given HSV values, update the screen. this.g = g; this.hsv = HSV; CalcCoordsAndUpdate(this.hsv); UpdateDisplay(); }