Color3
#include <Imath/ImathColor.h>
The Color3 class template represents a 3-component color, with
pre-defined typedefs of unsigned char, half, and float.
The Color3 class inherits from Vec3 and thus has
fields named x, y, and z. 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>
#include <cassert>
void
color3_example ()
{
Imath::C3c r (255, 0, 0);
Imath::C3c g (0, 255, 0);
Imath::C3c b (0, 0, 255);
Imath::C3c c = r + g + b;
assert (c.x == 255);
assert (c.x == 255);
assert (c.x == 255);
}
-
typedef Color3<unsigned char> Imath::Color3c
3 8-bit integer channels
-
typedef Color3<half> Imath::Color3h
3 half channels
-
typedef Color3<float> Imath::Color3f
3 float channels
-
typedef Color3<unsigned char> Imath::C3c
3 8-bit integer channels
-
typedef Color3<half> Imath::C3h
3 half channels
-
typedef Color3<float> Imath::C3f
3 float channels
-
template<class T>
class Color3 : public Imath::Vec3<T>
3-channel color class that inherits from Vec3.
This class does not impose interpretation on the channels, which can represent either rgb or hsv color values.
Note: because Color3 inherits from Vec3, its member fields are called x, y, and z.
Constructors and Assignemt
-
inline Color3() noexcept
No initialization by default.
-
inline explicit constexpr Color3(T a) noexcept
Initialize to (a a a)
-
inline constexpr Color3(T a, T b, T c) noexcept
Initialize to (a b c)
-
inline constexpr Color3(const Color3 &c) noexcept
Construct from Color3.
-
template<class S>
inline constexpr Color3(const Vec3<S> &v) noexcept
Construct from Vec3.
-
~Color3() = default
Destructor.
-
inline constexpr const Color3 &operator=(const Color3 &c) noexcept
Component-wise assignment.
Arithmetic
-
inline constexpr const Color3 &operator+=(const Color3 &c) noexcept
Component-wise addition.
-
inline constexpr Color3 operator+(const Color3 &c) const noexcept
Component-wise addition.
-
inline constexpr const Color3 &operator-=(const Color3 &c) noexcept
Component-wise subtraction.
-
inline constexpr Color3 operator-(const Color3 &c) const noexcept
Component-wise subtraction.
-
inline constexpr Color3 operator-() const noexcept
Component-wise multiplication by -1.
-
inline constexpr const Color3 &negate() noexcept
Component-wise multiplication by -1.
-
inline constexpr const Color3 &operator*=(const Color3 &c) noexcept
Component-wise multiplication.
-
inline constexpr const Color3 &operator*=(T a) noexcept
Component-wise multiplication.
-
inline constexpr Color3 operator*(const Color3 &c) const noexcept
Component-wise multiplication.
-
inline constexpr Color3 operator*(T a) const noexcept
Component-wise multiplication.
-
inline constexpr const Color3 &operator/=(const Color3 &c) noexcept
Component-wise division.
-
inline constexpr const Color3 &operator/=(T a) noexcept
Component-wise division.
-
inline constexpr Color3 operator/(const Color3 &c) const noexcept
Component-wise division.
-
inline constexpr Color3 operator/(T a) const noexcept
Component-wise division.
Copyright © OpenEXR a Series of LF Projects, LLC.
For web site terms of use, trademark policy and other project policies
please see https://lfprojects.org.