Bill Allombert on Wed, 18 Jan 2017 17:28:04 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PATCH] Implement SVG plotting


On Tue, Jan 17, 2017 at 10:42:24AM +0100, Jeroen Demeyer wrote:
> On 2017-01-14 17:56, Bill Allombert wrote:
> >How do you envision SVG to be used under GP ?
> >
> >How libpari program will be able to use graphics ?
> 
> 1. Graphics in general:
> 
> First of all, my latest version of my patches (see the jeroen-svg branch)
> adds a new option to pari_init() called INIT_GRAPHm. This option should be
> used whenever graphics are needed.
> 
> Second, some variant of PARI_get_plot_FOO() needs to be called to select the
> plotting backend. For example, PARI_get_plot_X() for X11 or
> PARI_get_plot_svg() for SVG. It is legal to change the plotting backend at
> runtime by calling a different PARI_get_plot_BAR() function.

There is an unwanted side effect: if you start gp with DISPLAY unset, it
complains at start up instead of waiting for you actually to call ploth.

It would be better to have a function
set_pari_plot_engine(PARI_plot *)
that allows a libpari program to provide its own plot engine.

The #define ENABLE_PLOT_xxx are not needed. 
Since only one is linked anyway, all engine should define the same symbol 
PARI_get_plot and gp would do 
set_pari_plot_engine(&PARI_get_plot).

Cheers,
Bill.

PS: When you define a function that take no parameters, please do not
forget to add void, e.g. 
void set_pari_plot_engine(void);
and not
void set_pari_plot_engine();