Merge pull request #7151 from radarhere/rounded_rectangle

This commit is contained in:
Hugo van Kemenade 2023-05-12 18:35:13 +03:00 committed by GitHub
commit c561cd2b44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

View File

@ -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"),
],
)

View File

@ -314,11 +314,11 @@ class ImageDraw:
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