Skip to content

Commit a73e2b1

Browse files
committed
Do not draw line or arc if width is zero
1 parent fba1791 commit a73e2b1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/PIL/ImageDraw.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def arc(
175175
) -> None:
176176
"""Draw an arc."""
177177
ink, fill = self._getink(fill)
178-
if ink is not None:
178+
if ink is not None and width != 0:
179179
self.draw.draw_arc(xy, start, end, ink, width)
180180

181181
def bitmap(
@@ -235,12 +235,12 @@ def line(
235235
self,
236236
xy: Coords,
237237
fill: _Ink | None = None,
238-
width: int = 0,
238+
width: int = 1,
239239
joint: str | None = None,
240240
) -> None:
241241
"""Draw a line, or a connected sequence of line segments."""
242242
ink = self._getink(fill)[0]
243-
if ink is not None:
243+
if ink is not None and width != 0:
244244
self.draw.draw_lines(xy, ink, width)
245245
if joint == "curve" and width > 4:
246246
points: Sequence[Sequence[float]]

src/_imaging.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3182,7 +3182,7 @@ _draw_lines(ImagingDrawObject *self, PyObject *args) {
31823182
return NULL;
31833183
}
31843184

3185-
if (width <= 1) {
3185+
if (width == 1) {
31863186
double *p = NULL;
31873187
for (i = 0; i < n - 1; i++) {
31883188
p = &xy[i + i];

0 commit comments

Comments
 (0)