Improve ImageDraw2 shape methods by radarhere · Pull Request #8265 · python-pillow/Pillow
Some improvements to ImageDraw2.
but that is not the case.
from PIL import Image, ImageDraw2 im = Image.new("RGB", (100, 100)) d = ImageDraw2.Draw(im) d.ellipse((0, 0, 100, 100))
Traceback (most recent call last): File "demo.py", line 4, in <module> d.ellipse((0, 0, 100, 100)) File "PIL/ImageDraw2.py", line 138, in ellipse self.render("ellipse", xy, *options) TypeError: render() missing 1 required positional argument: 'pen'
So I've made a change to add pen as a required argument to arc() and other methods.
Some of our test code does pass through pen as None, and uses the brush argument for the Pen instead.
But even if pen is None, the fact that brush needs to come afterwards means that a value for pen is still required.
>>> from PIL import Image, ImageDraw2
>>> im = Image.new("RGB", (1, 1))
>>> d = ImageDraw2.Draw(im)
>>> d.arc((0, 0), 0, 180)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/ImageDraw2.py", line 121, in arc
self.render("arc", xy, start, end, *options)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/ImageDraw2.py", line 107, in render
getattr(self.draw, op)(xy, fill=fill, outline=outline)
TypeError: arc() got an unexpected keyword argument 'outline'This is because ImageDraw2 render() passes outline to every method except for line(), but ImageDraw arc() doesn't accept that.
I've made a change for that.