/// Test for inequality with another color without epsilon. public static bool operator !=(Color lhs, Color rhs) { return(!MathDefs.Equals(lhs.R, rhs.R) || !MathDefs.Equals(lhs.G, rhs.G) || !MathDefs.Equals(lhs.B, rhs.B) || !MathDefs.Equals(lhs.A, rhs.A)); }
/// Return hue value given greatest and least RGB component, value-wise. private float Hue(float min, float max) { float chroma = max - min; // If chroma equals zero, hue is undefined if (chroma <= MathDefs.Epsilon) { return(0.0f); } // Calculate and return hue if (MathDefs.Equals(G, max)) { return((B + 2.0f * chroma - R) / (6.0f * chroma)); } else if (MathDefs.Equals(B, max)) { return((4.0f * chroma - G + R) / (6.0f * chroma)); } else { float r = (G - B) / (6.0f * chroma); return((r < 0.0f) ? 1.0f + r : ((r >= 1.0f) ? r - 1.0f : r)); } }
/// Test for equality with another color without epsilon. public static bool operator ==(Color lhs, Color rhs) { return(MathDefs.Equals(lhs.R, rhs.R) && MathDefs.Equals(lhs.G, rhs.G) && MathDefs.Equals(lhs.B, rhs.B) && MathDefs.Equals(lhs.A, rhs.A)); }
/// Test for equality with another color with epsilon. public bool Equals(Color obj) { return(MathDefs.Equals(R, obj.R) && MathDefs.Equals(G, obj.G) && MathDefs.Equals(B, obj.B) && MathDefs.Equals(A, obj.A)); }