#include <plot.h> void*
plot_open(const char *tty, FILE *fp);
intplot_close(void *v);
intplot_arc(void *v, int x, int y, int x0, int y0, int x1, int y1);
intplot_circle(void *v, int x, int y, int r);
intplot_cont(void *v, int x, int y);
intplot_dot(void *v, int x, int y, int dx, int n, const int *pat);
intplot_erase(void *v);
intplot_label(void *v, const char *s);
intplot_line(void *v, int x, int y, int x1, int y1);
intplot_linemod(void *v, int mod);
intplot_move(void *v, int x, int y);
intplot_point(void *v, int x, int y);
intplot_space(void *v, int x0, int y0, int x1, int y1);
DESCRIPTION
plot
provides a portable high level interface to plotters and other
drawing devices (such as
PostScript
file format).
ROUTINES
plot_open(const char *tty, FILE *fp);
Allocate and initialise plotting context (that is returned as
an opaque
void*)
for plotter type given in
tty
argument and using output file given in the
fp
argument.
Either of arguments can be NULL in which case default will be assumed
that is
PLOTCAP
or
TERM
environment variable contents for plotter specification and
stdout
for the output stream.
If the initialisation sequence is specified it will be put out.
plot_close(void *v);
Put out the finilasing sequence should one be specified for the given
plotter type and free the plotting context.
For the dumb mode the resulting image is output at this time as well.
The output file pointer is left open.
plot_arc(void *v, int x, int y, int x0, int y0, int x1, int y1);
Draw an arc with centre in
[x,
y]
and endpoints specified in
[x0,
y0]
and
[x1,
y1]].
plot_circle(void *v, int x, int y, int r);
Draw a circle with centre in
[x,
y]
and of radius
r.
plot_cont(void *v, int x, int y);
Draw a straight line form current position to
[x,
y]
and change the current position to there as well.
plot_dot(void *v, int x, int y, int dx, int n, const int *pat);
Draw a dot at
[x,
y]
of size
n
and using pattern
pat.
Current position is changed accordignly.
plot_erase(void *v);
Erase whole shit and reset current position to the plotter's default.
plot_label(void *v, const char *s);
Print a label from string
s
using whatever plotter's default font is.
plot_line(void *v, int x, int y, int x1, int y1);
Draw a straight line between points
[x,
y]
and
[x1,
y1]
using current selected line mode (set with
plot_linemod)).
Current position is set to
[x1,
y1]].
plot_linemod(void *v, int mod);
Set line drawing mode to
mod
specified.
Currently only values 0 through 8 are supported.
The value of 0 resets the mode to the plotter's default.
plot_move(void *v, int x, int y);
Change current position to
[x,
y]].
plot_point(void *v, int x, int y);
Pitch a point at
[x,
y]
and change current position accordingly.
plot_space(void *v, int x0, int y0, int x1, int y1);
Set the system of coordinates and change the drawing size if supported or
otherwise scale to the closest matching supported size.
Values are allowed to be negative.
RETURN VALUES
plot_open
returns NULL upon error.
All the other functions return 0 on success and -1 on error.
ENVIRONMENT
PLOTCAP
environment variable is checked upon first to contain plotter (see
plotcap(5))
specification.
TERM
environment variable is used to determine the plotter type to use (see
plotcap(5))
to fetch description for from the
plotcap
database.
FILES
/usr/share/misc/plotcap
Plotters descriptions.
EXAMPLES
ERRORS
[EINVAL]
Invalid arguments specified.
[ENOMEM]
No memory to allocate.
[EOPNOTSUPP]
No operation is found in the
plotcap
database and cannot emulate.
The
plot
library first appeared in
Version 6 AT&T UNIX.
This implementaion however is different and first appeared in
ÆrieBSD 1.0.
AUTHORS
The
plot
library was written by
Michael Shalayeff mickey@lucifier.net.
CAVEATS
Library functions take the best effort to draw the primitives requested
including descending to simpler or otherwise rasing to more complex
primitives should there be no definition for direct implementation such as:
drawing a circle using arcs or lines or points;
drawing a line using arcs or moves of points;
drawing a point using a line or a circle or a dot.
It is made sure however that endless recursion does not happen.