setters and getters for the fill and outline colors
This commit is contained in:
parent
0db4dfcebe
commit
c56200a3d0
2 changed files with 45 additions and 0 deletions
|
|
@ -71,6 +71,28 @@ class Rect(displayio.TileGrid):
|
|||
self._palette.make_transparent(0)
|
||||
super().__init__(self._bitmap, pixel_shader=self._palette, position=(x, y))
|
||||
|
||||
@property
|
||||
def fill(self):
|
||||
return self._palette[0]
|
||||
|
||||
@fill.setter
|
||||
def fill(self, color):
|
||||
if color is None:
|
||||
self._palette.make_transparent(0)
|
||||
else:
|
||||
self._palette[0] = color
|
||||
|
||||
@property
|
||||
def outline(self):
|
||||
return self._palette[1]
|
||||
|
||||
@outline.setter
|
||||
def outline(self, color):
|
||||
if color is None:
|
||||
self._palette.make_transparent(1)
|
||||
else:
|
||||
self._palette[1] = color
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
"""The x coordinate of the position"""
|
||||
|
|
|
|||
|
|
@ -130,6 +130,29 @@ class RoundRect(displayio.TileGrid):
|
|||
self._bitmap[x0+y+x_offset-line, y0-x] = color
|
||||
# pylint: enable=invalid-name, too-many-locals, too-many-branches
|
||||
|
||||
@property
|
||||
def fill(self):
|
||||
return self._palette[2]
|
||||
|
||||
@fill.setter
|
||||
def fill(self, color):
|
||||
if color is None:
|
||||
self._palette.make_transparent(2)
|
||||
else:
|
||||
self._palette[2] = color
|
||||
|
||||
@property
|
||||
def outline(self):
|
||||
return self._palette[1]
|
||||
|
||||
@outline.setter
|
||||
def outline(self, color):
|
||||
if color is None:
|
||||
self._palette.make_transparent(1)
|
||||
else:
|
||||
self._palette[1] = color
|
||||
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
"""The x coordinate of the position"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue