mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
If left and right sides meet, do not draw rectangle to fill gap
This commit is contained in:
parent
b14142462e
commit
d5e3f6b516
Binary file not shown.
After Width: | Height: | Size: 411 B |
|
@ -857,6 +857,27 @@ def test_rounded_rectangle_corners(
|
|||
)
|
||||
|
||||
|
||||
def test_rounded_rectangle_joined_x_different_corners() -> None:
|
||||
# Arrange
|
||||
im = Image.new("RGB", (W, H))
|
||||
draw = ImageDraw.Draw(im, "RGBA")
|
||||
|
||||
# Act
|
||||
draw.rounded_rectangle(
|
||||
(20, 10, 80, 90),
|
||||
30,
|
||||
fill="red",
|
||||
outline="green",
|
||||
width=5,
|
||||
corners=(True, False, False, False),
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert_image_equal_tofile(
|
||||
im, "Tests/images/imagedraw_rounded_rectangle_joined_x_different_corners.png"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"xy, radius, type",
|
||||
[
|
||||
|
|
|
@ -505,7 +505,7 @@ class ImageDraw:
|
|||
|
||||
if full_x:
|
||||
self.draw.draw_rectangle((x0, y0 + r + 1, x1, y1 - r - 1), fill_ink, 1)
|
||||
else:
|
||||
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]
|
||||
|
|
Loading…
Reference in New Issue
Block a user