Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Tests/images/imagedraw_rounded_rectangle_radius.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Tests/test_imagedraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,18 @@ def test_rounded_rectangle_joined_x_different_corners() -> None:
)


def test_rounded_rectangle_radius() -> None:
# Arrange
im = Image.new("RGB", (W, H))
draw = ImageDraw.Draw(im, "RGB")

# Act
draw.rounded_rectangle((25, 25, 75, 75), 24, fill="red", outline="green", width=5)

# Assert
assert_image_equal_tofile(im, "Tests/images/imagedraw_rounded_rectangle_radius.png")


@pytest.mark.parametrize(
"xy, radius, type",
[
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def draw_corners(pieslice: bool) -> None:

if full_x:
self.draw.draw_rectangle((x0, y0 + r + 1, x1, y1 - r - 1), fill_ink, 1)
elif x1 - r - 1 > x0 + r + 1:
elif x1 - r - 1 >= x0 + r + 1:
self.draw.draw_rectangle((x0 + r + 1, y0, x1 - r - 1, y1), fill_ink, 1)
if not full_x and not full_y:
left = [x0, y0, x0 + r, y1]
Expand Down
Loading