mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Simplify circle() by reusing ellipse()
This commit is contained in:
parent
8d9a4dda98
commit
38e6913579
|
@ -183,12 +183,8 @@ class ImageDraw:
|
||||||
|
|
||||||
def circle(self, xy: Coords, radius, fill=None, outline=None, width=1) -> None:
|
def circle(self, xy: Coords, radius, fill=None, outline=None, width=1) -> None:
|
||||||
"""Draw a circle given center coordinates and a radius."""
|
"""Draw a circle given center coordinates and a radius."""
|
||||||
ink, fill = self._getink(outline, fill)
|
|
||||||
ellipse_xy = (xy[0] - radius, xy[1] - radius, xy[0] + radius, xy[1] + radius)
|
ellipse_xy = (xy[0] - radius, xy[1] - radius, xy[0] + radius, xy[1] + radius)
|
||||||
if fill is not None:
|
self.ellipse(ellipse_xy, fill, outline, width)
|
||||||
self.draw.draw_ellipse(ellipse_xy, fill, 1)
|
|
||||||
if ink is not None and ink != fill and width != 0:
|
|
||||||
self.draw.draw_ellipse(ellipse_xy, ink, 0, width)
|
|
||||||
|
|
||||||
def line(self, xy: Coords, fill=None, width=0, joint=None) -> None:
|
def line(self, xy: Coords, fill=None, width=0, joint=None) -> None:
|
||||||
"""Draw a line, or a connected sequence of line segments."""
|
"""Draw a line, or a connected sequence of line segments."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user