Merge de1a42e3cc into 877527cefc
This commit is contained in:
commit
80c58b1c0b
@ -945,6 +945,21 @@ def test_rounded_rectangle_zero_radius(bbox: Coords) -> None:
|
||||
assert_image_equal_tofile(im, "Tests/images/imagedraw_rectangle_width_fill.png")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("w, h", ((200, 100), (100, 200)))
|
||||
def test_rounded_rectangle_large_radius(w: int, h: int) -> None:
|
||||
im = Image.new("RGB", (w, h))
|
||||
draw = ImageDraw.Draw(im)
|
||||
draw.rounded_rectangle(
|
||||
(0, 0, w, h), 100, "red", corners=(True, False, False, False)
|
||||
)
|
||||
|
||||
expected = Image.new("RGB", (w, h))
|
||||
draw = ImageDraw.Draw(expected)
|
||||
draw.rounded_rectangle((0, 0, w, h), 50, "red", corners=(True, False, False, False))
|
||||
|
||||
assert_image_equal(im, expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"xy, suffix",
|
||||
[
|
||||
|
||||
@ -382,7 +382,8 @@ Methods
|
||||
:param xy: Two points to define the bounding box. Sequence of either
|
||||
``[(x0, y0), (x1, y1)]`` or ``[x0, y0, x1, y1]``, where ``x1 >= x0`` and
|
||||
``y1 >= y0``. The bounding box is inclusive of both endpoints.
|
||||
:param radius: Radius of the corners.
|
||||
:param radius: Radius of the corners, limited to half of the smallest dimension of
|
||||
the bounding box.
|
||||
:param fill: Color to use for the fill.
|
||||
:param outline: Color to use for the outline.
|
||||
:param width: The line width, in pixels.
|
||||
|
||||
@ -419,7 +419,7 @@ class ImageDraw:
|
||||
if corners is None:
|
||||
corners = (True, True, True, True)
|
||||
|
||||
d = radius * 2
|
||||
d = min(x1 - x0, y1 - y0, radius * 2)
|
||||
|
||||
x0 = round(x0)
|
||||
y0 = round(y0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user