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); }
private void SetHSVLabels(ColorHandler.HSV HSV) { RefreshText(lblHue, HSV.Hue); RefreshText(lblSaturation, HSV.Saturation); RefreshText(lblValue, HSV.Value); RefreshText(lblAlpha, HSV.Alpha); }
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(); }
private void SetHSV(ColorHandler.HSV HSV) { // Update the HSV values on the form. RefreshValue(tbHue, HSV.Hue); RefreshValue(tbSaturation, HSV.Saturation); RefreshValue(tbValue, HSV.Value); RefreshValue(tbAlpha, HSV.Alpha); SetHSVLabels(HSV); }
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. { changeType = ChangeStyle.HSV; hsv = new ColorHandler.HSV(tbAlpha.Value, tbHue.Value, tbSaturation.Value, tbValue.Value); SetRGB(ColorHandler.HSVtoRGB(hsv)); SetHSVLabels(hsv); Invalidate(); }
// 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(); }
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; this.HSV = HSV; }