From 73c5dffb5aad8fc4ffbacecf9902920ba31ca031 Mon Sep 17 00:00:00 2001 From: nulano Date: Thu, 9 Jul 2020 19:48:42 +0200 Subject: [PATCH] fix ImageTransformHandler and ImagePointHandler references --- docs/reference/Image.rst | 10 ++++++++-- src/PIL/Image.py | 19 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/reference/Image.rst b/docs/reference/Image.rst index 347c57688..b3f4b2b8e 100644 --- a/docs/reference/Image.rst +++ b/docs/reference/Image.rst @@ -268,8 +268,8 @@ This flips the input image by using the :data:`FLIP_LEFT_RIGHT` method. .. automethod:: PIL.Image.Image.load .. automethod:: PIL.Image.Image.close -Attributes ----------- +Image Attributes +---------------- Instances of the :py:class:`Image` class have the following attributes: @@ -330,6 +330,12 @@ Instances of the :py:class:`Image` class have the following attributes: Unless noted elsewhere, this dictionary does not affect saving files. +Classes +------- + +.. autoclass:: PIL.Image.ImagePointHandler +.. autoclass:: PIL.Image.ImageTransformHandler + Constants --------- diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 7c1fb0cb8..0d35d861d 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1577,6 +1577,13 @@ class Image: single argument. The function is called once for each possible pixel value, and the resulting table is applied to all bands of the image. + + It may also be an :py:class:`~PIL.Image.ImagePointHandler` + object:: + + class Example(Image.ImagePointHandler): + def point(self, data): + # Return result :param mode: Output mode (default is same as input). In the current version, this can only be used if the source image has mode "L" or "P", and the output has mode "1" or the @@ -2534,12 +2541,20 @@ class Image: class ImagePointHandler: - # used as a mixin by point transforms (for use with im.point) + """ + Used as a mixin by point transforms + (for use with :py:meth:`~PIL.Image.Image.point`) + """ + pass class ImageTransformHandler: - # used as a mixin by geometry transforms (for use with im.transform) + """ + Used as a mixin by geometry transforms + (for use with :py:meth:`~PIL.Image.Image.transform`) + """ + pass