[Rd] Graphics device API

Paul Murrell p.murrell at auckland.ac.nz
Tue Feb 10 21:04:05 MET 2004


Hi


Simon Urbanek wrote:
> I just wrote a graphics device taking the X11 device in R-devel as a 
> guide (I was told it's the reference device). 


It's the closest we've currently got to documentation on graphics devices.


> It works perfectly with 
> R-devel, but I just noticed that the API (e.g. the use of R_GE_gcontext) 
> is incompatible with previous versions of R. Is the current API in 
> R-devel set in stone or are there any further plans to change the API? 


I'm still mucking about with it a bit.  The plan is to have something 
officially documented for 2.0.  I view the current status of the API as 
"unofficial";  it's there so that people can make external devices, but 
you should be aware that it will change -- I am trying to keep device 
maintainers up to date with the changes as they happen.  To be honest, I 
would not expect the 2.0 API to be "set in stone" either.  That API will 
be the result of restructuring and cleaning up the graphics code base, 
without trying to add any new features, but there are a number of 
aspects of the API that will require further resdesign.  A good example, 
is the ability to extend the device API with external code (at the 
moment the device API rigidly prescribes the operations that a device 
can perform).


> (If so, how far?) Also, is there any 'recommended' or 'official' way to 
> provide compatibility (beside using wrappers in various #ifdef's..)?


At the moment, a package can specify something like ...

Depends: R (>= 1.9.0)

... in the DESCRIPTION file.  This at least avoids the problem of using 
a "newer" device on an "older" version of R.  It does not solve the 
problem of further incompatible changes happening in 2.0 (i.e., using an 
"older" device on a "newer" R).

I intend to implement some useful suggestions from Thomas Baier to 
improve this situation.  The idea would be to include explicit version 
information as part of the device API so that external devices can check 
both with compiler directives and dynamically in the code for changes in 
the API.

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list