File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,12 @@ def __init__(
59
59
outline : Optional [int ] = None ,
60
60
stroke : int = 1 ,
61
61
) -> None :
62
- self ._bitmap = displayio .Bitmap (width , height , 2 )
63
- self ._palette = displayio .Palette (2 )
64
-
65
62
if width <= 0 or height <= 0 :
66
63
raise ValueError ("Width and height must be greater than 0" )
67
64
65
+ self ._bitmap = displayio .Bitmap (width , height , 2 )
66
+ self ._palette = displayio .Palette (2 )
67
+
68
68
if outline is not None :
69
69
self ._palette [1 ] = outline
70
70
for w in range (width ):
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ def __init__(
52
52
outline : Optional [int ] = None ,
53
53
stroke : int = 1 ,
54
54
) -> None :
55
+ if r > width / 2 or r > height / 2 :
56
+ raise ValueError ("Radius too large for given dimensions" )
57
+ if width <= 0 or height <= 0 :
58
+ raise ValueError ("Width and height must be greater than 0" )
59
+
55
60
self ._palette = displayio .Palette (3 )
56
61
self ._palette .make_transparent (0 )
57
62
self ._bitmap = displayio .Bitmap (width , height , 3 )
@@ -68,9 +73,6 @@ def __init__(
68
73
y_offset = height - 2 * r - 1 ,
69
74
)
70
75
71
- if width <= 0 or height <= 0 :
72
- raise ValueError ("Width and height must be greater than 0" )
73
-
74
76
if fill is not None :
75
77
self ._palette [2 ] = fill
76
78
self ._palette .make_opaque (2 )
You can’t perform that action at this time.
0 commit comments