public void SetFromRGB(byte r, byte g, byte b) { exRGB = new double[] { r / 255.0, g / 255.0, b / 255.0 }; exHsb = ColorConversion.RGBToHSB(exRGB[0], exRGB[1], exRGB[2]); exHsl = ColorConversion.RGBToHSL(exRGB[0], exRGB[1], exRGB[2]); setNewColor(Color.FromRgb(r, g, b)); }
public void SetFromHSB(int h, double s, double b) { if (s > 1 || b > 1 || h > 360 || h < 0) { throw new ArgumentException(); } exHsb = new double[] { h, s, b }; exRGB = ColorConversion.HSBToRGB(h, s, b); exHsl = ColorConversion.RGBToHSL(exRGB[0], exRGB[1], exRGB[2]); setNewColor(Color.FromRgb((byte)Math.Round(exRGB[0] * 255), (byte)Math.Round(exRGB[1] * 255), (byte)Math.Round(exRGB[2] * 255))); }