
 X(                 @   s   d  d l  m Z d d   Z d d   Z d d   Z d d	   Z d
 d   Z d d   Z d d   Z d d   Z	 d d  d d  Z
 d d  d d  Z d d   Z d d   Z d d   Z d d   Z d d    Z d! d"   Z d# d$   Z d% d& d'  Z d% S)(    )Imagec             C   s   t  j d |  j |  S)zVFill a channel with a given grey level.

    :rtype: :py:class:`~PIL.Image.Image`
    L)r   newsize)imagevalue r   K/home/ubuntu/projects/ifolica/lib/python3.4/site-packages/PIL/ImageChops.pyconstant   s    r
   c             C   s
   |  j    S)ziCopy a channel. Alias for :py:meth:`PIL.Image.Image.copy`.

    :rtype: :py:class:`~PIL.Image.Image`
    )copy)r   r   r   r	   	duplicate   s    r   c             C   s    |  j    |  j |  j j    S)z
    Invert an image (channel).

    .. code-block:: python

        out = MAX - image

    :rtype: :py:class:`~PIL.Image.Image`
    )load_newimZchop_invert)r   r   r   r	   invert'   s    
r   c             C   s0   |  j    | j    |  j |  j j | j   S)z
    Compares the two images, pixel by pixel, and returns a new image containing
    the lighter values.

    .. code-block:: python

        out = max(image1, image2)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_lighter)image1image2r   r   r	   lighter6   s    

r   c             C   s0   |  j    | j    |  j |  j j | j   S)z
    Compares the two images, pixel by pixel, and returns a new image
    containing the darker values.

    .. code-block:: python

        out = min(image1, image2)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_darker)r   r   r   r   r	   darkerG   s    

r   c             C   s0   |  j    | j    |  j |  j j | j   S)z
    Returns the absolute value of the pixel-by-pixel difference between the two
    images.

    .. code-block:: python

        out = abs(image1 - image2)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_difference)r   r   r   r   r	   
differenceX   s    

r   c             C   s0   |  j    | j    |  j |  j j | j   S)a6  
    Superimposes two images on top of each other.

    If you multiply an image with a solid black image, the result is black. If
    you multiply with a solid white image, the image is unaffected.

    .. code-block:: python

        out = image1 * image2 / MAX

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_multiply)r   r   r   r   r	   multiplyi   s    

r   c             C   s0   |  j    | j    |  j |  j j | j   S)z
    Superimposes two inverted images on top of each other.

    .. code-block:: python

        out = MAX - ((MAX - image1) * (MAX - image2) / MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_screen)r   r   r   r   r	   screen|   s    

r   g      ?c             C   s6   |  j    | j    |  j |  j j | j | |   S)a  
    Adds two images, dividing the result by scale and adding the
    offset. If omitted, scale defaults to 1.0, and offset to 0.0.

    .. code-block:: python

        out = ((image1 + image2) / scale + offset)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_add)r   r   scaleoffsetr   r   r	   add   s    

r   c             C   s6   |  j    | j    |  j |  j j | j | |   S)a  
    Subtracts two images, dividing the result by scale and adding the
    offset. If omitted, scale defaults to 1.0, and offset to 0.0.

    .. code-block:: python

        out = ((image1 - image2) / scale + offset)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_subtract)r   r   r   r   r   r   r	   subtract   s    

r   c             C   s0   |  j    | j    |  j |  j j | j   S)zAdd two images, without clipping the result.

    .. code-block:: python

        out = ((image1 + image2) % MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_add_modulo)r   r   r   r   r	   
add_modulo   s    


r   c             C   s0   |  j    | j    |  j |  j j | j   S)zSubtract two images, without clipping the result.

    .. code-block:: python

        out = ((image1 - image2) % MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_subtract_modulo)r   r   r   r   r	   subtract_modulo   s    


r   c             C   s0   |  j    | j    |  j |  j j | j   S)zLogical AND between two images.

    .. code-block:: python

        out = ((image1 and image2) % MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_and)r   r   r   r   r	   logical_and   s    


r   c             C   s0   |  j    | j    |  j |  j j | j   S)zLogical OR between two images.

    .. code-block:: python

        out = ((image1 or image2) % MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_or)r   r   r   r   r	   
logical_or   s    


r   c             C   s0   |  j    | j    |  j |  j j | j   S)zLogical XOR between two images.

    .. code-block:: python

        out = ((bool(image1) != bool(image2)) % MAX)

    :rtype: :py:class:`~PIL.Image.Image`
    )r   r   r   Zchop_xor)r   r   r   r   r	   logical_xor   s    


r    c             C   s   t  j |  | |  S)zBlend images using constant transparency weight. Alias for
    :py:meth:`PIL.Image.Image.blend`.

    :rtype: :py:class:`~PIL.Image.Image`
    )r   blend)r   r   alphar   r   r	   r!      s    r!   c             C   s   t  j |  | |  S)zCreate composite using transparency mask. Alias for
    :py:meth:`PIL.Image.Image.composite`.

    :rtype: :py:class:`~PIL.Image.Image`
    )r   	composite)r   r   maskr   r   r	   r#     s    r#   Nc             C   s;   | d k r | } n  |  j    |  j |  j j | |   S)a~  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**.

    :param xoffset: The horizontal distance.
    :param yoffset: The vertical distance.  If omitted, both
        distances are set to the same value.
    :rtype: :py:class:`~PIL.Image.Image`
    N)r   r   r   r   )r   ZxoffsetZyoffsetr   r   r	   r     s    	
r   )ZPILr   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r#   r   r   r   r   r	   <module>   s$   		

