@@ -573,7 +573,7 @@ def rect(self, x, y, width, height, color):
573
573
:param int height: The height of the rectangle
574
574
:param int color: The color of the rectangle
575
575
"""
576
- self ._rect_helper (x , y , width , height , color , False )
576
+ self ._rect_helper (x , y , x + width - 1 , y + height - 1 , color , False )
577
577
578
578
def fill_rect (self , x , y , width , height , color ):
579
579
"""
@@ -585,15 +585,15 @@ def fill_rect(self, x, y, width, height, color):
585
585
:param int height: The height of the rectangle
586
586
:param int color: The color of the rectangle
587
587
"""
588
- self ._rect_helper (x , y , width , height , color , True )
588
+ self ._rect_helper (x , y , x + width - 1 , y + height - 1 , color , True )
589
589
590
590
def fill (self , color ):
591
591
"""
592
592
Fill the Entire Screen (HW Accelerated)
593
593
594
594
:param int color: The color to Fill the screen
595
595
"""
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 )
597
597
598
598
def circle (self , x_center , y_center , radius , color ):
599
599
"""
@@ -706,7 +706,7 @@ def hline(self, x, y, width, color):
706
706
:param int width: The width of the line
707
707
:param int color: The color of the line
708
708
"""
709
- self .line (x , y , x + width , y , color )
709
+ self .line (x , y , x + width - 1 , y , color )
710
710
711
711
def vline (self , x , y , height , color ):
712
712
"""
@@ -717,7 +717,7 @@ def vline(self, x, y, height, color):
717
717
:param int height: The height of the line
718
718
:param int color: The color of the line
719
719
"""
720
- self .line (x , y , x , y + height , color )
720
+ self .line (x , y , x , y + height - 1 , color )
721
721
722
722
def line (self , x1 , y1 , x2 , y2 , color ):
723
723
"""
@@ -758,13 +758,14 @@ def round_rect(self, x, y, width, height, radius, color):
758
758
"""
759
759
self ._gfx_mode ()
760
760
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 )
762
762
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 )
766
767
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 )
768
769
769
770
def fill_round_rect (self , x , y , width , height , radius , color ):
770
771
"""
@@ -779,11 +780,12 @@ def fill_round_rect(self, x, y, width, height, radius, color):
779
780
"""
780
781
self ._gfx_mode ()
781
782
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 )
783
784
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 )
787
789
788
790
def _circle_helper (self , x , y , radius , color , filled ):
789
791
"""General Circle Drawing Helper"""
@@ -800,17 +802,17 @@ def _circle_helper(self, x, y, radius, color, filled):
800
802
self ._write_reg (reg .DCR , reg .DCR_CIRC_START | (reg .DCR_FILL if filled else reg .DCR_NOFILL ))
801
803
self ._wait_poll (reg .DCR , reg .DCR_CIRC_STATUS )
802
804
803
- def _rect_helper (self , x , y , width , height , color , filled ):
805
+ def _rect_helper (self , x1 , y1 , x2 , y2 , color , filled ):
804
806
"""General Rectangle Drawing Helper"""
805
807
self ._gfx_mode ()
806
808
807
809
# 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 )
810
812
811
813
# 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 )
814
816
815
817
self .set_color (color )
816
818
0 commit comments