/// <summary> /// Updates the ARGB, HSL and HSB color to represent the CMYK current color. /// <para>This SHOULD be called after changing any values of the CMYK color</para> /// </summary> public void UpdateCMYK() { this.ARGB = CMYK; this.HSL = CMYK; this.HSB = CMYK; this.a = CMYK.A; }
/// <summary> /// Updates the ARGB, HSB and CMYK color to represent the HSL current color. /// <para>This SHOULD be called after changing any values of the HSL color</para> /// </summary> public void UpdateHSL() { this.ARGB = HSL; this.HSB = HSL; this.CMYK = HSL; this.a = HSL.A; }
/// <summary> /// Updates the ARGB, HSL and CMYK color to represent the HSB current color. /// <para>This SHOULD be called after changing any values of the HSB color</para> /// </summary> public void UpdateHSB() { this.ARGB = HSB; this.HSL = HSB; this.CMYK = HSB; this.a = HSB.A; }
/// <summary> /// Creates a new instnace of the COLOR struct from the given System.Drawing.Color. /// </summary> /// <param name="color">A System.Drawing.Color color.</param> public COLOR(Color color) { ARGB = color; HSB = color; HSL = color; CMYK = color; a = color.A; }
protected override void DrawGreen() { using (Graphics g = Graphics.FromImage(bmp)) { ARGB start = new ARGB(SelectedColor.ARGB.A, SelectedColor.ARGB.R, 255, SelectedColor.ARGB.B); ARGB end = new ARGB(SelectedColor.ARGB.A, SelectedColor.ARGB.R, 0, SelectedColor.ARGB.B); using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, clientHeight), start, end, LinearGradientMode.Vertical)) { g.FillRectangle(brush, new Rectangle(0, 0, clientWidth, clientHeight)); } } }
// slider controls blue // x = red 0 -> 255 // y = green 255 -> 0 protected override void DrawBlue() { using (Graphics g = Graphics.FromImage(bmp)) { ARGB start = new ARGB(selectedColor.ARGB.A, 0, 0, (int)selectedColor.ARGB.B); ARGB end = new ARGB(selectedColor.ARGB.A, 255, 0, (int)selectedColor.ARGB.B); for (int y = 0; y < clientHeight; y++) { start.G = end.G = (byte)Math.Round(255 - ((double)y / (clientHeight)) * 255); using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal)) { g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1)); } } } }
/// <summary> /// Gets the inverted ARGB color. /// </summary> /// <param name="input">The color to invert.</param> /// <returns>An inverted ARGB struct.</returns> public static ARGB GetInverted(ARGB input) { return(new ARGB(input.A, 255 - input.R, 255 - input.G, 255 - input.B)); }