Skip to content
Prev 37446 / 63424 Next

Rserve graphics output [was Re: C or Java code generation]

On Fri, 2010-08-20 at 12:58 -0400, Sharpie wrote:
This was essentially the conclusion of Donald's earlier thread...
I believe Donald wants the _rendered_ output. That is, a stream of bytes
that represent a png, jpeg, etc. Toward this end, we have already
discussed using an OS-level fifo to avoid disk I/O, and I think this is
the easiest route for Donald. 

Alternatively, Donald might look into the X11 graphics driver, where
Cairo is used to write pngs. In particular, the in_do_saveplot function
(src/main/modules/X11/devX11.c) calls cairo_surface_write_to_png, in
order to save a png to file. Cairo also provides the
cairo_surface_write_to_png_stream function, which might be used to send
png data to a memory buffer (i.e. a raw vector). I don't think it would
be too difficult to modify in_do_saveplot to accommodate this.