Do not draw line or arc if width is zero

This commit is contained in:
Andrew Murray 2026-04-27 19:51:05 +10:00
parent 82614324ed
commit 2128d6465c
2 changed files with 4 additions and 4 deletions

View File

@ -175,7 +175,7 @@ class ImageDraw:
) -> None:
"""Draw an arc."""
ink, fill = self._getink(fill)
if ink is not None:
if ink is not None and width != 0:
self.draw.draw_arc(xy, start, end, ink, width)
def bitmap(
@ -235,12 +235,12 @@ class ImageDraw:
self,
xy: Coords,
fill: _Ink | None = None,
width: int = 0,
width: int = 1,
joint: str | None = None,
) -> None:
"""Draw a line, or a connected sequence of line segments."""
ink = self._getink(fill)[0]
if ink is not None:
if ink is not None and width != 0:
self.draw.draw_lines(xy, ink, width)
if joint == "curve" and width > 4:
points: Sequence[Sequence[float]]

View File

@ -3182,7 +3182,7 @@ _draw_lines(ImagingDrawObject *self, PyObject *args) {
return NULL;
}
if (width <= 1) {
if (width == 1) {
double *p = NULL;
for (i = 0; i < n - 1; i++) {
p = &xy[i + i];