Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions src/ArduinoGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/ArduinoGraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading