diff --git a/docs/api.md b/docs/api.md index 8827301..004b2b6 100644 --- a/docs/api.md +++ b/docs/api.md @@ -202,17 +202,19 @@ YourScreen.endDraw(); #### Description -Clear the screen contents, uses the background colour set in background(). +Clear the screen contents or a specific pixel, uses the background colour set in background(). #### Syntax ``` YourScreen.clear() +YourScreen.clear(x, y) ``` #### Parameters -None +- x: x position of the pixel to clear +- y: y position of the pixel to clear #### Returns diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 8ed68a0..852c273 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -96,6 +96,11 @@ void ArduinoGraphics::clear() } } +void ArduinoGraphics::clear(int x, int y) +{ + set(x, y, _backgroundR, _backgroundB, _backgroundG); +} + void ArduinoGraphics::fill(uint8_t r, uint8_t g, uint8_t b) { _fill = true; diff --git a/src/ArduinoGraphics.h b/src/ArduinoGraphics.h index 3386dfa..6776f86 100644 --- a/src/ArduinoGraphics.h +++ b/src/ArduinoGraphics.h @@ -51,6 +51,7 @@ class ArduinoGraphics : public Print { void background(uint8_t r, uint8_t g, uint8_t b); void background(uint32_t color); void clear(); + void clear(int x, int y); void fill(uint8_t r, uint8_t g, uint8_t b); void fill(uint32_t color); void noFill();