Ńň
t,2Jc           @   s:   d  d k  l Z d  d k l Z d e f d     YZ d S(   i˙˙˙˙(   t
   frombuffer(   t   RendererAggt   MixedModeRendererc           B   sA   e  Z d  Z d d  Z d i   Z d   Z d   Z d   Z	 RS(   s&  
    A helper class to implement a renderer that switches between
    vector and raster drawing.  An example may be a PDF writer, where
    most things are drawn with PDF vector commands, but some very
    complex objects, such as quad meshes, are rasterised and then
    output as images.
    c         C   s|   | d j o
 t } n | |  _ | |  _ | |  _ | |  _ | i   p t  | |  _ d |  _	 d |  _
 |  i |  d S(   sÜ  
        width: The width of the canvas in logical units

        height: The height of the canvas in logical units

        dpi: The dpi of the canvas

        vector_renderer: An instance of a subclass of RendererBase
        that will be used for the vector drawing.

        raster_renderer_class: The renderer class to use for the
        raster drawing.  If not provided, this will use the Agg
        backend (which is currently the only viable option anyway.)
        i    N(   t   NoneR   t   _raster_renderer_classt   _widtht   _heightt   dpit   option_image_nocompositet   AssertionErrort   _vector_renderert   _raster_renderert   _rasterizingt   _set_current_renderer(   t   selft   widtht   heightR   t   vector_renderert   raster_renderer_class(    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyt   __init__   s    
							sI  
        close_group draw_image draw_markers draw_path
        draw_path_collection draw_quad_mesh draw_tex draw_text
        finalize flipy get_canvas_width_height get_image_magnification
        get_texmanager get_text_width_height_descent new_gc open_group
        option_image_nocomposite points_to_pixels strip_math
        c         C   sf   | |  _  x> |  i D]3 } t | |  o t |  | t | |   q q W|  i | _ |  i | _ d  S(   N(   t	   _renderert   _methodst   hasattrt   setattrt   getattrt   start_rasterizingt   stop_rasterizing(   R   t   renderert   method(    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyR   2   s    	
 !c         C   sf   |  i  d j oC |  i |  i |  i |  i |  i |  i  |  _ |  i |  i  n |  i  d 7_  d S(   s  
        Enter "raster" mode.  All subsequent drawing commands (until
        stop_rasterizing is called) will be drawn with the raster
        backend.

        If start_rasterizing is called multiple times before
        stop_rasterizing is called, this method has no effect.
        i    i   N(   R   R   R   R   R   R   R   (   R   (    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyR   ;   s
    	)c   
      C   sř   |  i  d 8_  |  i  d j oŐ |  i |  i  |  i |  i |  i |  i } } |  i i   \ } } | \ } } } } | d j oZ | d j oM t | | | t	  }	 t
 |	 _ |	 i   |  i i | | | | |	 d  n d |  _ t
 |  _  n d S(   s9  
        Exit "raster" mode.  All of the drawing that was done since
        the last start_rasterizing command will be copied to the
        vector backend by calling draw_image.

        If stop_rasterizing is called multiple times before
        start_rasterizing is called, this method has no effect.
        i   i    N(   R   R   R
   R   R   R   R   t   tostring_rgba_minimizedR    t   Truet   Falset   is_grayscalet
   flipud_outR   t
   draw_imageR   (
   R   R   R   t   buffert   boundst   lt   bt   wt   ht   image(    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyR   J   s    	!	
%	N(
   t   __name__t
   __module__t   __doc__R   R   t   splitR   R   R   R   (    (    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyR      s   %			N(   t   matplotlib._imageR    t   matplotlib.backends.backend_aggR   t   objectR   (    (    (    sQ   C:\graphics\Tools\Python26\Lib\site-packages\matplotlib\backends\backend_mixed.pyt   <module>   s   