using System; using System.ComponentModel; namespace Devcorp.Controls.Design { /// /// Structure to define CIE L*a*b*. /// public struct CIELab { /// /// Gets an empty CIELab structure. /// public static readonly CIELab Empty = new CIELab(); #region Fields private double l; private double a; private double b; #endregion #region Operators public static bool operator ==(CIELab item1, CIELab item2) { return ( item1.L == item2.L && item1.A == item2.A && item1.B == item2.B ); } public static bool operator !=(CIELab item1, CIELab item2) { return ( item1.L != item2.L || item1.A != item2.A || item1.B != item2.B ); } #endregion #region Accessors /// /// Gets or sets L component. /// public double L { get => l; set => l = value; } /// /// Gets or sets a component. /// public double A { get => a; set => a = value; } /// /// Gets or sets a component. /// public double B { get => b; set => b = value; } #endregion public CIELab(double l, double a, double b) { this.l = l; this.a = a; this.b = b; } #region Methods public override bool Equals(Object obj) { if (obj == null || GetType() != obj.GetType()) return false; return (this == (CIELab)obj); } public override int GetHashCode() { return L.GetHashCode() ^ a.GetHashCode() ^ b.GetHashCode(); } #endregion } }