27 constexpr
inline TColor() =
default;
29 uint8_t r, uint8_t g, uint8_t b, uint8_t alpha = 255)
30 :
R(r),
G(g),
B(b),
A(alpha)
34 constexpr
inline explicit TColor(
const unsigned int color_RGB_24bit)
35 :
R(uint8_t(color_RGB_24bit >> 16)),
36 G(uint8_t(color_RGB_24bit >> 8)),
37 B(uint8_t(color_RGB_24bit)),
43 const unsigned int color_RGB_24bit,
const uint8_t alpha)
44 :
R(uint8_t(color_RGB_24bit >> 16)),
45 G(uint8_t(color_RGB_24bit >> 8)),
46 B(uint8_t(color_RGB_24bit)),
51 uint8_t
R{0},
G{0},
B{0},
A{255};
55 inline operator unsigned int()
const 57 return (((
unsigned int)
R) << 16) | (((
unsigned int)
G) << 8) |
B;
76 std::ostream&
operator<<(std::ostream& o,
const TColor& c);
90 TColorf(
float r = 0,
float g = 0,
float b = 0,
float alpha = 1.0f)
91 :
R(r),
G(g),
B(b),
A(alpha)
static constexpr TColor blue()
constexpr TColor(const unsigned int color_RGB_24bit, const uint8_t alpha)
TColor operator+(const TColor &first, const TColor &second)
Pairwise addition of their corresponding RGBA members.
TColor & operator-=(const TColor &other)
static constexpr TColor gray()
static constexpr TColor black()
TColor(const TColor &other)
constexpr TColor(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha=255)
#define MRPT_DECLARE_TTYPENAME_NO_NAMESPACE(_TYPE, __NS)
Declares a typename to be "type" (without the NS prefix)
static constexpr TColor green()
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
static constexpr TColor red()
Predefined colors.
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
Virtual base class for "archives": classes abstracting I/O streams.
constexpr TColor(const unsigned int color_RGB_24bit)
TColorf(float r=0, float g=0, float b=0, float alpha=1.0f)
TColorf(const TColor &col)
An RGBA color - floats in the range [0,1].
float u8tof(const uint8_t v)
converts a uint8_t [0,255] into a float [0,1]
constexpr TColor()=default
TColor operator-(const TColor &first, const TColor &second)
Pairwise substraction of their corresponding RGBA members.
TColor & operator=(const TColor &other)
TColor & operator+=(const TColor &other)
TColor asTColor() const
Returns the 0-255 integer version of this color: RGBA_u8.
std::ostream & operator<<(std::ostream &o, const TColor &c)
static constexpr TColor white()
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &i, TColor &c)