Skip to content

Commit

Permalink
feat: add clear function
Browse files Browse the repository at this point in the history
  • Loading branch information
danjenkins authored and andrewjw committed Oct 5, 2024
1 parent 130befe commit be4c722
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions i75/emulated/picographics.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def line(self, x1: int, y1: int, x2: int, y2: int) -> None:
last_coord = (px, py)
self.pixel(px, py)

def clear(self) -> None:
for y in range(self.display_type.height):
for x in range(self.display_type.width):
self._buffer[y][x] = self.pen.as_tuple()

def pixel(self, x: int, y: int) -> None:
self._buffer[y][x] = self.pen.as_tuple()

Expand Down
3 changes: 3 additions & 0 deletions i75/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def fill(self, tl_x: int, tl_y: int, br_x: int, br_y: int) -> None:
for y in range(tl_y, br_y):
self.pixel(x, y)

def clear(self) -> None:
self._driver.clear()

def pixel(self, x: int, y: int) -> None:
if x >= 0 and x < self.width and y >= 0 and y < self.height:
self._driver.pixel(x, y)
Expand Down

0 comments on commit be4c722

Please sign in to comment.