File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ def __init__(
5959 outline : Optional [int ] = None ,
6060 stroke : int = 1 ,
6161 ) -> None :
62+ if width <= 0 or height <= 0 :
63+ raise ValueError ("Rectangle dimensions must be larger than 0." )
64+
6265 self ._bitmap = displayio .Bitmap (width , height , 2 )
6366 self ._palette = displayio .Palette (2 )
6467
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ def __init__(
5252 outline : Optional [int ] = None ,
5353 stroke : int = 1 ,
5454 ) -> None :
55+ if width <= 0 or height <= 0 :
56+ raise ValueError ("Rectangle dimensions must be larger than 0." )
57+ if r > width / 2 or r > height / 2 :
58+ raise ValueError (
59+ "Radius cannot exceed half of the smaller side (width or height)."
60+ )
61+
5562 self ._palette = displayio .Palette (3 )
5663 self ._palette .make_transparent (0 )
5764 self ._bitmap = displayio .Bitmap (width , height , 3 )
You can’t perform that action at this time.
0 commit comments