Skip to content

Commit b436da5

Browse files
committed
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).
1 parent 2097022 commit b436da5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pyframebuffer/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ def drawPixel(self, x, y, color):
154154
color = getColorValue(color)
155155
fb.pyfb_setPixel(self.fbnum, x, y, color)
156156

157+
def fill(self, color):
158+
"""
159+
Fills the complete framebuffer with one color. Using as color 0x00000000
160+
or rgba(0, 0, 0, 0) is equivalent to clear the framebuffer (fill the
161+
framebuffer with black).
162+
163+
@param color The color value or Color object
164+
"""
165+
color = getColorValue(color)
166+
for i in range(0, self.yres):
167+
fb.pyfb_drawHorizontalLine(0, 0, i, self.xres, color)
168+
157169
def drawLine(self, x1, y1, x2, y2, color):
158170
"""
159171
Draws a line from the Point (x1 | y1) to

0 commit comments

Comments
 (0)