@@ -220,29 +220,29 @@ def rect(self, x, y, width, height, color, *, fill=False):
220220 if self .rotation == 1 :
221221 x , y = y , x
222222 width , height = height , width
223- x = self .width - x - 1
223+ x = self .width - x - width
224224 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
227227 if self .rotation == 3 :
228228 x , y = y , x
229229 width , height = height , width
230- y = self .width - y - 1
230+ y = self .height - y - height
231231
232232 if width < 1 or height < 1 or (x + width ) <= 0 or (y + height ) <= 0 or y >= self .height \
233233 or x >= self .width :
234234 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 )
237237 x = max (x , 0 )
238238 y = max (y , 0 )
239239 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 )
241241 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 )
246246
247247 def line (self , x_0 , y_0 , x_1 , y_1 , color ):
248248 # pylint: disable=too-many-arguments
0 commit comments