powered by
bm_pixmap() creates an S3 matrix subclass representing a pixmap.
bm_pixmap()
bm_pixmap(x)
A character matrix of color strings with a “bm_pixmap” subclass.
Object to be converted to bm_pixmap(). If not already a color string matrix it will be cast to one by as_bm_pixmap().
as_bm_pixmap()
[.bm_bitmap and [<-.bm_bitmap
[.bm_bitmap
[<-.bm_bitmap
as.matrix.bm_pixmap()
as.raster.bm_bitmap() and plot.bm_bitmap()
as.raster.bm_bitmap()
plot.bm_bitmap()
format.bm_pixmap() and print.bm_pixmap()
format.bm_pixmap()
print.bm_pixmap()
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.
"#RRGGBBAA"
Fully transparent values like "transparent", NA, "#00000000" are all standardized to "#FFFFFF00".
"transparent"
NA
"#00000000"
"#FFFFFF00"
See bm_bitmap() for an alternative S3 object backed by a integer matrix.
bm_bitmap()
as_bm_pixmap(), is_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)
Run the code above in your browser using DataLab