Example #1
0
        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.
            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 = 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.
            fullColor = ColourHandler.HSVtoColour(HSV.Hue, HSV.Saturation, 255);
        }
Example #2
0
 public void Draw(Graphics g, ColourHandler.HSV HSV)
 {
     // Given HSV values, update the screen.
     this.g   = g;
     this.HSV = HSV;
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
Example #3
0
 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 ColourChangedEventArgs(ColourHandler.RGB RGB, ColourHandler.HSV HSV)
        {
            rGB = RGB;

            hSV = HSV;
        }
Example #5
0
        protected void OnColourChanged(ColourHandler.RGB RGB, ColourHandler.HSV HSV)
        {
            ColourChangedEventArgs e = new ColourChangedEventArgs(RGB, HSV);

            ColourChanged(this, e);
        }