use code formatting instead of emphasis where applicable [ci skip]

This commit is contained in:
nulano 2020-07-10 22:12:20 +02:00
parent afbbdf5f72
commit 6cd0d60315
10 changed files with 28 additions and 33 deletions

View File

@ -365,7 +365,7 @@ interest in this object are:
The target image, will be set by Pillow.
**state**
An ImagingCodecStateInstance, will be set by Pillow. The **context**
An ImagingCodecStateInstance, will be set by Pillow. The ``context``
member is an opaque struct that can be used by the decoder to store
any format specific state or options.

View File

@ -39,12 +39,7 @@ operations in this module).
.. autofunction:: PIL.ImageChops.soft_light
.. autofunction:: PIL.ImageChops.hard_light
.. autofunction:: PIL.ImageChops.overlay
.. py:method:: PIL.ImageChops.offset(image, xoffset, yoffset=None)
Returns a copy of the image where data has been offset by the given
distances. Data wraps around the edges. If **yoffset** is omitted, it
is assumed to be equal to **xoffset**.
.. autofunction:: PIL.ImageChops.offset
.. autofunction:: PIL.ImageChops.screen
.. autofunction:: PIL.ImageChops.subtract
.. autofunction:: PIL.ImageChops.subtract_modulo

View File

@ -33,7 +33,7 @@ vector data. Path objects can be passed to the methods on the
method modifies the path in place, and returns the number of points left in
the path.
**distance** is measured as `Manhattan distance`_ and defaults to two
``distance`` is measured as `Manhattan distance`_ and defaults to two
pixels.
.. _Manhattan distance: https://en.wikipedia.org/wiki/Manhattan_distance
@ -55,7 +55,7 @@ vector data. Path objects can be passed to the methods on the
:param flat: By default, this function returns a list of 2-tuples
[(x, y), ...]. If this argument is ``True``, it
returns a flat list [x, y, ...] instead.
:return: A list of coordinates. See **flat**.
:return: A list of coordinates. See ``flat``.
.. py:method:: PIL.ImagePath.Path.transform(matrix)

View File

@ -855,7 +855,7 @@ class Image:
and the palette can be represented without a palette.
The current version supports all possible conversions between
"L", "RGB" and "CMYK." The **matrix** argument only supports "L"
"L", "RGB" and "CMYK." The ``matrix`` argument only supports "L"
and "RGB".
When translating a color image to greyscale (mode "L"),
@ -870,9 +870,9 @@ class Image:
all other values to 0 (black). To use other thresholds, use the
:py:meth:`~PIL.Image.Image.point` method.
When converting from "RGBA" to "P" without a **matrix** argument,
When converting from "RGBA" to "P" without a ``matrix`` argument,
this passes the operation to :py:meth:`~PIL.Image.Image.quantize`,
and **dither** and **palette** are ignored.
and ``dither`` and ``palette`` are ignored.
:param mode: The requested mode. See: :ref:`concept-modes`.
:param matrix: An optional conversion matrix. If given, this
@ -880,7 +880,7 @@ class Image:
:param dither: Dithering method, used when converting from
mode "RGB" to "P" or from "RGB" or "L" to "1".
Available methods are :data:`NONE` or :data:`FLOYDSTEINBERG` (default).
Note that this is not used when **matrix** is supplied.
Note that this is not used when ``matrix`` is supplied.
:param palette: Palette to use when converting from mode "RGB"
to "P". Available palettes are :data:`WEB` or :data:`ADAPTIVE`.
:param colors: Number of colors to use for the :data:`ADAPTIVE` palette.
@ -1205,7 +1205,7 @@ class Image:
def getbands(self):
"""
Returns a tuple containing the name of each band in this image.
For example, **getbands** on an RGB image returns ("R", "G", "B").
For example, ``getbands`` on an RGB image returns ("R", "G", "B").
:returns: A tuple containing band names.
:rtype: tuple
@ -1259,7 +1259,7 @@ class Image:
Note that the sequence object returned by this method is an
internal PIL data type, which only supports certain sequence
operations. To convert it to an ordinary sequence (e.g. for
printing), use **list(im.getdata())**.
printing), use ``list(im.getdata())``.
:param band: What band to return. The default is to return
all bands. To return a single band, pass in the index
@ -2354,7 +2354,7 @@ class Image:
# Return result
It may also be an object with a ``method.getdata`` method
that returns a tuple supplying new **method** and **data** values::
that returns a tuple supplying new ``method`` and ``data`` values::
class Example:
def getdata(self):
@ -2369,7 +2369,7 @@ class Image:
interpolation in a 4x4 environment). If omitted, or if the image
has mode "1" or "P", it is set to :py:data:`PIL.Image.NEAREST`.
See: :ref:`concept-filters`.
:param fill: If **method** is an
:param fill: If ``method`` is an
:py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
the arguments passed to it. Otherwise, it is unused.
:param fillcolor: Optional fill color for the area outside the
@ -2668,7 +2668,7 @@ def frombuffer(mode, size, data, decoder_name="raw", *args):
Note that this function decodes pixel data only, not entire images.
If you have an entire image file in a string, wrap it in a
**BytesIO** object, and use :py:func:`~PIL.Image.open` to load it.
:py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it.
In the current version, the default parameters used for the "raw" decoder
differs from that used for :py:func:`~PIL.Image.frombytes`. This is a
@ -2715,7 +2715,7 @@ def fromarray(obj, mode=None):
Creates an image memory from an object exporting the array interface
(using the buffer protocol).
If **obj** is not contiguous, then the tobytes method is called
If ``obj`` is not contiguous, then the ``tobytes`` method is called
and :py:func:`~PIL.Image.frombuffer` is used.
If you have an image in NumPy::

View File

@ -313,8 +313,8 @@ def composite(image1, image2, mask):
def offset(image, xoffset, yoffset=None):
"""Returns a copy of the image where data has been offset by the given
distances. Data wraps around the edges. If **yoffset** is omitted, it
is assumed to be equal to **xoffset**.
distances. Data wraps around the edges. If ``yoffset`` is omitted, it
is assumed to be equal to ``xoffset``.
:param xoffset: The horizontal distance.
:param yoffset: The vertical distance. If omitted, both

