diff --git a/adafruit_display_shapes/rect.py b/adafruit_display_shapes/rect.py index 8ced77d..3f051eb 100644 --- a/adafruit_display_shapes/rect.py +++ b/adafruit_display_shapes/rect.py @@ -95,3 +95,17 @@ def outline(self, color): else: self._palette[1] = color self._palette.make_opaque(1) + + @property + def width(self) -> int: + """ + :return: the width of the rectangle in pixels + """ + return self._bitmap.width + + @property + def height(self) -> int: + """ + :return: the height of the rectangle in pixels + """ + return self._bitmap.height diff --git a/adafruit_display_shapes/roundrect.py b/adafruit_display_shapes/roundrect.py index 82ea8b6..0df799b 100644 --- a/adafruit_display_shapes/roundrect.py +++ b/adafruit_display_shapes/roundrect.py @@ -170,3 +170,17 @@ def outline(self, color): else: self._palette[1] = color self._palette.make_opaque(2) + + @property + def width(self) -> int: + """ + :return: the width of the rounded rectangle in pixels + """ + return self._bitmap.width + + @property + def height(self) -> int: + """ + :return: the height of the rounded rectangle in pixels + """ + return self._bitmap.height