From b436da559ece74d16d7b64b363f525db83d9c34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Ro=C3=9F?= Date: Mon, 5 Aug 2024 14:50:10 +0000 Subject: [PATCH] Reimplement the fill function Now exactly tested on my Raspberry Pi, the fill function works and replaces now commit 3165c53 reverted in previous commit (see Commit: 2097022). --- pyframebuffer/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyframebuffer/__init__.py b/pyframebuffer/__init__.py index 0b0a64e..a782e79 100644 --- a/pyframebuffer/__init__.py +++ b/pyframebuffer/__init__.py @@ -154,6 +154,18 @@ def drawPixel(self, x, y, color): color = getColorValue(color) fb.pyfb_setPixel(self.fbnum, x, y, color) + def fill(self, color): + """ + Fills the complete framebuffer with one color. Using as color 0x00000000 + or rgba(0, 0, 0, 0) is equivalent to clear the framebuffer (fill the + framebuffer with black). + + @param color The color value or Color object + """ + color = getColorValue(color) + for i in range(0, self.yres): + fb.pyfb_drawHorizontalLine(0, 0, i, self.xres, color) + def drawLine(self, x1, y1, x2, y2, color): """ Draws a line from the Point (x1 | y1) to