ó
±éRc           @  s¤  d  Z  d d l m Z d d l m Z d d l m Z d d l j 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 d l j Z d e
 f d „  ƒ  YZ d e f d „  ƒ  YZ e d k r e ƒ  e d d g d d g g ƒ e d d* d+ d e d d d d  d! d ƒ d" d# d$ d% ƒZ e j e d& d d' d( ƒ g ƒ e j j e d& d) d' d( ƒ e ƒ  g ƒ n  d S(,   s¡   
Defines classes for path effects. The path effects are supported in
:class:`~matplotlib.text.Text` and :class:`~matplotlib.patches.Patch`
matplotlib.text.Text.
iÿÿÿÿ(   t   print_function(   t   RendererBase(   t   MixedModeRendererNt   _Basec           B  sk   e  Z d  Z d „  Z d „  Z d „  Z d d „ Z d „  Z d d „ Z	 e
 d „ Z d	 „  Z d d
 „ Z RS(   sN   
    A base class for PathEffect. Derived must override draw_path method.
    c         C  s   t  t |  ƒ j ƒ  d S(   s    
        initializtion.
        N(   t   superR   t   __init__(   t   self(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR      s    c         C  s   t  |  | ƒ S(   N(   t   ProxyRenderer(   R   t   renderer(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt   get_proxy_renderer   s    c         C  s¡   | j  ƒ  } | j d d  ƒ } | r4 | j | �  n  xf | j ƒ  D]X \ } } t | d | d  ƒ } | d  k s| t | ƒ r� t d | ƒ ‚ n  | | ƒ qA W| S(   Nt   dashest   set_s   Unknown property %s(   t   copyt   popt   Nonet
   set_dashest	   iteritemst   getattrt   callablet   AttributeError(   R   t   gct   new_gc_dictR
   t   kt   vt
   set_method(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt
   _update_gc   s    c         C  s   | j  | | | | ƒ d S(   sn  
        Derived should override this method. The argument is same
        as *draw_path* method of :class:`matplotlib.backend_bases.RendererBase`
        except the first argument is a renderer. The base definition is ::

          def draw_path(self, renderer, gc, tpath, affine, rgbFace):
                  renderer.draw_path(gc, tpath, affine, rgbFace)

        N(   t	   draw_path(   R   R   R   t   tpatht   affinet   rgbFace(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   +   s    
c         C  sñ   t  | t ƒ r | j } n  g  } x6 | j | | | ƒ D] \ } } | j | | f ƒ q7 Wx� | j | | | | | | | |	 |
 | | | | ƒ D][ \ } } } } } | \ } } t j | j ƒ  ƒ j	 | | ƒ } |  j
 | | | | | ƒ qŽ Wd S(   s‡  
        Draws a collection of paths selecting drawing properties from
        the lists *facecolors*, *edgecolors*, *linewidths*,
        *linestyles* and *antialiaseds*. *offsets* is a list of
        offsets to apply to each of the paths.  The offsets in
        *offsets* are first transformed by *offsetTrans* before being
        applied.  *offset_position* may be either "screen" or "data"
        depending on the space that the offsets are in.

        This provides a fallback implementation of
        :meth:`draw_path_collection` that makes multiple calls to
        :meth:`draw_path`.  Some backends may want to override this in
        order to render each set of path data only once, and then
        reference that path multiple times with the different offsets,
        colors, styles etc.  The generator methods
        :meth:`_iter_collection_raw_paths` and
        :meth:`_iter_collection` are provided to help with (and
        standardize) the implementation across backends.  It is highly
        recommended to use those generators, so that changes to the
        behavior of :meth:`draw_path_collection` can be made globally.
        N(   t
   isinstanceR   t	   _renderert   _iter_collection_raw_pathst   appendt   _iter_collectiont
   transformst   Affine2Dt
   get_matrixt	   translateR   (   R   R   R   t   master_transformt   pathst   all_transformst   offsetst   offsetTranst
   facecolorst
   edgecolorst
   linewidthst
   linestylest   antialiasedst   urlst   offset_positiont   path_idst   patht	   transformt   xot   yot   path_idt   gc0R   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt   draw_path_collection7   s    		"!s   TeX!c	   	   
   C  s)   |  j  | | | | | | | d d ƒd  S(   Nt   ismatht   TeX(   t   _draw_text_as_path(	   R   R   R   t   xt   yt   st   propt   angleR;   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt   draw_texb   s    c	   	   	   C  s&   |  j  | | | | | | | | ƒ d  S(   N(   R=   (	   R   R   R   R>   R?   R@   RA   RB   R;   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt	   draw_texte   s    c	         C  s   t  | t ƒ r | j } n  t j | | | | | | | ƒ \ }	 }
 | j ƒ  d  } | j d ƒ |  j | | |	 |
 d | ƒd  S(   Ni   g        R   (   R   R   R   R   t   _get_text_path_transformt   get_rgbt   set_linewidthR   (   R   R   R   R>   R?   R@   RA   RB   R;   R4   R5   t   color(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR=   h   s    		c      	   C  sx   xq | j  | d t ƒD]Z \ } }	 t | ƒ r | d \ }
 } |  j | | | | t j ƒ  j |
 | ƒ | ƒ q q Wd S(   sÎ  
        Draws a marker at each of the vertices in path.  This includes
        all vertices, including control points on curves.  To avoid
        that behavior, those vertices should be removed before calling
        this function.

        *gc*
            the :class:`GraphicsContextBase` instance

        *marker_trans*
            is an affine transform applied to the marker.

        *trans*
             is an affine transform applied to the path.

        This provides a fallback implementation of draw_markers that
        makes multiple calls to :meth:`draw_path`.  Some backends may
        want to override this method in order to draw the marker only
        once and reuse it multiple times.
        t   simplifyiþÿÿÿN(   t   iter_segmentst   Falset   lenR   R#   R$   R&   (   R   R   R   t   marker_patht   marker_transR4   t   transR   t   verticest   codesR>   R?   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt   draw_markersv   s    "N(   t   __name__t
   __module__t   __doc__R   R	   R   R   R   R:   RC   RK   RD   R=   RR   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR      s   				+	R   c           B  sJ   e  Z d  „  Z d d „ Z d d „ Z e d „ Z d d „ Z d „  Z	 RS(   c         C  s   | |  _  | |  _ d  S(   N(   t   _path_effectR   (   R   t   path_effectR   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   ”   s    	c         C  s#   |  j  j |  j | | | | ƒ d  S(   N(   RV   R   R   (   R   R   R   R   R   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   ˜   s    s   TeX!c      
   C  s/   |  j  j |  j | | | | | | d d ƒd  S(   NR;   R<   (   RV   R=   R   (   R   R   R>   R?   R@   RA   RB   R;   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRC   ›   s    c      	   C  s,   |  j  j |  j | | | | | | | ƒ d  S(   N(   RV   t
   _draw_textR   (   R   R   R>   R?   R@   RA   RB   R;   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRD   Ÿ   s    c      	   C  s,   |  j  j |  j | | | | | d | ƒd  S(   NR   (   RV   RR   R   (   R   R   RM   RN   R4   RO   R   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRR   £   s    c         C  sD   |  j  } | j |  j | | | | | | | | |	 |
 | | | ƒ d  S(   N(   RV   R:   R   (   R   R   R'   R(   R)   R*   R+   R,   R-   R.   R/   R0   R1   R2   t   pe(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR:   ¨   s    	N(
   RS   RT   R   R   R   RC   RK   RD   RR   R:   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   “   s   	t   Normalc           B  s   e  Z d  Z RS(   s$   
    path effect with no effect
    (   RS   RT   RU   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRZ   ´   s   t   Strokec           B  s    e  Z d  Z d „  Z d „  Z RS(   s*   
    stroke the path with updated gc.
    c         K  s    t  t |  ƒ j ƒ  | |  _ d S(   s±   
        The path will be stroked with its gc updated with the given
        keyword arguments, i.e., the keyword arguments should be valid
        gc parameter values.
        N(   R   R[   R   t   _gc(   R   t   kwargs(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   ¿   s    c         C  sR   | j  ƒ  } | j | ƒ |  j | |  j ƒ } | j | | | | ƒ | j ƒ  d S(   s/   
        draw the path with update gc.
        N(   t   new_gct   copy_propertiesR   R\   R   t   restore(   R   R   R   R   R   R   R9   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   È   s
    (   RS   RT   RU   R   R   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR[   º   s   		t
   withStrokec           B  s   e  Z d  Z d „  Z RS(   sK   
    Same as Stroke, but add a stroke with the original gc at the end.
    c         C  s6   t  j |  | | | | | ƒ | j | | | | ƒ d  S(   N(   R[   R   (   R   R   R   R   R   R   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   Ü   s    (   RS   RT   RU   R   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRa   Ö   s   t   SimplePatchShadowc           B  s)   e  Z d  Z d d d d „ Z d „  Z RS(   s   
    simple shadow
    i   iþÿÿÿgffffffæ?c         K  sJ   t  t |  ƒ j ƒ  | |  _ | |  _ | |  _ | |  _ t j ƒ  |  _	 d S(   s	   
        N(
   R   R   R   t
   _offset_xyt   _shadow_rgbFacet   _patch_alphaR\   t   mtransformsR$   t   _offset_tran(   R   t	   offset_xyt   shadow_rgbFacet   patch_alphaR]   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   é   s    				c         C  s,  | j  |  j d ƒ } | j  |  j d ƒ } | |  j j ƒ  j | | ƒ } | j ƒ  }	 |	 j | ƒ |  j d k r¼ | d  \ }
 } } d } | |
 }
 | | } | | } |
 | | f } n	 |  j } |	 j	 d ƒ |	 j
 d |  j ƒ |	 j d ƒ |  j |	 |  j ƒ }	 | j |	 | | | ƒ |	 j ƒ  d S(   s	   
        i    i   i   g333333Ó?t   noneg      ð?N(   t   points_to_pixelsRc   Rg   t   clearR&   R^   R_   Rd   R   t   set_foregroundt	   set_alphaRe   RG   R   R\   R   R`   (   R   R   R   R   R   R   t   offset_xt   offset_yt   affine0R9   t   rt   gt   bt   rhoRi   (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR   ö   s&    


	(   i   iþÿÿÿN(   RS   RT   RU   R   R   R   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRb   ä   s   t   withSimplePatchShadowc           B  s   e  Z d  Z d „  Z RS(   s   
    simple shadow
    c         C  ss   t  j |  | | | | | ƒ | j ƒ  } | j | ƒ | j | j ƒ  |  j ƒ | j | | | | ƒ | j ƒ  d  S(   N(   Rb   R   R^   R_   Ro   t	   get_alphaRe   R`   (   R   R   R   R   R   R   t   gc1(    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyR     s    (   RS   RT   RU   R   (    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyRw     s   t   __main__i   i   i   t   testg      ð?g        i    t
   arrowpropst
   arrowstyles   ->t   connectionstylet   angle3t   lwt   sizei   t   hat   centert	   linewidtht
   foregroundt   wi   (   g      ð?g      ð?(   g        i    (   RU   t
   __future__R    t   matplotlib.backend_basesR   t!   matplotlib.backends.backend_mixedR   t   matplotlib.transformsR#   t   objectR   R   RZ   R[   Ra   Rf   Rb   Rw   RS   t   clft   imshowt   annotatet   dictt   txtt   set_path_effectst   arrow_patch(    (    (    sP   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/patheffects.pyt   <module>   s*   †!3