bm_pixmap | R Documentation |
bm_pixmap()
creates an S3 matrix subclass representing a pixmap.
bm_pixmap(x)
x |
Object to be converted to |
Intended to represent raster graphic pixmaps especially (but not limited to) pixel art/sprites.
Pixmaps are represented as color string matrices with special class methods.
The bottom left pixel is represented by the first row and first column.
The bottom right pixel is represented by the first row and last column.
The top left pixel is represented by the last row and first column.
The top right pixel is represented by the last row and last column.
Colors are converted to the "#RRGGBBAA"
color string format.
Fully transparent values like "transparent"
, NA
, "#00000000"
are
all standardized to "#FFFFFF00"
.
See bm_bitmap()
for an alternative S3 object backed by a integer matrix.
A character matrix of color strings with a “bm_pixmap” subclass.
[.bm_bitmap
and [<-.bm_bitmap
as.matrix.bm_pixmap()
as.raster.bm_bitmap()
and plot.bm_bitmap()
format.bm_pixmap()
and print.bm_pixmap()
as_bm_pixmap()
, is_bm_pixmap()
# Bottom left pixel is **first** row and first column
pm <- bm_pixmap(matrix(c("red", "blue", "green", "black"),
nrow = 2L, byrow = TRUE))
plot(pm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.