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)
137 #if (__cplusplus >= 201103L)
180 template <
typename T>
211 Color_struct::operator=( c);
258 return (
r == 0.0f) && (
g == 0.0f) && (
b == 0.0f);
273 return r * 0.299f +
g * 0.587f +
b * 0.114f;
282 return r * 0.212671f +
g * 0.715160f +
b * 0.072169f;
397 return Color( lhs.
r + rhs.
r, lhs.
g + rhs.
g, lhs.
b + rhs.
b, lhs.
a + rhs.
a);
403 return Color( lhs.
r - rhs.
r, lhs.
g - rhs.
g, lhs.
b - rhs.
b, lhs.
a - rhs.
a);
409 return Color( lhs.
r * rhs.
r, lhs.
g * rhs.
g, lhs.
b * rhs.
b, lhs.
a * rhs.
a);
415 return Color( lhs.
r / rhs.
r, lhs.
g / rhs.
g, lhs.
b / rhs.
b, lhs.
a / rhs.
a);
452 return Color( c.
r * s, c.
g * s, c.
b * s, c.
a * s);
459 return Color( s * c.
r, s * c.
g, s* c.
b, s * c.
a);
466 return Color( c.
r * f, c.
g * f, c.
b * f, c.
a * f);
488 return (c.
r != 0.0f) && (c.
g != 0.0f) && (c.
b != 0.0f) && (c.
a != 0.0f);
494 return (c.
r != 0.0f) || (c.
g != 0.0f) || (c.
b != 0.0f) || (c.
a != 0.0f);
887 #ifndef MI_FOR_DOXYGEN_ONLY
891 bool desaturate)
const
898 if( col.
a < col.
r) col.
a = col.
r;
899 if( col.
a < col.
g) col.
a = col.
g;
900 if( col.
a < col.
b) col.
a = col.
b;
927 return Color( 0, 0, 0,
a);
929 return Color( maxval, maxval, maxval,
a);
940 t = (maxval - axis) / drds;
941 if( t < sat) sat = t;
945 if( t < sat) sat = t;
949 t = (maxval - axis) / dgds;
950 if( t < sat) sat = t;
954 if( t < sat) sat = t;
958 t = (maxval - axis) / dbds;
959 if( t < sat) sat = t;
963 if( t < sat) sat = t;
980 #endif // MI_FOR_DOXYGEN_ONLY
988 #endif // MI_MATH_COLOR_H