Skip to content

Commit

Permalink
Merge pull request #7151 from radarhere/rounded_rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed May 12, 2023
2 parents 0efd72d + c68c508 commit c561cd2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Binary file added Tests/images/imagedraw_rounded_rectangle_x_odd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/imagedraw_rounded_rectangle_y_odd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Tests/test_imagedraw.py
Expand Up @@ -839,7 +839,9 @@ def test_rounded_rectangle_zero_radius(bbox):
"xy, suffix",
[
((20, 10, 80, 90), "x"),
((20, 10, 81, 90), "x_odd"),
((10, 20, 90, 80), "y"),
((10, 20, 90, 81), "y_odd"),
((20, 20, 80, 80), "both"),
],
)
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageDraw.py
Expand Up @@ -314,11 +314,11 @@ def rounded_rectangle(

full_x, full_y = False, False
if all(corners):
full_x = d >= x1 - x0
full_x = d >= x1 - x0 - 1
if full_x:
# The two left and two right corners are joined
d = x1 - x0
full_y = d >= y1 - y0
full_y = d >= y1 - y0 - 1
if full_y:
# The two top and two bottom corners are joined
d = y1 - y0
Expand Down

0 comments on commit c561cd2

Please sign in to comment.