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.Hsv hsv) { // Given HSV values, update the screen. _g = g; _hsv = hsv; CalcCoordsAndUpdate(_hsv); UpdateDisplay(); }
public void Draw(Graphics g, ColorHandler.Argb argb) { // Given RGB values, calculate HSV and then update the screen. _g = g; _hsv = ColorHandler.RgbToHsv(argb); CalcCoordsAndUpdate(_hsv); UpdateDisplay(); }
public ColorChangedEventArgs(ColorHandler.Argb argb, ColorHandler.Hsv hsv) { ARGB = argb; HSV = hsv; }
protected void OnColorChanged(ColorHandler.Argb argb, ColorHandler.Hsv hsv) { var e = new ColorChangedEventArgs(argb, hsv); ColorChanged(this, e); }