Skip to content

Commit e6eea60

Browse files
Merge pull request #16 from OmarAli3/clearPoint
add function to clear specific point
2 parents 4241408 + 4572a10 commit e6eea60

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

docs/api.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,19 @@ YourScreen.endDraw();
202202

203203
#### Description
204204

205-
Clear the screen contents, uses the background colour set in background().
205+
Clear the screen contents or a specific pixel, uses the background colour set in background().
206206

207207
#### Syntax
208208

209209
```
210210
YourScreen.clear()
211+
YourScreen.clear(x, y)
211212
```
212213

213214
#### Parameters
214215

215-
None
216+
- x: x position of the pixel to clear
217+
- y: y position of the pixel to clear
216218

217219
#### Returns
218220

src/ArduinoGraphics.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ void ArduinoGraphics::clear()
9696
}
9797
}
9898

99+
void ArduinoGraphics::clear(int x, int y)
100+
{
101+
set(x, y, _backgroundR, _backgroundB, _backgroundG);
102+
}
103+
99104
void ArduinoGraphics::fill(uint8_t r, uint8_t g, uint8_t b)
100105
{
101106
_fill = true;

src/ArduinoGraphics.h

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ArduinoGraphics : public Print {
5151
void background(uint8_t r, uint8_t g, uint8_t b);
5252
void background(uint32_t color);
5353
void clear();
54+
void clear(int x, int y);
5455
void fill(uint8_t r, uint8_t g, uint8_t b);
5556
void fill(uint32_t color);
5657
void noFill();

0 commit comments

Comments
 (0)