³ò
ýM@c           @   s=  d  d k  Z  d  d k Z e  Z d  d k l Z d „  Z d „  Z d „  Z d d! d „  ƒ  YZ d d	 „ Z d
 „  Z	 d „  Z
 d „  Z h  d d <d d <d d <Z d „  Z d d" d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d a d d d d „ Z d „  Z d e f d „  ƒ  YZ d e f d  „  ƒ  YZ d S(#   iÿÿÿÿN(   t   tex2libplotc         C   s   | |  | | | j S(   N(    (   t   pt   dimt   boundaryt   side(    (    s   ../src/libplot/renderer.pyt	   sh_inside   s    c         C   sŽ   | } d } | | |  | j o" | |  | | | |  | } n d d g } | | | <|  | | | | |  | | | <| d | d f S(   Ng        i    i   (    (   t   sR   R   R   t   midt   gt   q(    (    s   ../src/libplot/renderer.pyt   sh_intersection    s    "
"c   
      C   s·   g  } |  d } t  | | | | ƒ } x‹ |  D]ƒ } t  | | | | ƒ } | o | p | o | }	 |	 o  | i t | | | | ƒ ƒ n | o | i | ƒ n | } | } q, W| S(   Niÿÿÿÿ(   R   t   appendR
   (
   t   polygonR   R   R   t   outR   t   s_insideR   t   p_insidet   crosses(    (    s   ../src/libplot/renderer.pyt   sutherland_hodgman*   s    
  
t   RendererStatec           B   s8   e  Z d  „  Z d „  Z d d „ Z d „  Z d „  Z RS(   c         C   s   h  |  _  g  |  _ d  S(   N(   t   currentt   saved(   t   self(    (    s   ../src/libplot/renderer.pyt   __init__@   s    	c         C   s   | |  i  | <d  S(   N(   R   (   R   t   namet   value(    (    s   ../src/libplot/renderer.pyt   setD   s    c         C   so   |  i  i | ƒ o |  i  | Sn xF t t |  i ƒ ƒ D]/ } |  i | } | i | ƒ o | | Sq8 q8 W| S(   N(   R   t   has_keyt   ranget   lenR   (   R   R   t   notfoundt   it   d(    (    s   ../src/libplot/renderer.pyt   getG   s     c         C   s#   |  i  i d |  i ƒ h  |  _ d  S(   Ni    (   R   t   insertR   (   R   (    (    s   ../src/libplot/renderer.pyt   saveP   s    c         C   s   |  i  i d ƒ |  _ d  S(   Ni    (   R   t   popR   (   R   (    (    s   ../src/libplot/renderer.pyt   restoreT   s    N(   t   __name__t
   __module__R   R   t   NoneR    R"   R$   (    (    (    s   ../src/libplot/renderer.pyR   >   s
   				i   c         C   sS   t  | ƒ d } | |  d ?d @} | |  d ?d @} | |  d ?d @} | | | f S(   Niÿ   i   i   i    (   t   float(   t
   hextriplett   scaleR   t   rR   t   b(    (    s   ../src/libplot/renderer.pyt	   _hexcolorW   s
    c         C   s\   t  | ƒ t  d ƒ j o t i |  | ƒ n, t | ƒ \ } } } t i |  | | | ƒ d  S(   Nt    (   t   typet   rawt   set_colorname_fgR-   t   set_color_fg(   t   plt   colorR+   R   R,   (    (    s   ../src/libplot/renderer.pyt
   _set_color^   s    c         C   s\   t  | ƒ t  d ƒ j o t i |  | ƒ n, t | ƒ \ } } } t i |  | | | ƒ d  S(   NR.   (   R/   R0   t   set_colorname_penR-   t   set_color_pen(   R3   R4   R+   R   R,   (    (    s   ../src/libplot/renderer.pyt   _set_pen_colore   s    c         C   s\   t  | ƒ t  d ƒ j o t i |  | ƒ n, t | ƒ \ } } } t i |  | | | ƒ d  S(   NR.   (   R/   R0   t   set_colorname_fillR-   t   set_color_fill(   R3   R4   R+   R   R,   (    (    s   ../src/libplot/renderer.pyt   _set_fill_colorl   s    t   dottedt   dott   shortdashedt   dasht   dashedc         C   s&   t  i | | ƒ } t i |  | ƒ d  S(   N(   t   _pl_line_typeR    R0   t   set_line_type(   R3   R/   t   pl_type(    (    s   ../src/libplot/renderer.pyt   _set_line_typey   s    t   LibplotRendererc           B   s  e  Z d  dt dt d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z h  e	 d <e
 d <e d	 <e d
 <e i d <e i d <e i d <e i d <e i d <e i d <Z d „  Z dt d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z  h  d d <d  d! <d" d# <d$ d% <d& d' <d( d) <d* d+ <d, d- <d. d/ <d0 d1 <d2 d3 <d4 d5 <d6 d7 <d8 d9 <d: d; <d< d= <d> d? <d@ dA <dB dC <dD dE <dF dG <dH dI <dJ dK <dL dM <dN dO <dP dQ <dR dS <dT dU <dV dW <dX dY <dZ d[ <d\ d] <Z! d^ „  Z" d_ „  Z# d` „  Z$ da „  Z% db „  Z& dc „  Z' dd „  Z( h  e) de ƒ df <e) dg ƒ dh <e) di ƒ dj <e) dk ƒ dl <e) dm ƒ dn <e) do ƒ dp <Z* dq „  Z+ dr „  Z, ds „  Z- RS(u   t   Xc         C   s.   | |  _  | |  _ t i | | | ƒ |  _ d  S(   N(   t	   lowerleftt
   upperrightR0   t   newR3   (   R   t   llt   urR/   t
   parameterst   file(    (    s   ../src/libplot/renderer.pyR      s    		c         C   sT   t  ƒ  |  _ t i |  i ƒ t t i |  i f |  i |  i ƒ t i	 |  i ƒ d  S(   N(
   R   t   stateR0   t
   begin_pageR3   t   applyt   spaceRG   RH   t   clear(   R   (    (    s   ../src/libplot/renderer.pyt   open„   s
    	c         C   s   t  i |  i ƒ d  S(   N(   R0   RR   R3   (   R   (    (    s   ../src/libplot/renderer.pyRR   ‹   s    c         C   s(   |  i  d  j	 o t i |  i  ƒ n d  S(   N(   R3   R'   R0   t   end_page(   R   (    (    s   ../src/libplot/renderer.pyt   closeŽ   s    c         C   s1   |  i  d  j	 o t i |  i  ƒ d  |  _  n d  S(   N(   R3   R'   R0   t   delete(   R   (    (    s   ../src/libplot/renderer.pyRV   ’   s    c         C   s   |  i  ƒ  d  S(   N(   RV   (   R   (    (    s   ../src/libplot/renderer.pyt   __del__—   s    R4   t	   linecolort	   fillcolort   linetypet	   linewidtht   filltypet   fillmodet   fontfacet   fontsizet	   textanglec         C   sQ   |  i  i | | ƒ t i i | ƒ o' t i | } t | |  i | f ƒ n d  S(   N(   RN   R   RE   t   _LibplotRenderer__pl_style_funcR   RP   R3   (   R   t   keyR   t   method(    (    s   ../src/libplot/renderer.pyR   ©   s    c         C   s   |  i  i | | ƒ S(   N(   RN   R    (   R   t	   parameterR   (    (    s   ../src/libplot/renderer.pyR    ¯   s    c         C   s!   |  i  i ƒ  t i |  i ƒ d  S(   N(   RN   R"   R0   t   gsaveR3   (   R   (    (    s   ../src/libplot/renderer.pyt
   save_state²   s    c         C   s!   |  i  i ƒ  t i |  i ƒ d  S(   N(   RN   R$   R0   t   grestoreR3   (   R   (    (    s   ../src/libplot/renderer.pyt   restore_state¶   s    c         C   s"   t  i |  i | d | d ƒ d  S(   Ni    i   (   R0   t   moveR3   (   R   R   (    (    s   ../src/libplot/renderer.pyRi   ¼   s    c         C   s"   t  i |  i | d | d ƒ d  S(   Ni    i   (   R0   t   linetoR3   (   R   R   (    (    s   ../src/libplot/renderer.pyRj   ¿   s    c         C   s"   t  i |  i | d | d ƒ d  S(   Ni    i   (   R0   t	   linetorelR3   (   R   R   (    (    s   ../src/libplot/renderer.pyRk   Â   s    c         C   s˜   |  i  d ƒ } | d  j o0 t i |  i | d | d | d | d ƒ nI t i |  i | d | d | d | d | d | d | d | d ƒ	 d  S(   Nt   cliprecti    i   i   i   (   R    R'   R0   t   lineR3   t   clipped_line(   R   R   R	   t   cr(    (    s   ../src/libplot/renderer.pyRm   Å   s    0c         C   s0   t  i |  i | d | d | d | d ƒ d  S(   Ni    i   (   R0   t   rectR3   (   R   R   R	   (    (    s   ../src/libplot/renderer.pyRp   Î   s    c         C   s%   t  i |  i | d | d | ƒ d  S(   Ni    i   (   R0   t   circleR3   (   R   R   R+   (    (    s   ../src/libplot/renderer.pyRq   Ñ   s    g        c         C   s+   t  i |  i | d | d | | | ƒ d  S(   Ni    i   (   R0   t   ellipseR3   (   R   R   t   rxt   ryt   angle(    (    s   ../src/libplot/renderer.pyRr   Ô   s    c      	   C   s>   t  i |  i | d | d | d | d | d | d ƒ d  S(   Ni    i   (   R0   t   arcR3   (   R   t   cR   R	   (    (    s   ../src/libplot/renderer.pyRv   ×   s    i    t   nonei   R=   i   t   plusi   t   asteriski   Rq   i   t   crossi   t   squarei   t   trianglei   t   diamondi	   t   stari
   s   inverted trianglei   t	   starbursti   s
   fancy plusi   s   fancy crossi   s   fancy squarei   s   fancy diamondi   s   filled circlei   s   filled squarei   s   filled trianglei   s   filled diamondi   s   filled inverted trianglei   s   filled fancy squarei   s   filled fancy diamondi   s   half filled circlei   s   half filled squarei   s   half filled trianglei   s   half filled diamondi   s   half filled inverted trianglei   s   half filled fancy squarei   s   half filled fancy diamondi   t   octagoni   s   filled octagonc         C   s"   |  i  | d g | d g ƒ d  S(   Ni    i   (   t   symbols(   R   R   (    (    s   ../src/libplot/renderer.pyt   symbolý   s    c   	      C   sç   d } d } |  i  i d | ƒ } |  i  i d | ƒ } t | ƒ d j o t | d ƒ } n t i i | ƒ } |  i d ƒ } | d  j o  t i |  i	 | | | | ƒ n9 t i
 |  i	 | | | | | d | d | d | d	 ƒ	 d  S(
   NR|   g{®Gáz„?t
   symboltypet
   symbolsizei   i    Rl   i   i   (   RN   R    R   t   ordRE   t    _LibplotRenderer__pl_symbol_typeR'   R0   R‚   R3   t   clipped_symbols(	   R   t   xt   yt   DEFAULT_SYMBOL_TYPEt   DEFAULT_SYMBOL_SIZEt   type_strt   sizeR/   Ro   (    (    s   ../src/libplot/renderer.pyR‚      s     c   
      C   sê   d } d } |  i  i d | ƒ } |  i  i d | ƒ } t | ƒ d j o t | d ƒ } n t i i | ƒ } |  i d ƒ }	 |	 d  j o  t i |  i	 | | | | ƒ n< t i
 |  i	 | | | | | |	 d |	 d |	 d |	 d	 ƒ
 d  S(
   NR|   g{®Gáz„?R„   R…   i   i    Rl   i   i   (   RN   R    R   R†   RE   R‡   R'   R0   t   colored_symbolsR3   t   clipped_colored_symbols(
   R   R‰   RŠ   Rw   R‹   RŒ   R   RŽ   R/   Ro   (    (    s   ../src/libplot/renderer.pyR     s     c         C   s;   | \ \ } } \ } } t  i |  i | | | | | ƒ d  S(   N(   R0   t   density_plotR3   (   R   t   densgridt   .2t   xmint   ymint   xmaxt   ymax(    (    s   ../src/libplot/renderer.pyR‘   #  s    c         C   s;   | \ \ } } \ } } t  i |  i | | | | | ƒ d  S(   N(   R0   t   color_density_plotR3   (   R   R’   R“   R”   R•   R–   R—   (    (    s   ../src/libplot/renderer.pyR˜   '  s    c      	   C   sl   |  i  d ƒ } | d  j o t i |  i | | ƒ n3 t i |  i | | | d | d | d | d ƒ d  S(   NRl   i    i   i   i   (   R    R'   R0   t   curveR3   t   clipped_curve(   R   R‰   RŠ   Ro   (    (    s   ../src/libplot/renderer.pyR™   ,  s
    c         C   sµ   | } |  i  d ƒ } | d  j	 oj t | d | d d 
ƒ } t | d | d d ƒ } t | d | d d 
ƒ } t | d | d d ƒ } n |  i | d ƒ t |  i | d ƒ d  S(   NRl   i    i   iÿÿÿÿi   i   (   R    R'   R   Ri   t   mapRj   (   R   t   pointst   ptsRo   (    (    s   ../src/libplot/renderer.pyR   4  s    Rw   t   centerR‰   t   baselinet   lt   leftR+   t   rightt   tt   topR,   t   bottomc         C   s•   t  | ƒ } |  i i d d ƒ } |  i i d d ƒ } t i i | ƒ } t i i | ƒ } t i |  i | d | d ƒ t i |  i | | | ƒ d  S(   Nt
   texthalignRž   t
   textvaligni    i   (	   R    RN   R    RE   t   _LibplotRenderer__pl_text_alignR0   Ri   R3   t   string(   R   R   t   strt   plstrt   hstrt   vstrt   hnumt   vnum(    (    s   ../src/libplot/renderer.pyt   textJ  s    c         C   s   t  | ƒ } t i |  i | ƒ S(   N(   R    R0   t   get_string_widthR3   (   R   Rª   R«   (    (    s   ../src/libplot/renderer.pyt	   textwidthS  s    c         C   s   |  i  i d ƒ S(   NR_   (   RN   R    (   R   Rª   (    (    s   ../src/libplot/renderer.pyt
   textheightW  s    N(.   R%   R&   R'   R   RS   RR   RU   RV   RW   R5   R8   R;   RD   R0   t   set_line_sizet   set_fill_levelt   set_fill_typet   set_font_typet   set_font_sizet   set_string_angleRa   R   R    Rf   Rh   Ri   Rj   Rk   Rm   Rp   Rq   Rr   Rv   R‡   Rƒ   R‚   R   R‘   R˜   R™   R   R†   R¨   R°   R²   R³   (    (    (    s   ../src/libplot/renderer.pyRE   }   sž   																																																													t   NonInteractiveScreenRendererc           B   s   e  Z d  „  Z RS(   c         C   sQ   d } | | f } h  d | | f d <d d <} t  i |  | | d | ƒ d  S(   Ni    s   %dx%dt
   BITMAPSIZEt   not   VANISH_ON_DELETERF   (   i    i    (   RE   R   (   R   t   widtht   heightRJ   RK   RL   (    (    s   ../src/libplot/renderer.pyR   \  s    (   R%   R&   R   (    (    (    s   ../src/libplot/renderer.pyRº   Z  s   t   InteractiveScreenRendererc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   sQ   d } | | f } h  d | | f d <d d <} t  i |  | | d | ƒ d  S(   Ni    s   %dx%dR»   t   yesR½   RF   (   i    i    (   RE   R   (   R   R¾   R¿   RJ   RK   RL   (    (    s   ../src/libplot/renderer.pyR   g  s    c         C   s   t  i |  i ƒ d  S(   N(   R0   t   flushR3   (   R   (    (    s   ../src/libplot/renderer.pyRU   p  s    c         C   s   t  i |  i ƒ d  S(   N(   R0   RÂ   R3   (   R   (    (    s   ../src/libplot/renderer.pyRV   s  s    (   R%   R&   R   RU   RV   (    (    (    s   ../src/libplot/renderer.pyRÀ   e  s   			i    i   c         C   sP   |  d j o2 t  d  j o t | | ƒ a  n t  i ƒ  t  Sn t | | ƒ Sd  S(   Ni   (   t   _saved_screen_rendererR'   RÀ   RR   Rº   (   t
   persistentR¾   R¿   (    (    s   ../src/libplot/renderer.pyt   ScreenRendererx  s    
c         C   sŠ   d d  k  } | i d ƒ i |  ƒ } t | i d ƒ ƒ } | i d ƒ } h  d d <d d <d d	 <d
 d <} t | | | ƒ } | S(   Niÿÿÿÿs   ([\d.]+)([^\s]+)i   i   iH   t   int   ptg®Gáz®@t   mmgš™™™™Y<@t   cm(   t   ret   compilet   matchR(   t   groupt   int(   Rª   RÊ   t   mt   num_xxt   unitst   xx2ptt   num_pt(    (    s   ../src/libplot/renderer.pyt   _str_size_to_pts„  s    *t
   PSRendererc           B   s   e  Z d  d  d  d „ Z RS(   R.   c      	   K   s“   d } t  | ƒ t  | ƒ f } d | | | f } x0 | i ƒ  D]" \ }	 }
 | d |	 d |
 } q> Wh  | d <} t i |  | | d | | ƒ d  S(   Ni    s   %s,xsize=%s,ysize=%st   ,t   =t   PAGESIZEt   ps(   i    i    (   RÔ   t   itemsRE   R   (   R   RM   t   paperR¾   R¿   t   kwRJ   RK   t   pagesizeRb   t   valRL   (    (    s   ../src/libplot/renderer.pyR     s     (   R%   R&   R   (    (    (    s   ../src/libplot/renderer.pyRÕ   Ž  s   t   ImageRendererc           B   s   e  Z d  „  Z RS(   c         C   sK   d } | | f } h  d | | f d <} t  i |  | | | | | ƒ d  S(   Ni    s   %dx%dR»   (   i    i    (   RE   R   (   R   R/   R¾   R¿   RM   RJ   RK   RL   (    (    s   ../src/libplot/renderer.pyR   ›  s    (   R%   R&   R   (    (    (    s   ../src/libplot/renderer.pyRß   ™  s   (    (    (   t   libplott   mathR0   R    R   R
   R   R   R-   R5   R8   R;   RA   RD   RE   Rº   RÀ   R'   RÃ   RÅ   RÔ   RÕ   Rß   (    (    (    s   ../src/libplot/renderer.pys   <module>   s.   		
							Ý	
