This function can be used to selectively rasterize components
of a 'grid' image.
Usage
grid.rasterize(x, ..., res = 72)
# S3 method for character
grid.rasterize(x, ..., res = 72)
# S3 method for gPath
grid.rasterize(x, merge=FALSE, redraw=TRUE, ..., res = 72)
# S3 method for function
grid.rasterize(x, ..., res = 72)
Arguments
x
What to rasterize. Can be a function (and the 'grid' output
for that function will be rasterized). Can be the name of a grob
(or a gPath) and that grob will be rasterized.
merge
Whether to replace multiple grobs with a single raster (or replace
each grob with its own raster).
redraw
Whether to redraw the scene after replacing the grob with a
raster.
…
For the character and gPath methods,
arguments passed on to grid.grep.
res
The raster resolution (dpi).
Value
NULL
Details
The rasterization occurs in the context of the current viewport.
A temporary PNG device is opened, the current viewport tree (below
the current viewport) is enforced on the temporary device and the specified
function or grob(s) are drawn on the temporary device.
The resulting raster is drawn within the current viewport.
For the character and gPath methods, the raster replaces the grob
that was rasterized.