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); RGB = 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.Hue, HSV.Saturation, 255); }
public void Draw(Graphics g, ColorHandler.RGB RGB) { // Given RGB values, calculate HSV and then update the screen. this.g = g; this.HSV = ColorHandler.RGBtoHSV(RGB); CalcCoordsAndUpdate(this.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, 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); //textBoxHexColor.Text = ColorTranslator.ToHtml(Color); isInUpdate = false; }
public ColorChangedEventArgs(ColorHandler.RGB RGB, ColorHandler.HSV HSV) { mRGB = RGB; mHSV = HSV; }
protected void OnColorChanged(ColorHandler.RGB RGB, ColorHandler.HSV HSV) { ColorChangedEventArgs e = new ColorChangedEventArgs(RGB, HSV); ColorChanged(this, e); }