| 155 | } |
| 156 | |
| 157 | void OLEDDisplay::clearPixel(int16_t x, int16_t y) { |
| 158 | if (x >= 0 && x < this->width() && y >= 0 && y < this->height()) { |
| 159 | switch (color) { |
| 160 | case BLACK: buffer[x + (y >> 3) * this->width()] |= (1 << (y & 7)); break; |
| 161 | case WHITE: buffer[x + (y >> 3) * this->width()] &= ~(1 << (y & 7)); break; |
| 162 | case INVERSE: buffer[x + (y >> 3) * this->width()] ^= (1 << (y & 7)); break; |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | |
| 168 | // Bresenham's algorithm - thx wikipedia and Adafruit_GFX |