public SimpleColorPicker(int x, int y) { hueSlider = new SimpleSlider(new Rectangle(x, y + 5, SliderBar.defaultWidth, 10), 0, 360) { getDrawColor = ((float val) => GetColorForValues(val, 100f)) }; saturationSlider = new SimpleSlider(new Rectangle(x, y + 25, SliderBar.defaultWidth, 10), 0, 75) { getDrawColor = ((float val) => GetColorForValues(hueSlider.GetValue(), val)) }; lightnessSlider = new SimpleSlider(new Rectangle(x, y + 45, SliderBar.defaultWidth, 10), MIN_LIGHTNESS, MAX_LIGHTNESS) { getDrawColor = ((float val) => GetColorForValues(hueSlider.GetValue(), saturationSlider.GetValue(), val)) }; bounds = new Rectangle(x, y, SliderBar.defaultWidth, 60); }
public bool Click(int x, int y) { recentSliderBar = null; if (bounds.Contains(x, y)) { if (hueSlider.ReceiveLeftClick(x, y)) { recentSliderBar = hueSlider; return(true); } if (saturationSlider.ReceiveLeftClick(x, y)) { recentSliderBar = saturationSlider; return(true); } if (lightnessSlider.ReceiveLeftClick(x, y)) { recentSliderBar = lightnessSlider; return(true); } } return(false); }