adafruit/Adafruit-ST7735-Library — Issue #8: Using a background color for text
Author: soerup
Created: 2012-03-06 23:43:05+00:00
State: open

Has it been considered to add a background color, so when printing text (drawChar) it prints the background as well, to overwrite old text properly. Would improve the text update functionality quite a bit (for e.g. updates on my 3D printer display)

My crude change for black background only looks like this:

void Adafruit_ST7735::drawChar(uint8_t x, uint8_t y, char c,
uint16_t color, uint8_t size) {
for (uint8_t i =0; i<5; i++ ) {
uint8_t line = pgm_read_byte(font+(c*5)+i);
for (uint8_t j = 0; j<8; j++) {
if (line & 0x1) {
if (size == 1) // default size
drawPixel(x+i, y+j, color);
else { // big size
fillRect(x+i*size, y+j*size, size, size, color);
}
+ } else {
+ if (size == 1) // default size
+ drawPixel(x+i, y+j, ST7735_BLACK);
+ else { // big size
+ fillRect(x+i*size, y+j*size, size, size, ST7735_BLACK);
+ }
}
line >>= 1;
}
}
}