Add dash parameter for line, polygon, and rectangle drawing by Krishnachaitanyakc · Pull Request #9490 · python-pillow/Pillow

and others added 5 commits

March 24, 2026 22:31
Add a `dash` parameter to `ImageDraw.line()`, `ImageDraw.polygon()`, and
`ImageDraw.rectangle()` methods that allows drawing dashed outlines.

The dash pattern follows the SVG `stroke-dasharray` specification:
- Accepts a tuple of ints specifying alternating drawn/blank segment lengths
- Odd-length patterns are automatically doubled per the SVG spec
- The dash pattern is continuous across connected line segments and polygon edges
- Empty dash tuples raise ValueError

Closes python-pillow#9127
- Annotate pixels_used as float to fix float/int assignment mismatch
- Rename redefined 'points' variable to 'joint_points' in curve joint code
- Cast flat xy to Sequence[float] before slicing to fix type compatibility

radarhere

@radarhere

@radarhere