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__(
59
59
outline : Optional [int ] = None ,
60
60
stroke : int = 1 ,
61
61
) -> None :
62
+ if width <= 0 or height <= 0 :
63
+ raise ValueError ("Rectangle dimensions must be larger than 0." )
64
+
62
65
self ._bitmap = displayio .Bitmap (width , height , 2 )
63
66
self ._palette = displayio .Palette (2 )
64
67
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ def __init__(
52
52
outline : Optional [int ] = None ,
53
53
stroke : int = 1 ,
54
54
) -> 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
+
55
62
self ._palette = displayio .Palette (3 )
56
63
self ._palette .make_transparent (0 )
57
64
self ._bitmap = displayio .Bitmap (width , height , 3 )
You can’t perform that action at this time.
0 commit comments