17 Color3i(uint8_t r, uint8_t g, uint8_t b) { Set(r,g,b); }
18 Color3i() { Set(0xff, 0xff, 0xff); }
21 void Set(uint8_t r, uint8_t g, uint8_t b) { r_ = r; g_ = g; b_ = b; }
22 void Set(
const Color3i& c) { Set(c.r_, c.g_, c.b_); }
23 void Mul(
const Color3i& other_color);
24 void Mulf(
float scale);
25 void Mul(uint8_t val) {
30 uint8_t Get(
int rgb_index)
const;
31 void Set(
int rgb_index, uint8_t val);
32 void Fill(uint8_t val) { Set(val, val, val); }
33 uint8_t MaxRGB()
const {
34 uint8_t max_r_g = r_ > g_ ? r_ : g_;
35 return max_r_g > b_ ? max_r_g : b_;
38 template <
typename Pr
intStream>
39 inline void Print(PrintStream* stream)
const {
40 stream->print(
"RGB:\t");
41 stream->print(r_); stream->print(
",\t");
42 stream->print(g_); stream->print(
",\t");
47 void Interpolate(
const Color3i& other_color,
float t);
49 uint8_t* At(
int rgb_index);
50 const uint8_t* At(
int rgb_index)
const;
58 ColorHSV(
float h,
float s,
float v) {
72 Set(other.h_, other.s_, other.v_);
74 void Set(
float h,
float s,
float v) {
80 template <
typename Pr
intStream>
81 inline void Print(PrintStream* stream) {
82 stream->print(
"HSV:\t");
83 stream->print(h_); stream->print(
",\t");
84 stream->print(s_); stream->print(
",\t");
85 stream->print(v_); stream->print(
"\n");
88 bool operator==(
const ColorHSV& other)
const {
89 return h_ == other.h_ && s_ == other.s_ && v_ == other.v_;
91 bool operator!=(
const ColorHSV& other)
const {
92 return !(*
this == other);
94 void FromRGB(
const Color3i& rgb);