Skip to content

Commit ce0fa04

Browse files
committed
Changed SupportsGetMesh protocol to be public
1 parent 18af646 commit ce0fa04

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/reference/ImageOps.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ only work on L and RGB images.
1414
.. autofunction:: colorize
1515
.. autofunction:: crop
1616
.. autofunction:: scale
17+
.. autoclass:: SupportsGetMesh
18+
:show-inheritance:
1719
.. autofunction:: deform
1820
.. autofunction:: equalize
1921
.. autofunction:: expand

src/PIL/ImageOps.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,14 @@ def scale(
411411
return image.resize(size, resample)
412412

413413

414-
class _SupportsGetMesh(Protocol):
414+
class SupportsGetMesh(Protocol):
415+
"""
416+
An object that supports the ``getmesh`` method, taking an image as an
417+
argument, and returning a list of tuples. Each tuple contains two tuples,
418+
the source box as a tuple of 4 integers, and a tuple of 8 integers for the
419+
final quadrilateral, in order of top left, bottom left, bottom right, top
420+
right.
421+
"""
415422
def getmesh(
416423
self, image: Image.Image
417424
) -> list[
@@ -421,7 +428,7 @@ def getmesh(
421428

422429
def deform(
423430
image: Image.Image,
424-
deformer: _SupportsGetMesh,
431+
deformer: SupportsGetMesh,
425432
resample: int = Image.Resampling.BILINEAR,
426433
) -> Image.Image:
427434
"""

0 commit comments

Comments
 (0)