Include required arguments

This commit is contained in:
Andrew Murray 2024-07-27 18:41:37 +10:00
parent 5833a8b18e
commit db5c4fbb2c

View File

@ -80,7 +80,7 @@ class Draw:
return self.image return self.image
def render( def render(
self, op: str, xy: Coords, pen: Pen | Brush, brush: Brush | Pen | None = None self, op: str, xy: Coords, pen: Pen | Brush | None, brush: Brush | Pen | None = None
) -> None: ) -> None:
# handle color arguments # handle color arguments
outline = fill = None outline = fill = None
@ -111,50 +111,50 @@ class Draw:
(xoffset, yoffset) = offset (xoffset, yoffset) = offset
self.transform = (1, 0, xoffset, 0, 1, yoffset) self.transform = (1, 0, xoffset, 0, 1, yoffset)
def arc(self, xy: Coords, start, end, *options: Any) -> None: def arc(self, xy: Coords, pen: Pen | Brush | None, start, end, *options: Any) -> None:
""" """
Draws an arc (a portion of a circle outline) between the start and end Draws an arc (a portion of a circle outline) between the start and end
angles, inside the given bounding box. angles, inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
""" """
self.render("arc", xy, start, end, *options) self.render("arc", xy, pen, start, end, *options)
def chord(self, xy: Coords, start, end, *options: Any) -> None: def chord(self, xy: Coords, pen: Pen | Brush | None, start, end, *options: Any) -> None:
""" """
Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
with a straight line. with a straight line.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
""" """
self.render("chord", xy, start, end, *options) self.render("chord", xy, pen, start, end, *options)
def ellipse(self, xy: Coords, *options: Any) -> None: def ellipse(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None:
""" """
Draws an ellipse inside the given bounding box. Draws an ellipse inside the given bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
""" """
self.render("ellipse", xy, *options) self.render("ellipse", xy, pen, *options)
def line(self, xy: Coords, *options: Any) -> None: def line(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None:
""" """
Draws a line between the coordinates in the ``xy`` list. Draws a line between the coordinates in the ``xy`` list.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
""" """
self.render("line", xy, *options) self.render("line", xy, pen, *options)
def pieslice(self, xy: Coords, start, end, *options: Any) -> None: def pieslice(self, xy: Coords, pen: Pen | Brush | None, start, end, *options: Any) -> None:
""" """
Same as arc, but also draws straight lines between the end points and the Same as arc, but also draws straight lines between the end points and the
center of the bounding box. center of the bounding box.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
""" """
self.render("pieslice", xy, start, end, *options) self.render("pieslice", xy, pen, start, end, *options)
def polygon(self, xy: Coords, *options: Any) -> None: def polygon(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None:
""" """
Draws a polygon. Draws a polygon.
@ -165,15 +165,15 @@ class Draw:
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
""" """
self.render("polygon", xy, *options) self.render("polygon", xy, pen, *options)
def rectangle(self, xy: Coords, *options: Any) -> None: def rectangle(self, xy: Coords, pen: Pen | Brush | None, *options: Any) -> None:
""" """
Draws a rectangle. Draws a rectangle.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
""" """
self.render("rectangle", xy, *options) self.render("rectangle", xy, pen, *options)
def text(self, xy: tuple[float, float], text: AnyStr, font: Font) -> None: def text(self, xy: tuple[float, float], text: AnyStr, font: Font) -> None:
""" """