I am looking for the source of the save
function in the pop up menu in a ggraphics()
. Can anyone help me?
The save code is in the svalue<- method. For gWidgetsRGtk2 it is available on r-forge. The github site would have gWidgets2RGtk2 code, but there is no such function there. The following is my guess as to what you are looking for, but it is a hack so use with caution. (I'm pretty sure the window can't have any other window covering it.)
da <- getWidget(obj)
wh <- daGetWidthHeight(da)
da.w <- wh[1]
da.h <- wh[2]
pixbuf <- gdkPixbufGetFromDrawable(src=da$window, src.x=0, src.y=0,
dest.x=0, dest.y=0, width=da.w, height=da.h)
out <- try(pixbuf$Save(filename = filename,type=extension), silent=TRUE)