diff --git a/i75/emulated/picographics.py b/i75/emulated/picographics.py index 0b31672..1a38fb5 100644 --- a/i75/emulated/picographics.py +++ b/i75/emulated/picographics.py @@ -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() diff --git a/i75/graphics.py b/i75/graphics.py index 30ee529..58b5aa4 100644 --- a/i75/graphics.py +++ b/i75/graphics.py @@ -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)