Capture a raster image

Share:

Description

Capture the current contents of a graphics device as a raster (bitmap) image.

Usage

1

Details

This function is only implemented for on-screen graphics devices.

Value

A matrix of R colour names, or NULL if not available.

Author(s)

Paul Murrell

See Also

grid.raster

dev.capabilities to see if it is supported.

Examples

1
2
3
4
5
6
7
8
dev.new(width=0.5, height=0.5)
grid.rect()
grid.text("hi")
cap <- grid.cap()
dev.off()

if(!is.null(cap))
    grid.raster(cap, width=0.5, height=0.5, interpolate=FALSE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.