9 #ifndef MI_MATH_COLOR_H
10 #define MI_MATH_COLOR_H
120 #if defined(DEBUG) || (defined(_MSC_VER) && _MSC_VER <= 1310)
128 Float32 v = (Traits::has_signaling_NaN)
176 template <
typename T>
207 Color_struct::operator=( c);
254 return (
r == 0.0f) && (
g == 0.0f) && (
b == 0.0f);
269 return r * 0.299f +
g * 0.587f +
b * 0.114f;
278 return r * 0.212671f +
g * 0.715160f +
b * 0.072169f;
393 return Color( lhs.
r + rhs.
r, lhs.
g + rhs.
g, lhs.
b + rhs.
b, lhs.
a + rhs.
a);
399 return Color( lhs.
r - rhs.
r, lhs.
g - rhs.
g, lhs.
b - rhs.
b, lhs.
a - rhs.
a);
405 return Color( lhs.
r * rhs.
r, lhs.
g * rhs.
g, lhs.
b * rhs.
b, lhs.
a * rhs.
a);
411 return Color( lhs.
r / rhs.
r, lhs.
g / rhs.
g, lhs.
b / rhs.
b, lhs.
a / rhs.
a);
448 return Color( c.
r * s, c.
g * s, c.
b * s, c.
a * s);
455 return Color( s * c.
r, s * c.
g, s* c.
b, s * c.
a);
462 return Color( c.
r * f, c.
g * f, c.
b * f, c.
a * f);
484 return (c.
r != 0.0f) && (c.
g != 0.0f) && (c.
b != 0.0f) && (c.
a != 0.0f);
490 return (c.
r != 0.0f) || (c.
g != 0.0f) || (c.
b != 0.0f) || (c.
a != 0.0f);
883 #ifndef MI_FOR_DOXYGEN_ONLY
887 bool desaturate)
const
894 if( col.
a < col.
r) col.
a = col.
r;
895 if( col.
a < col.
g) col.
a = col.
g;
896 if( col.
a < col.
b) col.
a = col.
b;
923 return Color( 0, 0, 0,
a);
925 return Color( maxval, maxval, maxval,
a);
936 t = (maxval - axis) / drds;
937 if( t < sat) sat = t;
941 if( t < sat) sat = t;
945 t = (maxval - axis) / dgds;
946 if( t < sat) sat = t;
950 if( t < sat) sat = t;
954 t = (maxval - axis) / dbds;
955 if( t < sat) sat = t;
959 if( t < sat) sat = t;
976 #endif // MI_FOR_DOXYGEN_ONLY
984 #endif // MI_MATH_COLOR_H