10 #ifndef MI_MATH_COLOR_H
11 #define MI_MATH_COLOR_H
121 #if defined(DEBUG) || (defined(_MSC_VER) && _MSC_VER <= 1310)
129 Float32 v = (Traits::has_signaling_NaN)
177 template <
typename T>
208 Color_struct::operator=( c);
255 return (
r == 0.0f) && (
g == 0.0f) && (
b == 0.0f);
270 return r * 0.299f +
g * 0.587f +
b * 0.114f;
279 return r * 0.212671f +
g * 0.715160f +
b * 0.072169f;
394 return Color( lhs.
r + rhs.
r, lhs.
g + rhs.
g, lhs.
b + rhs.
b, lhs.
a + rhs.
a);
400 return Color( lhs.
r - rhs.
r, lhs.
g - rhs.
g, lhs.
b - rhs.
b, lhs.
a - rhs.
a);
406 return Color( lhs.
r * rhs.
r, lhs.
g * rhs.
g, lhs.
b * rhs.
b, lhs.
a * rhs.
a);
412 return Color( lhs.
r / rhs.
r, lhs.
g / rhs.
g, lhs.
b / rhs.
b, lhs.
a / rhs.
a);
449 return Color( c.
r * s, c.
g * s, c.
b * s, c.
a * s);
456 return Color( s * c.
r, s * c.
g, s* c.
b, s * c.
a);
463 return Color( c.
r * f, c.
g * f, c.
b * f, c.
a * f);
485 return (c.
r != 0.0f) && (c.
g != 0.0f) && (c.
b != 0.0f) && (c.
a != 0.0f);
491 return (c.
r != 0.0f) || (c.
g != 0.0f) || (c.
b != 0.0f) || (c.
a != 0.0f);
884 #ifndef MI_FOR_DOXYGEN_ONLY
888 bool desaturate)
const
895 if( col.a < col.r) col.a = col.r;
896 if( col.a < col.g) col.a = col.g;
897 if( col.a < col.b) col.a = col.b;
904 return col.desaturate(max_val);
924 return Color( 0, 0, 0,
a);
926 return Color( maxval, maxval, maxval,
a);
937 t = (maxval - axis) / drds;
938 if( t < sat) sat = t;
942 if( t < sat) sat = t;
946 t = (maxval - axis) / dgds;
947 if( t < sat) sat = t;
951 if( t < sat) sat = t;
955 t = (maxval - axis) / dbds;
956 if( t < sat) sat = t;
960 if( t < sat) sat = t;
977 #endif // MI_FOR_DOXYGEN_ONLY
985 #endif // MI_MATH_COLOR_H