Choosing a Graphics Package
The PlotPlot class itself does not include any code for actually drawing on a
graphics device. Instead, it requires a set of functions to be provided
which it uses to draw the required graphics. These include functions
to draw a straight line, draw a text string, etc. You may choose
to provide functions from your favorite graphics package, or you can even
write your own! To accomodate variations in the calling interfaces of
different graphics packages, AST defines a standard interface for these
routines. If this interface differs from the interface provided by your
graphics package (which in general it will), then you must write a set of
wrapper functions, which provide the interface expected by AST but
which then call functions from your graphics package to provide the
required functionality. AST comes with wrapper functions suitable for
the PGPLOT graphics package (see SUN/15sun15).
There are two ways of indicating which wrapper functions are to be used by
the Plot class:
- A file containing C functions with pre-defined names can be written
and linked with the application using options of the ast_linkast_link command.
(see ยง3.3 and Appendix E). AST is
distributed with such a file (called grf_pgplot.c) which calls PGPLOT
functions to implement the required functionality. This file can be used
as a template for writing your own.
- The
astGrfSetastGrfSet
method of the Plot class can be used to “register”
wrapper functions at run-time. This allows an application to switch
between graphics systems if required. Graphics functions registered in
this way do not need to have the pre-defined names used in the link-time
method described above.
For details of the interfaces of the wrapper routines, see
either the grf_pgplot.c file included in the AST source
distribution, or the reference documentation for the astGrfSet method.