ó
È4ec           @   s   d  d l  m Z m Z m Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d	     YZ d
 e f d     YZ	 d S(   i   (   t   Imaget   ImageFiltert	   ImageStatt   _Enhancec           B   s   e  Z d    Z RS(   c         C   s   t  j |  j |  j |  S(   sµ  
        Returns an enhanced image.

        :param factor: A floating point value controlling the enhancement.
                       Factor 1.0 always returns a copy of the original image,
                       lower factors mean less color (brightness, contrast,
                       etc), and higher values more. There are no restrictions
                       on this value.
        :rtype: :py:class:`~PIL.Image.Image`
        (   R    t   blendt
   degeneratet   image(   t   selft   factor(    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyt   enhance   s    (   t   __name__t
   __module__R	   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR      s   t   Colorc           B   s   e  Z d  Z d   Z RS(   s  Adjust image color balance.

    This class can be used to adjust the colour balance of an image, in
    a manner similar to the controls on a colour TV set. An enhancement
    factor of 0.0 gives a black and white image. A factor of 1.0 gives
    the original image.
    c         C   sU   | |  _  d |  _ d | j   k r0 d |  _ n  | j |  j  j | j  |  _ d  S(   Nt   Lt   At   LA(   R   t   intermediate_modet   getbandst   convertt   modeR   (   R   R   (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyt   __init__0   s
    		(   R
   R   t   __doc__R   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   '   s   t   Contrastc           B   s   e  Z d  Z d   Z RS(   sò   Adjust image contrast.

    This class can be used to control the contrast of an image, similar
    to the contrast control on a TV set. An enhancement factor of 0.0
    gives a solid grey image. A factor of 1.0 gives the original image.
    c         C   s   | |  _  t t j | j d   j d d  } t j d | j |  j | j	  |  _
 d | j   k r |  j
 j | j d   n  d  S(   NR   i    g      à?R   (   R   t   intR   t   StatR   t   meanR    t   newt   sizeR   R   R   t   putalphat
   getchannel(   R   R   R   (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   A   s
    	)'(   R
   R   R   R   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   9   s   t
   Brightnessc           B   s   e  Z d  Z d   Z RS(   sÅ   Adjust image brightness.

    This class can be used to control the brightness of an image.  An
    enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the
    original image.
    c         C   sY   | |  _  t j | j | j d  |  _ d | j   k rU |  j j | j d   n  d  S(   Ni    R   (	   R   R    R   R   R   R   R   R   R   (   R   R   (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   R   s    	(   R
   R   R   R   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   J   s   t	   Sharpnessc           B   s   e  Z d  Z d   Z RS(   sð   Adjust image sharpness.

    This class can be used to adjust the sharpness of an image. An
    enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the
    original image, and a factor of 2.0 gives a sharpened image.
    c         C   sP   | |  _  | j t j  |  _ d | j   k rL |  j j | j d   n  d  S(   NR   (   R   t   filterR   t   SMOOTHR   R   R   R   (   R   R   (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   b   s    	(   R
   R   R   R   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyR   Z   s   N(
   t    R    R   R   t   objectR   R   R   R   R   (    (    (    s:   /usr/local/lib/python2.7/dist-packages/PIL/ImageEnhance.pyt   <module>   s
   