Skip to content

Commit 8d530c3

Browse files
committed
rect outline thickness
1 parent 1a4c7dc commit 8d530c3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

adafruit_display_shapes/rect.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import displayio
22

33
class Rect(displayio.TileGrid):
4-
def __init__(self, x, y, width, height, *, fill=None, outline=None):
4+
def __init__(self, x, y, width, height, *, stroke=1, fill=None, outline=None):
55
self._bitmap = displayio.Bitmap(width, height, 2)
66
self._palette = displayio.Palette(2)
77

88
if outline is not None:
99
for w in range(width):
10-
self._bitmap[w, 0] = 1
11-
self._bitmap[w, height-1] = 1
10+
for line in range(stroke):
11+
self._bitmap[w, line] = 1
12+
self._bitmap[w, height-1-line] = 1
1213
for h in range(height):
13-
self._bitmap[0, h] = 1
14-
self._bitmap[width-1, h] = 1
14+
for line in range(stroke):
15+
self._bitmap[line, h] = 1
16+
self._bitmap[width-1-line, h] = 1
1517
self._palette[1] = outline
1618
if fill is not None:
1719
self._palette[0] = fill

0 commit comments

Comments
 (0)