@@ -573,7 +573,7 @@ def rect(self, x, y, width, height, color):
573573 :param int height: The height of the rectangle
574574 :param int color: The color of the rectangle
575575 """
576- self ._rect_helper (x , y , width , height , color , False )
576+ self ._rect_helper (x , y , x + width - 1 , y + height - 1 , color , False )
577577
578578 def fill_rect (self , x , y , width , height , color ):
579579 """
@@ -585,15 +585,15 @@ def fill_rect(self, x, y, width, height, color):
585585 :param int height: The height of the rectangle
586586 :param int color: The color of the rectangle
587587 """
588- self ._rect_helper (x , y , width , height , color , True )
588+ self ._rect_helper (x , y , x + width - 1 , y + height - 1 , color , True )
589589
590590 def fill (self , color ):
591591 """
592592 Fill the Entire Screen (HW Accelerated)
593593
594594 :param int color: The color to Fill the screen
595595 """
596- self ._rect_helper (0 , 0 , self .width , self .height , color , True )
596+ self ._rect_helper (0 , 0 , self .width - 1 , self .height - 1 , color , True )
597597
598598 def circle (self , x_center , y_center , radius , color ):
599599 """
@@ -706,7 +706,7 @@ def hline(self, x, y, width, color):
706706 :param int width: The width of the line
707707 :param int color: The color of the line
708708 """
709- self .line (x , y , x + width , y , color )
709+ self .line (x , y , x + width - 1 , y , color )
710710
711711 def vline (self , x , y , height , color ):
712712 """
@@ -717,7 +717,7 @@ def vline(self, x, y, height, color):
717717 :param int height: The height of the line
718718 :param int color: The color of the line
719719 """
720- self .line (x , y , x , y + height , color )
720+ self .line (x , y , x , y + height - 1 , color )
721721
722722 def line (self , x1 , y1 , x2 , y2 , color ):
723723 """
@@ -758,13 +758,14 @@ def round_rect(self, x, y, width, height, radius, color):
758758 """
759759 self ._gfx_mode ()
760760 self ._curve_helper (x + radius , y + radius , radius , radius , 1 , color , False )
761- self ._curve_helper (x + width - radius , y + radius , radius , radius , 2 , color , False )
761+ self ._curve_helper (x + width - radius - 1 , y + radius , radius , radius , 2 , color , False )
762762 self ._curve_helper (x + radius , y + height - radius , radius , radius , 0 , color , False )
763- self ._curve_helper (x + width - radius , y + height - radius , radius , radius , 3 , color , False )
764- self .hline (x + radius , y , width - (radius * 2 ), color )
765- self .hline (x + radius , y + height , width - (radius * 2 ), color )
763+ self ._curve_helper (x + width - radius - 1 , y + height - radius , radius , radius , 3 , color ,
764+ False )
765+ self .hline (x + radius , y , width - (radius * 2 ) - 1 , color )
766+ self .hline (x + radius , y + height , width - (radius * 2 ) - 1 , color )
766767 self .vline (x , y + radius , height - (radius * 2 ), color )
767- self .vline (x + width , y + radius , height - (radius * 2 ), color )
768+ self .vline (x + width - 1 , y + radius , height - (radius * 2 ), color )
768769
769770 def fill_round_rect (self , x , y , width , height , radius , color ):
770771 """
@@ -779,11 +780,12 @@ def fill_round_rect(self, x, y, width, height, radius, color):
779780 """
780781 self ._gfx_mode ()
781782 self ._curve_helper (x + radius , y + radius , radius , radius , 1 , color , True )
782- self ._curve_helper (x + width - radius , y + radius , radius , radius , 2 , color , True )
783+ self ._curve_helper (x + width - radius - 1 , y + radius , radius , radius , 2 , color , True )
783784 self ._curve_helper (x + radius , y + height - radius , radius , radius , 0 , color , True )
784- self ._curve_helper (x + width - radius , y + height - radius , radius , radius , 3 , color , True )
785- self ._rect_helper (x + radius , y , x + width - radius , y + height , color , True )
786- self ._rect_helper (x , y + radius , x + width , y + height - radius , color , True )
785+ self ._curve_helper (x + width - radius - 1 , y + height - radius , radius , radius , 3 , color ,
786+ True )
787+ self ._rect_helper (x + radius , y , x + width - radius - 1 , y + height - 1 , color , True )
788+ self ._rect_helper (x , y + radius , x + width - 1 , y + height - radius - 1 , color , True )
787789
788790 def _circle_helper (self , x , y , radius , color , filled ):
789791 """General Circle Drawing Helper"""
@@ -800,17 +802,17 @@ def _circle_helper(self, x, y, radius, color, filled):
800802 self ._write_reg (reg .DCR , reg .DCR_CIRC_START | (reg .DCR_FILL if filled else reg .DCR_NOFILL ))
801803 self ._wait_poll (reg .DCR , reg .DCR_CIRC_STATUS )
802804
803- def _rect_helper (self , x , y , width , height , color , filled ):
805+ def _rect_helper (self , x1 , y1 , x2 , y2 , color , filled ):
804806 """General Rectangle Drawing Helper"""
805807 self ._gfx_mode ()
806808
807809 # Set X and Y
808- self ._write_reg16 (0x91 , x )
809- self ._write_reg16 (0x93 , y + self .vert_offset )
810+ self ._write_reg16 (0x91 , x1 )
811+ self ._write_reg16 (0x93 , y1 + self .vert_offset )
810812
811813 # Set Width and Height
812- self ._write_reg16 (0x95 , width )
813- self ._write_reg16 (0x97 , height + self .vert_offset )
814+ self ._write_reg16 (0x95 , x2 )
815+ self ._write_reg16 (0x97 , y2 + self .vert_offset )
814816
815817 self .set_color (color )
816818
0 commit comments