12 virtual void set(
const Color &color) = 0;
13 virtual void set_red(uint8_t red) = 0;
14 virtual void set_green(uint8_t green) = 0;
15 virtual void set_blue(uint8_t blue) = 0;
16 virtual void set_white(uint8_t white) = 0;
20 virtual void lighten(uint8_t delta) = 0;
21 virtual void darken(uint8_t delta) = 0;
27 void set_rgb(uint8_t red, uint8_t green, uint8_t blue) {
32 void set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) {
33 this->
set_rgb(red, green, blue);
40 ESPColorView(uint8_t *red, uint8_t *green, uint8_t *blue, uint8_t *white, uint8_t *effect_data,
46 effect_data_(effect_data),
47 color_correction_(color_correction) {}
56 void set(
const Color &color)
override { this->
set_rgbw(color.r, color.g, color.b, color.w); }
57 void set_red(uint8_t red)
override { *this->red_ = this->color_correction_->color_correct_red(red); }
58 void set_green(uint8_t green)
override { *this->green_ = this->color_correction_->color_correct_green(green); }
59 void set_blue(uint8_t blue)
override { *this->blue_ = this->color_correction_->color_correct_blue(blue); }
61 if (this->white_ ==
nullptr)
63 *this->white_ = this->color_correction_->color_correct_white(white);
66 if (this->effect_data_ ==
nullptr)
68 *this->effect_data_ = effect_data;
72 void lighten(uint8_t delta)
override { this->
set(this->
get().
lighten(delta)); }
73 void darken(uint8_t delta)
override { this->
set(this->
get().
darken(delta)); }
74 Color get()
const {
return Color(this->get_red(), this->get_green(), this->get_blue(), this->get_white()); }
75 uint8_t
get_red()
const {
return this->color_correction_->color_uncorrect_red(*this->red_); }
77 uint8_t
get_green()
const {
return this->color_correction_->color_uncorrect_green(*this->green_); }
79 uint8_t
get_blue()
const {
return this->color_correction_->color_uncorrect_blue(*this->blue_); }
82 if (this->white_ ==
nullptr)
84 return this->color_correction_->color_uncorrect_white(*this->white_);
87 if (this->white_ ==
nullptr)
92 if (this->effect_data_ ==
nullptr)
94 return *this->effect_data_;
97 this->color_correction_ = color_correction;
uint8_t get_blue_raw() const
void set_green(uint8_t green) override
void darken(uint8_t delta) override
void fade_to_white(uint8_t amnt) override
uint8_t get_white_raw() const
void lighten(uint8_t delta) override
uint8_t get_green_raw() const
virtual void set_white(uint8_t white)=0
const ESPColorCorrection * color_correction_
virtual void fade_to_white(uint8_t amnt)=0
void set_white(uint8_t white) override
void set_effect_data(uint8_t effect_data) override
ESPColorView & operator=(const Color &rhs)
ESPColorView & operator=(const ESPHSVColor &rhs)
void set_hsv(const ESPHSVColor &color)
void fade_to_black(uint8_t amnt) override
virtual void set_red(uint8_t red)=0
uint8_t get_red_raw() const
void set_red(uint8_t red) override
uint8_t get_green() const
void set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white)
virtual void fade_to_black(uint8_t amnt)=0
ESPColorView(uint8_t *red, uint8_t *green, uint8_t *blue, uint8_t *white, uint8_t *effect_data, const ESPColorCorrection *color_correction)
virtual void set_effect_data(uint8_t effect_data)=0
uint8_t get_white() const
void set_rgb(uint8_t red, uint8_t green, uint8_t blue)
uint8_t *const effect_data_
void raw_set_color_correction(const ESPColorCorrection *color_correction)
virtual void lighten(uint8_t delta)=0
Implementation of SPI Controller mode.
virtual void darken(uint8_t delta)=0
void set_blue(uint8_t blue) override
uint8_t get_effect_data() const
virtual void set_blue(uint8_t blue)=0
virtual void set_green(uint8_t green)=0