Skip to content
Open
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
2 changes: 1 addition & 1 deletion Tests/test_imagedraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ def test_dash_rectangle() -> None:

# Act
draw.rectangle([10, 10, 90, 90], outline="green", dash=(10, 5))
draw.rectangle([30, 30, 70, 70], fill="red", outline="green", dash=(10, 5))
draw.rectangle([(30, 30), (70, 70)], fill="red", outline="green", dash=(10, 5))

# Assert
assert_image_equal_tofile(im, "Tests/images/imagedraw_dash_rectangle.png")
Expand Down
12 changes: 2 additions & 10 deletions src/PIL/ImageDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,9 @@ def rectangle(
if len(dash) == 0 or any(not isinstance(v, int) for v in dash):
msg = "dash must be a non-empty tuple of ints"
raise ValueError(msg)
(x0, y0), (x1, y1) = self._normalize_coords(xy)
self.draw.draw_lines(
[
(xy[0], xy[1]),
(xy[2], xy[1]),
(xy[2], xy[3]),
(xy[0], xy[3]),
(xy[0], xy[1]),
],
ink,
1,
dash,
[(x0, y0), (x1, y0), (x1, y1), (x0, y1), (x0, y0)], ink, 1, dash
)
else:
self.draw.draw_rectangle(xy, ink, 0, width)
Expand Down
Loading