
    hL                         S r SSKJr  SSKJr  SSKJrJrJrJ	r	  SSK
Jr   " S S\	5      r " S S	\5      r " S
 S\5      r " S S\5      r\r\rg)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 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                   d   ^  \ rS rSrSrU 4S jrSS jrS rSS jrS r	S r
S	 rS
 rS rSrU =r$ )RendererTemplate'   z
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                 .   > [         TU ]  5         Xl        g N)super__init__dpi)selfr   	__class__s     V/var/www/html/env/lib/python3.13/site-packages/matplotlib/backends/backend_template.pyr   RendererTemplate.__init__0   s        c                     g r    )r   gcpath	transformrgbFaces        r   	draw_pathRendererTemplate.draw_path4       r   c                     g r   r   )r   r   xyims        r   
draw_imageRendererTemplate.draw_imageO   r   r   c	                     g r   r   )	r   r   r!   r"   spropangleismathmtexts	            r   	draw_textRendererTemplate.draw_textR   r   r   c                     g)NTr   r   s    r   flipyRendererTemplate.flipyU   s    r   c                     g)N)d   r3   r   r/   s    r   get_canvas_width_height(RendererTemplate.get_canvas_width_heightY   s    r   c                     g)N)   r7   r7   r   )r   r'   r(   r*   s       r   get_text_width_height_descent.RendererTemplate.get_text_width_height_descent]   s    r   c                     [        5       $ r   )GraphicsContextTemplater/   s    r   new_gcRendererTemplate.new_gc`   s    &((r   c                     U$ r   r   )r   pointss     r   points_to_pixels!RendererTemplate.points_to_pixelsd   s    r   )r   r   )FN)__name__
__module____qualname____firstlineno____doc__r   r   r$   r,   r0   r4   r8   r<   r@   __static_attributes____classcell__)r   s   @r   r   r   '   s:    6) r   r   c                       \ rS rSrSrSrg)r;   m   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 an 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.
r   NrB   rC   rD   rE   rF   rG   r   r   r   r;   r;   m   s    r   r;   c                       \ rS rSrSrSrg)FigureManagerTemplate   a  
Helper class for pyplot mode, wraps everything up into a neat bundle.

For non-interactive backends, the base class is sufficient.  For
interactive backends, see the documentation of the `.FigureManagerBase`
class for the list of methods that can/should be overridden.
r   NrK   r   r   r   rM   rM      s    r   rM   c                   R    \ rS rSrSr\rS r0 \R                  ESS0Er	S r
S rSrg	)
FigureCanvasTemplate   a  
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                 x    [        U R                  R                  5      nU R                  R                  U5        g)a  
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   figurer   draw)r   renderers     r   rT   FigureCanvasTemplate.draw   s(     $DKKOO4"r   foozMy magic Foo formatc                 $    U R                  5         g)aC  
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)rT   )r   filenamekwargss      r   	print_fooFigureCanvasTemplate.print_foo   s     			r   c                     g)NrW   r   r/   s    r   get_default_filetype)FigureCanvasTemplate.get_default_filetype   s    r   r   N)rB   rC   rD   rE   rF   rM   manager_classrT   r   	filetypesr[   r^   rG   r   r   r   rP   rP      s9    & *M
#" M#--Lu6KLI
r   rP   N)rF   
matplotlibr   matplotlib._pylab_helpersr   matplotlib.backend_basesr   r   r   r   matplotlib.figurer	   r   r;   rM   rP   FigureCanvasFigureManagerr   r   r   <module>rh      sb   >  )M M $?| ?L1 <- 6+ 6~ $%r   