mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge pull request #8124 from radarhere/imagedraw_getdraw
This commit is contained in:
commit
7928bebd65
|
@ -1624,3 +1624,8 @@ def test_incorrectly_ordered_coordinates(xy: tuple[int, int, int, int]) -> None:
|
|||
draw.rectangle(xy)
|
||||
with pytest.raises(ValueError):
|
||||
draw.rounded_rectangle(xy)
|
||||
|
||||
|
||||
def test_getdraw():
|
||||
with pytest.warns(DeprecationWarning):
|
||||
ImageDraw.getdraw(None, [])
|
||||
|
|
|
@ -115,6 +115,13 @@ Support for LibTIFF earlier than 4
|
|||
Support for LibTIFF earlier than version 4 has been deprecated.
|
||||
Upgrade to a newer version of LibTIFF instead.
|
||||
|
||||
ImageDraw.getdraw hints parameter
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. deprecated:: 10.4.0
|
||||
|
||||
The ``hints`` parameter in :py:meth:`~PIL.ImageDraw.getdraw()` has been deprecated.
|
||||
|
||||
Removed features
|
||||
----------------
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ Support for LibTIFF earlier than 4
|
|||
Support for LibTIFF earlier than version 4 has been deprecated.
|
||||
Upgrade to a newer version of LibTIFF instead.
|
||||
|
||||
ImageDraw.getdraw hints parameter
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ``hints`` parameter in :py:meth:`~PIL.ImageDraw.getdraw()` has been deprecated.
|
||||
|
||||
API Changes
|
||||
===========
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import struct
|
|||
from typing import TYPE_CHECKING, AnyStr, Sequence, cast
|
||||
|
||||
from . import Image, ImageColor
|
||||
from ._deprecate import deprecate
|
||||
from ._typing import Coords
|
||||
|
||||
"""
|
||||
|
@ -904,26 +905,17 @@ except AttributeError:
|
|||
|
||||
def getdraw(im=None, hints=None):
|
||||
"""
|
||||
(Experimental) A more advanced 2D drawing interface for PIL images,
|
||||
based on the WCK interface.
|
||||
|
||||
:param im: The image to draw in.
|
||||
:param hints: An optional list of hints.
|
||||
:param hints: An optional list of hints. Deprecated.
|
||||
:returns: A (drawing context, drawing resource factory) tuple.
|
||||
"""
|
||||
# FIXME: this needs more work!
|
||||
# FIXME: come up with a better 'hints' scheme.
|
||||
handler = None
|
||||
if not hints or "nicest" in hints:
|
||||
try:
|
||||
from . import _imagingagg as handler
|
||||
except ImportError:
|
||||
pass
|
||||
if handler is None:
|
||||
from . import ImageDraw2 as handler
|
||||
if hints is not None:
|
||||
deprecate("'hints' parameter", 12)
|
||||
from . import ImageDraw2
|
||||
|
||||
if im:
|
||||
im = handler.Draw(im)
|
||||
return im, handler
|
||||
im = ImageDraw2.Draw(im)
|
||||
return im, ImageDraw2
|
||||
|
||||
|
||||
def floodfill(
|
||||
|
|
Loading…
Reference in New Issue
Block a user