a
    s=icT                      @   s   d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 ddl
mZ G dd de	ZG dd	 d	eZd
dddZG dd deZG dd deZeZeZd
S )a  
A fully functional, do-nothing backend intended as a template for backend
writers.  It is fully functional in that you can select it as a backend e.g.
with ::

    import matplotlib
    matplotlib.use("template")

and your program will (should!) run without error, though no output is
produced.  This provides a starting point for backend writers; you can
selectively implement drawing methods (`~.RendererTemplate.draw_path`,
`~.RendererTemplate.draw_image`, etc.) and slowly see your figure come to life
instead having to have a full blown implementation before getting any results.

Copy this file to a directory outside of the Matplotlib source tree, somewhere
where Python can import it (by adding the directory to your ``sys.path`` or by
packaging it as a normal Python package); if the backend is importable as
``import my.backend`` you can then select it using ::

    import matplotlib
    matplotlib.use("module://my.backend")

If your backend implements support for saving figures (i.e. has a `print_xyz`
method), you can register it as the default handler for a given file type::

    from matplotlib.backend_bases import register_backend
    register_backend('xyz', 'my_backend', 'XYZ File Format')
    ...
    plt.savefig("figure.xyz")
    )_api)Gcf)FigureCanvasBaseFigureManagerBaseGraphicsContextBaseRendererBase)Figurec                       sd   e Zd ZdZ fddZdddZdd Zdd
dZdd Zdd Z	dd Z
dd Zdd Z  ZS )RendererTemplatez
    The renderer handles drawing/rendering operations.

    This is a minimal do-nothing class that can be used to get started when
    writing a new backend.  Refer to `.backend_bases.RendererBase` for
    documentation of the methods.
    c                    s   t    || _d S N)super__init__dpi)selfr   	__class__ u/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/matplotlib/backends/backend_template.pyr   0   s    
zRendererTemplate.__init__Nc                 C   s   d S r
   r   )r   gcpathZ	transformZrgbFacer   r   r   	draw_path4   s    zRendererTemplate.draw_pathc                 C   s   d S r
   r   )r   r   xyZimr   r   r   
draw_imageO   s    zRendererTemplate.draw_imageFc	           	      C   s   d S r
   r   )	r   r   r   r   spropZangleismathZmtextr   r   r   	draw_textR   s    zRendererTemplate.draw_textc                 C   s   dS )NTr   r   r   r   r   flipyU   s    zRendererTemplate.flipyc                 C   s   dS )N)d   r   r   r   r   r   r   get_canvas_width_heightY   s    z(RendererTemplate.get_canvas_width_heightc                 C   s   dS )N)   r!   r!   r   )r   r   r   r   r   r   r   get_text_width_height_descent]   s    z.RendererTemplate.get_text_width_height_descentc                 C   s   t  S r
   )GraphicsContextTemplater   r   r   r   new_gc`   s    zRendererTemplate.new_gcc                 C   s   |S r
   r   )r   Zpointsr   r   r   points_to_pixelsd   s    z!RendererTemplate.points_to_pixels)N)FN)__name__
__module____qualname____doc__r   r   r   r   r   r    r"   r$   r%   __classcell__r   r   r   r   r	   '   s   

r	   c                   @   s   e Zd ZdZdS )r#   a  
    The graphics context provides the color, line styles, etc.  See the cairo
    and postscript backends for examples of mapping the graphics context
    attributes (cap styles, join styles, line widths, colors) to a particular
    backend.  In cairo this is done by wrapping a cairo.Context object and
    forwarding the appropriate calls to it using a dictionary mapping styles
    to gdk constants.  In Postscript, all the work is done by the renderer,
    mapping line styles to postscript calls.

    If it's more appropriate to do the mapping at the renderer level (as in
    the postscript backend), you don't need to override any of the GC methods.
    If it's more appropriate to wrap an instance (as in the cairo backend) and
    do the mapping here, you'll need to override several of the setter
    methods.

    The base GraphicsContext stores colors as a RGB tuple on the unit
    interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors
    appropriate for your backend.
    Nr&   r'   r(   r)   r   r   r   r   r#   m   s   r#   N)blockc                 C   s   t  D ]}qdS )z
    For image backends - is not required.
    For GUI backends - show() is usually the last line of a pyplot script and
    tells the backend that it is time to draw.  In interactive mode, this
    should do nothing.
    N)r   Zget_all_fig_managers)r,   managerr   r   r   show   s    r.   c                   @   s   e Zd ZdZdS )FigureManagerTemplatez
    Helper class for pyplot mode, wraps everything up into a neat bundle.

    For non-interactive backends, the base class is sufficient.
    Nr+   r   r   r   r   r/      s   r/   c                   @   sJ   e Zd ZdZeZdd Zi ejddiZe	
dddd	 Zd
d ZdS )FigureCanvasTemplatea1  
    The canvas the figure renders into.  Calls the draw and print fig
    methods, creates the renderers, etc.

    Note: GUI templates will want to connect events for button presses,
    mouse movements and key presses to functions that call the base
    class methods button_press_event, button_release_event,
    motion_notify_event, key_press_event, and key_release_event.  See the
    implementations of the interactive backends for examples.

    Attributes
    ----------
    figure : `matplotlib.figure.Figure`
        A high-level Figure instance
    c                 C   s   t | jj}| j| dS )aE  
        Draw the figure using the renderer.

        It is important that this method actually walk the artist tree
        even if not output is produced because this will trigger
        deferred work (like computing limits auto-limits and tick
        values) that users may want access to before saving to disk.
        N)r	   Zfigurer   draw)r   rendererr   r   r   r1      s    	zFigureCanvasTemplate.drawfoozMy magic Foo formatz3.5argsc                 O   s   |    dS )a{  
        Write out format foo.

        This method is normally called via `.Figure.savefig` and
        `.FigureCanvasBase.print_figure`, which take care of setting the figure
        facecolor, edgecolor, and dpi to the desired output values, and will
        restore them to the original values.  Therefore, `print_foo` does not
        need to handle these settings.
        N)r1   )r   filenamer4   kwargsr   r   r   	print_foo   s    zFigureCanvasTemplate.print_fooc                 C   s   dS )Nr3   r   r   r   r   r   get_default_filetype   s    z)FigureCanvasTemplate.get_default_filetypeN)r&   r'   r(   r)   r/   Zmanager_classr1   r   	filetypesr   Zdelete_parameterr7   r8   r   r   r   r   r0      s   

r0   )r)   Z
matplotlibr   Zmatplotlib._pylab_helpersr   Zmatplotlib.backend_basesr   r   r   r   Zmatplotlib.figurer   r	   r#   r.   r/   r0   ZFigureCanvasZFigureManagerr   r   r   r   <module>   s   F@