public void SetColor(CCColor3B colorValue)
        {
            // XXX fixed me if not correct
            base.Color = colorValue;

            RGBA rgba;
            rgba.r = colorValue.R / 255.0f;
            rgba.g = colorValue.G / 255.0f;
            rgba.b = colorValue.B / 255.0f;
            rgba.a = 1.0f;

            _hsv = CCControlUtils.HSVfromRGB(rgba);
            UpdateHueAndControlPicker();
        }
		public static RGBA RGBfromHSV(HSV value)
		{
			float hh, p, q, t, ff;
			long i;
			RGBA o;
			o.a = 1f;
    
			if (value.s <= 0.0f) // < is bogus, just shuts up warnings
			{       
				if (double.IsNaN(value.h)) // value.h == NAN
				{   
					o.r = value.v;
					o.g = value.v;
					o.b = value.v;
					return o;
				}
        
				// error - should never happen
				o.r = 0.0f;
				o.g = 0.0f;
				o.b = 0.0f;
				return o;
			}
    
			hh = value.h;
			if(hh >= 360.0f) hh = 0.0f;
			hh /= 60.0f;
			i = (long)hh;
			ff = hh - i;
			p = value.v * (1.0f - value.s);
			q = value.v * (1.0f - (value.s * ff));
			t = value.v * (1.0f - (value.s * (1.0f - ff)));
    
			switch(i)
			{
				case 0:
					o.r = value.v;
					o.g = t;
					o.b = p;
					break;
				case 1:
					o.r = q;
					o.g = value.v;
					o.b = p;
					break;
				case 2:
					o.r = p;
					o.g = value.v;
					o.b = t;
					break;
            
				case 3:
					o.r = p;
					o.g = q;
					o.b = value.v;
					break;
				case 4:
					o.r = t;
					o.g = p;
					o.b = value.v;
					break;
				case 5:
				default:
					o.r = value.v;
					o.g = p;
					o.b = q;
					break;
			}
			return o;     
		}
        public virtual void UpdateDraggerWithHSV(HSV hsv)
        {
            // Set the position of the slider to the correct saturation and brightness
            var pos = new CCPoint(_startPos.X + boxPos + (boxSize * (1f - hsv.s)),
                                  _startPos.Y + boxPos + (boxSize * hsv.v));

            // update
            UpdateSliderPosition(pos);
        }
        public static RGBA RGBfromHSV(HSV value)
        {
            double hh, p, q, t, ff;
            long   i;
            RGBA   o;

            o.a = 1;

            if (value.s <= 0.0)             // < is bogus, just shuts up warnings
            {
                if (double.IsNaN(value.h))  // value.h == NAN
                {
                    o.r = value.v;
                    o.g = value.v;
                    o.b = value.v;
                    return(o);
                }

                // error - should never happen
                o.r = 0.0;
                o.g = 0.0;
                o.b = 0.0;
                return(o);
            }

            hh = value.h;
            if (hh >= 360.0)
            {
                hh = 0.0;
            }
            hh /= 60.0;
            i   = (long)hh;
            ff  = hh - i;
            p   = value.v * (1.0 - value.s);
            q   = value.v * (1.0 - (value.s * ff));
            t   = value.v * (1.0 - (value.s * (1.0 - ff)));

            switch (i)
            {
            case 0:
                o.r = value.v;
                o.g = t;
                o.b = p;
                break;

            case 1:
                o.r = q;
                o.g = value.v;
                o.b = p;
                break;

            case 2:
                o.r = p;
                o.g = value.v;
                o.b = t;
                break;

            case 3:
                o.r = p;
                o.g = q;
                o.b = value.v;
                break;

            case 4:
                o.r = t;
                o.g = p;
                o.b = value.v;
                break;

            case 5:
            default:
                o.r = value.v;
                o.g = p;
                o.b = q;
                break;
            }
            return(o);
        }
        public virtual void UpdateWithHSV(HSV hsv)
        {
            HSV hsvTemp;
            hsvTemp.s = 1;
            hsvTemp.h = hsv.h;
            hsvTemp.v = 1;

            RGBA rgb = CCControlUtils.RGBfromHSV(hsvTemp);
            _background.Color = new CCColor3B((byte) (rgb.r * 255.0f), (byte) (rgb.g * 255.0f),
                                              (byte) (rgb.b * 255.0f));
        }