grid.rasterize {rasterize} | R Documentation |
Rasterize grid output
Description
This function can be used to selectively rasterize components of a 'grid' image.
Usage
grid.rasterize(x, ..., res = 72)
## S3 method for class 'character'
grid.rasterize(x, ..., res = 72)
## S3 method for class 'gPath'
grid.rasterize(x, merge=FALSE, redraw=TRUE, ..., res = 72)
## S3 method for class '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 |
res |
The raster resolution (dpi). |
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.
Value
NULL
Author(s)
Paul Murrell
Examples
grid.newpage()
grid.rect(width=.8, height=.8)
grid.text("test", name="t")
grid.rasterize("t")