bm_pixmap {bittermelon} | R Documentation |
Bittermelon pixmap matrix object
Description
bm_pixmap()
creates an S3 matrix subclass representing a pixmap.
Usage
bm_pixmap(x)
Arguments
x |
Object to be converted to |
Details
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.
Value
A character matrix of color strings with a “bm_pixmap” subclass.
Supported S3 methods
See Also
as_bm_pixmap()
, is_bm_pixmap()
Examples
# Bottom left pixel is **first** row and first column
pm <- bm_pixmap(matrix(c("red", "blue", "green", "black"),
nrow = 2L, byrow = TRUE))
plot(pm)