Migrate ESPColor to Color (#1551)

* Migrate ESPColor to Color

* color.h constructor fix

* Updated componets to use Color
Added a using for ESPColor

* Lint fixes

* Fixed value error

* Update display components to use colorutil

* Updated to latest PR comments

* Fixed COLOR_WHITE

* Moved esp_scale to color_utils

* Rename color_utils to display_color_utils
This commit is contained in:
SenexCrenshaw
2021-03-02 09:08:57 -05:00
committed by GitHub
parent b17e0c298e
commit ac25b138f5
25 changed files with 272 additions and 369 deletions
@@ -192,7 +192,7 @@ size_t SSD1325::get_buffer_length_() {
void HOT SSD1325::draw_absolute_pixel_internal(int x, int y, Color color) {
if (x >= this->get_width_internal() || x < 0 || y >= this->get_height_internal() || y < 0)
return;
uint32_t color4 = color.to_grayscale4();
uint32_t color4 = display::ColorUtil::color_to_grayscale4(color);
// where should the bits go in the big buffer array? math...
uint16_t pos = (x / SSD1325_PIXELSPERBYTE) + (y * this->get_width_internal() / SSD1325_PIXELSPERBYTE);
uint8_t shift = (x % SSD1325_PIXELSPERBYTE) * SSD1325_COLORSHIFT;
@@ -204,7 +204,7 @@ void HOT SSD1325::draw_absolute_pixel_internal(int x, int y, Color color) {
this->buffer_[pos] |= color4;
}
void SSD1325::fill(Color color) {
const uint32_t color4 = color.to_grayscale4();
const uint32_t color4 = display::ColorUtil::color_to_grayscale4(color);
uint8_t fill = (color4 & SSD1325_COLORMASK) | ((color4 & SSD1325_COLORMASK) << SSD1325_COLORSHIFT);
for (uint32_t i = 0; i < this->get_buffer_length_(); i++)
this->buffer_[i] = fill;