[GRASS5] Grabbing contents of a monitor?
glynn.clements at virgin.net
Wed Oct 15 16:21:34 EDT 2003
Jan-Oliver Wagner wrote:
> I wonder how the contents of a monitor (ie the bitmap) could be
> grabbed or clipped?
> I am thinking about source code level, thus some C-commands
> to get the current bitmap.
One option is to use R_panel_save(), which saves a specified rectangle
of the monitor to a named file.
However, the format of the data is unspecified (the only guarantee is
that R_panel_restore() accepts the files which R_panel_save()
creates). For the XDRIVER, the format is essentially the raw XImage
data obtained using XGetImage(), so it will depend upon the format of
the X server's framebuffer.
OTOH, any solution for XDRIVER (e.g. using xwd etc) will have the same
issues, as the only data which is actually stored is in the
A more robust solution would be to use the PNG driver and read the
resulting PNG file (except that it could actually be a GIF file for
certain versions of GD, e.g. that supplied with RedHat 6.2). Or use
the CELL driver and read the resulting map.
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev