Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 794a7d6

Browse files
authored
Merge pull request #7881 from radarhere/rounded_rectangle
2 parents 786ded0 + d245325 commit 794a7d6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Tests/test_imagedraw.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,10 @@ def test_rounded_rectangle_zero_radius(bbox: Coords) -> None:
868868
[
869869
((20, 10, 80, 90), "x"),
870870
((20, 10, 81, 90), "x_odd"),
871+
((20, 10, 81.1, 90), "x_odd"),
871872
((10, 20, 90, 80), "y"),
872873
((10, 20, 90, 81), "y_odd"),
874+
((10, 20, 90, 81.1), "y_odd"),
873875
((20, 20, 80, 80), "both"),
874876
],
875877
)

src/PIL/ImageDraw.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ def rounded_rectangle(
336336

337337
d = radius * 2
338338

339+
x0 = round(x0)
340+
y0 = round(y0)
341+
x1 = round(x1)
342+
y1 = round(y1)
339343
full_x, full_y = False, False
340344
if all(corners):
341345
full_x = d >= x1 - x0 - 1

0 commit comments

Comments
 (0)