[Rcpp-devel] c++ graphics device

Romain Francois romain at r-enthusiasts.com
Tue Mar 30 08:03:08 CEST 2010


Le 26/03/10 13:18, Dirk Eddelbuettel a écrit :
> (resending, this time to list as well, sorry --Dirk)
>
> On 26 March 2010 at 07:44, Romain Francois wrote:
> | Hello,
> |
> | R's graphics device drivers are currently written using poor man's c++:
> | you are supposed to create a pDevDesc struct (defined in
> | R_ext/GraphicsDevice.h) and then fill it with function pointers, e.g
> | (from the NULL device) :
> |
> |      /*
> |       * Device functions
> |       */
> |      dev->close = NULL_Close;
> |      dev->activate = NULL_Activate;
> |      dev->deactivate = NULL_Deactivate;
> |      dev->size = NULL_Size;
> |
> | I'd like (not now, but sometime) to encapsulate this into C++ so that
> | writing a device would more naturally be done by deriving some class
> | rather than the pseudo c++ done in C implementation.
> |
> | I believe this could help people implement other graphics devices using
> | c++ idioms.
>
> Are there such people?  ;-)

That'd be at least me. More later.

There are several custom graphics devices out there, so I suppose it is 
not too hard to do it in poor C++.

> | Should this go into Rcpp (I think I prefer this option) or should it be
> | some other package (RcppGD, or something).
>
> Not sure.  If we add it, we add a burden of more unit tests etc for something
> few users may use.  If we do not add it, we scatter packages further.  Can be
> argued either way.

My thinking is that it would not be lots of code, probably just a class 
or a template class and it would only be useful connected with an actual 
implementation (third party), so making this an extra package is 
painful, specially that the package would not be useful in its own, ...


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7
`- http://tr.im/O1wO : highlight 0.1-5



More information about the Rcpp-devel mailing list