[cairo] RFC: duplicating, storing and serializing drawing operations

Peter Weilbacher (Mozilla) mozilla at Weilbacher.org
Tue Dec 26 01:21:34 PST 2006

Nicolas George wrote:

> But a picture is easier to read than a list of numbers, so it would be
> useful tu be able to write "lineto(x, y)" instead of printf. Unfortunately,
> there is no room for XNextEvent in such a program, and adding it would
> require a lot of work; often, much more work than writing the calculation
> itself. Instead, I often end up piping PostScript commands to gs, which
> lacks comfort.
> To do the link with what I was writing earlier, I can give an example
> implementation of the hypothetical library:
> static FILE *plotter;
> void init_graphics(void)
> {
>     plotter = popen("/usr/libexec/plotter_helper", "w");
> }
> void lineto(double x, double y)
> {
>     fprintf(plotter, "lineto %f %f\n", x, y);
>     fflush(plotter);
> }

I cannot comment on how to do this with cairo or if it would be a good idea
to add capabilities like this into it.
But can you not just use a plotting program? I know that many people are doing
things like this using gnuplot (http://gnuplot.sf.net/) as a "library". With
that you can issue plot commands and also data via popen(), although the data
to plot is usually easier read from ASCII files.


More information about the cairo mailing list