Added coordinate system links in documentation

This commit is contained in:
Andrew Murray 2018-06-24 14:34:01 +10:00
parent 968c2cf3c9
commit 7274636a7e
8 changed files with 26 additions and 17 deletions

View File

@ -58,6 +58,8 @@ You can read the image size through the :py:attr:`~PIL.Image.Image.size`
attribute. This is a 2-tuple, containing the horizontal and vertical size in
pixels.
.. _coordinate-system:
Coordinate System
-----------------

View File

@ -1066,7 +1066,7 @@ class Image(object):
"""
Returns a rectangular region from this image. The box is a
4-tuple defining the left, upper, right, and lower pixel
coordinate.
coordinate. See :ref:`coordinate-system`.
Note: Prior to Pillow 3.4.0, this was a lazy operation.
@ -1173,8 +1173,9 @@ class Image(object):
image.
:returns: The bounding box is returned as a 4-tuple defining the
left, upper, right, and lower pixel coordinate. If the image
is completely empty, this method returns None.
left, upper, right, and lower pixel coordinate. See
:ref:`coordinate-system`. If the image is completely empty, this
method returns None.
"""
@ -1275,7 +1276,8 @@ class Image(object):
"""
Returns the pixel value at a given position.
:param xy: The coordinate, given as (x, y).
:param xy: The coordinate, given as (x, y). See
:ref:`coordinate-system`.
:returns: The pixel value. If the image is a multi-layer image,
this method returns a tuple.
"""
@ -1335,8 +1337,8 @@ class Image(object):
Pastes another image into this image. The box argument is either
a 2-tuple giving the upper left corner, a 4-tuple defining the
left, upper, right, and lower pixel coordinate, or None (same as
(0, 0)). If a 4-tuple is given, the size of the pasted image
must match the size of the region.
(0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size
of the pasted image must match the size of the region.
If the modes don't match, the pasted image is converted to the mode of
this image (see the :py:meth:`~PIL.Image.Image.convert` method for
@ -1616,7 +1618,8 @@ class Image(object):
* :py:meth:`~PIL.Image.Image.putdata`
* :py:mod:`~PIL.ImageDraw`
:param xy: The pixel coordinate, given as (x, y).
:param xy: The pixel coordinate, given as (x, y). See
:ref:`coordinate-system`.
:param value: The pixel value.
"""

View File

@ -327,7 +327,8 @@ def floodfill(image, xy, value, border=None, thresh=0):
(experimental) Fills a bounded region with a given color.
:param image: Target image.
:param xy: Seed position (a 2-item coordinate tuple).
:param xy: Seed position (a 2-item coordinate tuple). See
:ref:`coordinate-system`.
:param value: Fill color.
:param border: Optional border value. If given, the region consists of
pixels with a color different from the border color. If not given,

View File

@ -211,7 +211,7 @@ class MorphOp(object):
an image.
Returns a list of tuples of (x,y) coordinates
of all matching pixels."""
of all matching pixels. See :ref:`coordinate-system`."""
if self.lut is None:
raise Exception('No operator loaded')
@ -223,7 +223,7 @@ class MorphOp(object):
"""Get a list of all turned on pixels in a binary image
Returns a list of tuples of (x,y) coordinates
of all matching pixels."""
of all matching pixels. See :ref:`coordinate-system`."""
if image.mode != 'L':
raise Exception('Image must be binary, meaning it must use mode L')

View File

@ -169,8 +169,8 @@ class PhotoImage(object):
mode does not match, the image is converted to the mode of
the bitmap image.
:param box: A 4-tuple defining the left, upper, right, and lower pixel
coordinate. If None is given instead of a tuple, all of
the image is assumed.
coordinate. See :ref:`coordinate-system`. If None is given
instead of a tuple, all of the image is assumed.
"""
# convert to blittable

View File

@ -65,7 +65,7 @@ class ExtentTransform(Transform):
See :py:meth:`~PIL.Image.Image.transform`
:param bbox: A 4-tuple (x0, y0, x1, y1) which specifies two points in the
input image's coordinate system.
input image's coordinate system. See :ref:`coordinate-system`.
"""
method = Image.EXTENT

View File

@ -154,8 +154,9 @@ class Dib(object):
If the mode does not match, the image is converted to the
mode of the bitmap image.
:param box: A 4-tuple defining the left, upper, right, and
lower pixel coordinate. If None is given instead of a
tuple, all of the image is assumed.
lower pixel coordinate. See :ref:`coordinate-system`. If
None is given instead of a tuple, all of the image is
assumed.
"""
im.load()
if self.mode != im.mode:

View File

@ -68,7 +68,8 @@ class PyAccess(object):
numerical value for single band images, and a tuple for
multi-band images
:param xy: The pixel coordinate, given as (x, y).
:param xy: The pixel coordinate, given as (x, y). See
:ref:`coordinate-system`.
:param color: The pixel value.
"""
if self.readonly:
@ -82,7 +83,8 @@ class PyAccess(object):
value for single band images or a tuple for multiple band
images
:param xy: The pixel coordinate, given as (x, y).
:param xy: The pixel coordinate, given as (x, y). See
:ref:`coordinate-system`.
:returns: a pixel value for single band images, a tuple of
pixel values for multiband images.
"""