ó
 m[c           @` s0  d  d l  m Z m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l m Z d d l	 m
 Z d d l m Z d d l m Z m Z m Z m Z d e f d	 „  ƒ  YZ d
 e e f d „  ƒ  YZ e j d d d ƒd e f d „  ƒ  Yƒ Z d „  Z d „  Z d „  Z e j d e f d „  ƒ  Yƒ Z d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   cbooki   (   t	   wx_compat(   t   FigureCanvasAgg(   t
   _BackendWxt   _FigureCanvasWxBaset   FigureFrameWxt   NavigationToolbar2Wxt   FigureFrameWxAggc           B` s   e  Z d  „  Z RS(   c         C` s   t  |  d | ƒ S(   Niÿÿÿÿ(   t   FigureCanvasWxAgg(   t   selft   fig(    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyt
   get_canvas   s    (   t   __name__t
   __module__R   (    (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR      s   R   c           B` s/   e  Z d  Z d d „ Z d d „ Z e j Z RS(   ud  
    The FigureCanvas contains the figure and does event handling.

    In the wxPython backend, it is derived from wxPanel, and (usually)
    lives inside a frame instantiated by a FigureManagerWx. The parent
    window probably implements a wxSizer to control the displayed
    control size - but we give a hint as to our preferred minimum
    size.
    c         C` sH   t  j |  ƒ t |  j ƒ  d ƒ |  _ t |  _ |  j d | d d ƒ d S(   u.   
        Render the figure using agg.
        t   drawDCt   originu   WXAggN(	   R   t   drawt   _convert_agg_to_wx_bitmapt   get_renderert   Nonet   bitmapt   Truet   _isDrawnt   gui_repaint(   R   R   (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR   !   s    	c         C` s#  | d k r2 t |  j ƒ  d ƒ |  _ |  j ƒ  d S| j \ } } } } | | } | | } t | ƒ } t |  j j ƒ  | ƒ }	 t |  j ƒ  d ƒ }
 t j	 ƒ  } | j
 |
 ƒ t j	 ƒ  } | j
 |  j ƒ | j | |	 t | ƒ t | ƒ | | |	 ƒ | j
 t j ƒ | j
 t j ƒ |  j ƒ  d S(   u’   
        Transfer the region of the agg buffer defined by bbox to the display.
        If bbox is None, the entire buffer is transferred.
        N(   R   R   R   R   R   t   boundst   intt	   GetHeightt   wxt   MemoryDCt   SelectObjectt   Blitt
   NullBitmap(   R   t   bboxt   lt   bt   wt   ht   rt   tt   xt   yt   srcBmpt   srcDCt   destDC(    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyt   blit+   s$    


+N(   R   R   t   __doc__R   R   R0   R   t	   filetypes(    (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR      s   	
u   2.2t   alternativeu   NavigationToolbar2WxAggt   Toolbarc           B` s   e  Z RS(    (   R   R   (    (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR4   K   s   c         C` sa   | d k rG t j t |  j ƒ t |  j ƒ ƒ } | j |  j ƒ  ƒ | St j	 t
 |  | ƒ ƒ Sd S(   u¾   
    Convert the region of the agg buffer bounded by bbox to a wx.Image.  If
    bbox is None, the entire buffer is converted.

    Note: agg must be a backend_agg.RendererAgg instance.
    N(   R   t   wxct
   EmptyImageR   t   widtht   heightt   SetDatat   tostring_rgbR   t   ImageFromBitmapt   _WX28_clipped_agg_as_bitmap(   t   aggR$   t   image(    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyt   _convert_agg_to_wx_imageR   s
    $c         C` sH   | d k r7 t j t |  j ƒ t |  j ƒ |  j ƒ  ƒ St |  | ƒ Sd S(   u¿   
    Convert the region of the agg buffer bounded by bbox to a wx.Bitmap.  If
    bbox is None, the entire buffer is converted.

    Note: agg must be a backend_agg.RendererAgg instance.
    N(   R   R5   t   BitmapFromBufferR   R7   R8   t   buffer_rgbaR<   (   R=   R$   (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR   c   s    c         C` s  | j  \ } } } } | | } | | } t j t |  j ƒ t |  j ƒ |  j ƒ  ƒ } t j ƒ  }	 |	 j	 | ƒ t j
 t | ƒ t | ƒ ƒ }
 t j ƒ  } | j	 |
 ƒ t | ƒ } t t |  j ƒ | ƒ } | j d d t | ƒ t | ƒ |	 | | ƒ |	 j	 t j ƒ | j	 t j ƒ |
 S(   u‹   
    Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.

    Note: agg must be a backend_agg.RendererAgg instance.
    i    (   R   R5   R@   R   R7   R8   RA   R   R    R!   t   EmptyBitmapR"   R#   (   R=   R$   R%   R&   R7   R8   R)   R*   R-   R.   t   destBmpR/   R+   R,   (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyR<   s   s     

+t   _BackendWxAggc           B` s   e  Z e Z e Z RS(    (   R   R   R   t   FigureCanvasR   t   _frame_class(    (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyRD      s   (   t
   __future__R    R   R   R   t   sixR   t
   matplotlibR   t    R   R5   t   backend_aggR   t
   backend_wxR   R   R	   R
   t   NavigationToolbar2WxAggR   R   t
   deprecatedR4   R?   R   R<   t   exportRD   (    (    (    s@   lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.pyt   <module>   s    ""5				