View File

@ -69,7 +69,7 @@ class Kernel(BuiltinFilter):
class RankFilter(Filter):
"""
Create a rank filter. The rank filter sorts all pixels in
a window of the given size, and returns the **rank**'th value.
a window of the given size, and returns the ``rank``'th value.
:param size: The kernel size, in pixels.
:param rank: What pixel value to pick. Use 0 for a min filter,

View File

@ -64,7 +64,7 @@ def _lut(image, lut):
def autocontrast(image, cutoff=0, ignore=None):
"""
Maximize (normalize) image contrast. This function calculates a
histogram of the input image, removes **cutoff** percent of the
histogram of the input image, removes ``cutoff`` percent of the
lightest and darkest pixels from the histogram, and remaps the image
so that the darkest pixel becomes black (0), and the lightest
becomes white (255).
@ -146,14 +146,14 @@ def colorize(image, black, white, mid=None, blackpoint=0, whitepoint=255, midpoi
Colorize grayscale image.
This function calculates a color wedge which maps all black pixels in
the source image to the first color and all white pixels to the
second color. If **mid** is specified, it uses three-color mapping.
The **black** and **white** arguments should be RGB tuples or color names;
optionally you can use three-color mapping by also specifying **mid**.
second color. If ``mid`` is specified, it uses three-color mapping.
The ``black`` and ``white`` arguments should be RGB tuples or color names;
optionally you can use three-color mapping by also specifying ``mid``.
Mapping positions for any of the colors can be specified
(e.g. **blackpoint**), where these parameters are the integer
(e.g. ``blackpoint``), where these parameters are the integer
value corresponding to where the corresponding color should be mapped.
These parameters must have logical order, such that
**blackpoint** <= **midpoint** <= **whitepoint** (if **mid** is specified).
``blackpoint <= midpoint <= whitepoint`` (if ``mid`` is specified).
:param image: The image to colorize.
:param black: The color to use for black input pixels.
@ -312,7 +312,7 @@ def deform(image, deformer, resample=Image.BILINEAR):
:param image: The image to deform.
:param deformer: A deformer object. Any object that implements a
**getmesh** method can be used.
``getmesh`` method can be used.
:param resample: An optional resampling filter. Same values possible as
in the PIL.Image.transform function.
:return: An image.

View File

@ -69,7 +69,7 @@ class PhotoImage:
image, pixels having alpha 0 are treated as transparent.
The constructor takes either a PIL image, or a mode and a size.
Alternatively, you can use the **file** or **data** options to initialize
Alternatively, you can use the ``file`` or ``data`` options to initialize
the photo image object.
:param image: Either a PIL image, or a mode string. If a mode string is
@ -210,7 +210,7 @@ class BitmapImage:
The given image must have mode "1". Pixels having value 0 are treated as
transparent. Options, if any, are passed on to Tkinter. The most commonly
used option is **foreground**, which is used to specify the color for the
used option is ``foreground``, which is used to specify the color for the
non-transparent parts. See the Tkinter documentation for information on
how to specify colours.

View File

@ -59,7 +59,7 @@ class Dib:
with 20 greylevels.
To make sure that palettes work properly under Windows, you must call the
**palette** method upon certain events from Windows.
``palette`` method upon certain events from Windows.
:param image: Either a PIL image, or a mode string. If a mode string is
used, a size must also be given. The mode can be one of "1",

View File

@ -25,7 +25,7 @@ from . import EpsImagePlugin
class PSDraw:
"""
Sets up printing to the given file. If **fp** is omitted,
Sets up printing to the given file. If ``fp`` is omitted,
:py:data:`sys.stdout` is assumed.
"""