Color4¶
The Color4 class template represents a 4-component color (red,
green, blue, and alpha), with pre-defined typedefs of unsigned
char, half, and float.
The Color4 class is not derived from Vec4. Its fields are
named r, g, b, and a. The class itself implies no
specific interpretation of the values.
There are also various utility functions that operate on colors
defined in ImathColorAlgo.h and described in Color Functions.
Example:
#include <Imath/ImathColor.h>
void
color4_example()
{
Imath::C4f r (1.0f, 0.0f, 0.0f, 1.0f);
Imath::C4f g (0.0f, 1.0f, 0.0f, 1.0f);
Imath::C4f b (0.0f, 0.0f, 1.0f, 1.0f);
Imath::C4f w = r + g + b;
assert (w.r == 1.0f);
assert (w.g == 1.0f);
assert (w.b == 1.0f);
assert (w.a == 3.0f);
}
-
template <class T>
classColor4¶ A 4-channel color class: 3 channels plus alpha.
For convenience, the fields are named
r,g, andb, although this class does not impose interpretation on the channels, which can represent either rgb or hsv color values.Constructors and Assignment
-
Color4()¶ No initialization by default.
-
constexpr
Color4(T a)¶ Initialize to
(a a a a)
-
constexpr
Color4(T a, T b, T c, T d)¶ Initialize to
(a b c d)
-
~Color4()¶ Destructor.
-
T &
operator[](int i)¶ Component-wise value.
-
const T &
operator[](int i) const¶ Component-wise value.
Arithmetic and Comparison
Numeric Limits
-
static constexpr T
baseTypeLowest()¶ Largest possible negative value.
-
static constexpr T
baseTypeMax()¶ Largest possible positive value.
-
static constexpr T
baseTypeSmallest()¶ Smallest possible positive value.
-
static constexpr T
baseTypeEpsilon()¶ Smallest possible e for which 1+e != 1.
-
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream& s, const Color4<T>& v) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- std::ostream &operator<<(std::ostream&, Imath::half)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Color4<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Euler<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Interval<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Line3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix22<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix33<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix44<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Plane3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Quat<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Shear6<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec2<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec4<T>&)