File: //opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyo
�
`�3Lc @ s� d Z d d l m Z d d l Z d d l m Z d d l m Z m Z m Z m
Z
d d l m Z d d l
m Z d e f d � � YZ d
e f d � � YZ d � Z d
� Z d � Z d e
f d � � YZ d e f d � � YZ e Z d S( s�
This is a fully functional do nothing backend to provide a template to
backend writers. It is fully functional in that you can select it as
a backend with
import matplotlib
matplotlib.use('Template')
and your matplotlib scripts will (should!) run without error, though
no output is produced. This provides a nice starting point for
backend writers because you can selectively implement methods
(draw_rectangle, draw_lines, etc...) and slowly see your figure come
to life w/o having to have a full blown implementation before getting
any results.
Copy this to backend_xxx.py and replace all instances of 'template'
with 'xxx'. Then implement the class methods and functions below, and
add 'xxx' to the switchyard in matplotlib/backends/__init__.py and
'xxx' to the backends list in the validate_backend methon in
matplotlib/__init__.py and you're off. You can use your backend with::
import matplotlib
matplotlib.use('xxx')
from pylab import *
plot([1,2,3])
show()
matplotlib also supports external backends, so you can place you can
use any module in your PYTHONPATH with the syntax::
import matplotlib
matplotlib.use('module://my_backend')
where my_backend.py is your module name. Thus syntax is also
recognized in the rc file and in the -d argument in pylab, eg::
python simple_plot.py -dmodule://my_backend
The files that are most relevant to backend_writers are
matplotlib/backends/backend_your_backend.py
matplotlib/backend_bases.py
matplotlib/backends/__init__.py
matplotlib/__init__.py
matplotlib/_pylab_helpers.py
Naming Conventions
* classes Upper or MixedUpperCase
* varables lower or lowerUpper
* functions lower or underscore_separated
i����( t divisionN( t Gcf( t RendererBaset GraphicsContextBaset FigureManagerBaset FigureCanvasBase( t Figure( t Bboxt RendererTemplatec B se e Z d Z d � Z d
d � Z d � Z e d � Z d � Z d � Z
d � Z d � Z d � Z
RS( s�
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 classes methods.
c C s
| | _ d S( N( t dpi( t selfR ( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt __init__K s c C s d S( N( ( R
t gct patht transformt rgbFace( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt draw_pathN s c C s d S( N( ( R
R t xt yt im( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt
draw_imageh s c C s d S( N( ( R
R R R t st propt anglet ismath( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt draw_textk s c C s t S( N( t True( R
( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt flipyn s c C s d S( Nid ( id id ( ( R
( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt get_canvas_width_heightq s c C s d S( Ni ( i i i ( ( R
R R R ( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt get_text_width_height_descentt s c C s t � S( N( t GraphicsContextTemplate( R
( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt new_gcw s c C s | S( N( ( R
t points( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyt points_to_pixelsz s N( t __name__t
__module__t __doc__R t NoneR R t FalseR R R R R R! ( ( ( sW /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/backends/backend_template.pyR C s R c B s e Z d Z RS( s�
The graphics context provides the color, line styles, etc... See the gtk
and postscript backends for examples of mapping the graphics context
attributes (cap styles, join styles, line widths, colors) to a particular
backend. In GTK this is done by wrapping a gtk.gdk.GC 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 GTK 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, eg, (0.5, 0.0, 1.0). You may need to map this to colors
appropriate for your backend.
( R"