@@ -220,29 +220,29 @@ def rect(self, x, y, width, height, color, *, fill=False):
220
220
if self .rotation == 1 :
221
221
x , y = y , x
222
222
width , height = height , width
223
- x = self .width - x - 1
223
+ x = self .width - x - width
224
224
if self .rotation == 2 :
225
- x = self .width - x - 1
226
- y = self .width - y - 1
225
+ x = self .width - x - width
226
+ y = self .height - y - height
227
227
if self .rotation == 3 :
228
228
x , y = y , x
229
229
width , height = height , width
230
- y = self .width - y - 1
230
+ y = self .height - y - height
231
231
232
232
if width < 1 or height < 1 or (x + width ) <= 0 or (y + height ) <= 0 or y >= self .height \
233
233
or x >= self .width :
234
234
return
235
- x_end = min (self .width - 1 , x + width )
236
- y_end = min (self .height - 1 , y + height )
235
+ x_end = min (self .width - 1 , x + width - 1 )
236
+ y_end = min (self .height - 1 , y + height - 1 )
237
237
x = max (x , 0 )
238
238
y = max (y , 0 )
239
239
if fill :
240
- self .format .fill_rect (self , x , y , x_end - x , y_end - y , color )
240
+ self .format .fill_rect (self , x , y , x_end - x + 1 , y_end - y + 1 , color )
241
241
else :
242
- self .format .fill_rect (self , x , y , x_end - x , 1 , color )
243
- self .format .fill_rect (self , x , y , 1 , y_end - y , color )
244
- self .format .fill_rect (self , x , y_end , x_end - x , 1 , color )
245
- self .format .fill_rect (self , x_end , y , 1 , y_end - y , color )
242
+ self .format .fill_rect (self , x , y , x_end - x + 1 , 1 , color )
243
+ self .format .fill_rect (self , x , y , 1 , y_end - y + 1 , color )
244
+ self .format .fill_rect (self , x , y_end , x_end - x + 1 , 1 , color )
245
+ self .format .fill_rect (self , x_end , y , 1 , y_end - y + 1 , color )
246
246
247
247
def line (self , x_0 , y_0 , x_1 , y_1 , color ):
248
248
# pylint: disable=too-many-arguments
0 commit comments