30 Rgb& operator=(
const Rgb&) =
default;
36 inline Rgb(T r, T g, T b)
45 :
red(static_cast<T>(rgb.
red))
59 return red == c.
red && green == c.
green && blue == c.
blue;
66 return red != c.
red || green != c.
green || blue != c.
blue;
74 red =
static_cast<T
>(c.
red);
75 green =
static_cast<T
>(c.
green);
76 blue =
static_cast<T
>(c.
blue);
88 std::ostream& operator<<(std::ostream& os, const Rgb<T>& x)
90 return os <<
"(" << x.red <<
"," << x.green <<
"," 98 inline std::ostream& operator<<(std::ostream& os, const Rgb<char>& x)
100 return os <<
"(" << (int)(
unsigned char)x.red <<
"," 101 << (int)(
unsigned char)x.green <<
"," 102 << (int)(
unsigned char)x.blue <<
")";
109 inline std::ostream& operator<<(std::ostream& os, const Rgb<byte>& x)
111 return os <<
"(" <<
static_cast<int>(x.red) <<
"," 112 << static_cast<int>(x.green) <<
"," 113 <<
static_cast<int>(x.blue) <<
")";
T red
The red component.
Definition: rgb.h:51
T blue
The blue component.
Definition: rgb.h:53
A colour consisting of red, green and blue components.
Definition: rgb.h:25
All classes and functions are within the CVD namespace.
Definition: argb.h:6
Rgb< T > & operator=(const Rgb< T2 > &c)
Assignment operator between two different storage types, using the standard casts as necessary...
Definition: rgb.h:72
bool operator==(const Rgb< T > &c) const
Logical equals operator.
Definition: rgb.h:57
Rgb(T r, T g, T b)
Constructs a colour as specified.
Definition: rgb.h:36
T green
The green component.
Definition: rgb.h:52
bool operator!=(const Rgb< T > &c) const
Logical not-equals operator.
Definition: rgb.h:64