as.array.bm_bitmap: Cast bitmap/pixmap objects to an array
Description
as.array.bm_bitmap() / as.array.bm_pixmap() casts bm_bitmap() / bm_pixmap() objects to an array of numeric values representing the RGBA channels.
These arrays can be used in functions such as png::writePNG().
Usage
# S3 method for bm_bitmap
as.array(
x,
...,
first_row_is_top = TRUE,
col = getOption("bittermelon.col", col_bitmap)
)
# S3 method for bm_pixmap
as.array(x, ..., first_row_is_top = TRUE)
Arguments
x
Either a bm_bitmap() or bm_pixmap() object.
...
Currently ignored.
first_row_is_top
If TRUE the first row of the matrix will represent the top of the bitmap
(like grDevices::as.raster() objects).
If FALSE the first row of the matrix will represent the bottom of the bitmap
(like bm_bitmap() and bm_pixmap() objects).
col
Character vector of R color specifications.
First color is used for values equal to 0, second color for values equal to 1, etc.