Lars Marius Garshol

Results 321 comments of Lars Marius Garshol

I think this is a fair point. The documentation of the `number()` function says it will convert the string into a number "if possible", and it definitely is possible to...

We treat `".25` and `"0.25"` as the same number, basically. All parsed numbers become `DoubleNode` in the Jackson representation. The initial zero does not affect the type. Anyway, this has...

> Are you just talking about straight lines? Yes. In my case I need it specifically in the `ImageDraw.polygon` function, but I imagine if you do this it will be...

Not hard to find more examples of people wanting this: [1](https://stackoverflow.com/questions/64276513/draw-dotted-or-dashed-rectangle-from-pil), [2](https://stackoverflow.com/questions/43601777/python-pil-transparent-and-dashed-lines), [3](https://rodstephensbooks.com/pil_dashed_lines.html).

SVG has a [nice algorithm and way to specify the dashing](https://css-tricks.com/almanac/properties/s/stroke-dasharray/).

> From https://github.com/python-pillow/Pillow/issues/8976, I think you have an https://github.com/python-pillow/Pillow/issues/8976#issuecomment-2910546870 need for speed. I think that's fair to say. In fact, I have implemented this in Python now, and was surprised...

It strikes me now that it would be possible to add support for dashed lines in the Python layer of Pillow. Is that a contribution that would be interesting?

@stefan6419846 I need some help with this. ruff and Python both are complaining about `Dict` in my added code, claiming it's not declared. It is imported on line 39, though....

That worked. Thank you! The PR should be ready now.

It does assume the destinations never change. Originally I put this cache on the shared superclass for readers and writers, but then had the same realization as you. So now...