crops <- farming_crops_16x16()
corn <- crops$corn$portrait
is_bm_pixmap(corn)
all.equal(corn, as_bm_pixmap(as.array(corn)))
all.equal(corn, as_bm_pixmap(as.raster(corn)))
if (requireNamespace("farver", quietly = TRUE)) {
all.equal(corn, as_bm_pixmap(as.raster(corn, native = TRUE)))
}
if (requireNamespace("magick", quietly = TRUE)) {
all.equal(corn, as_bm_pixmap(magick::image_read(corn)))
}
if (requireNamespace("mazing", quietly = TRUE) &&
cli::is_utf8_output() &&
cli::num_ansi_colors() >= 8L) {
pal <- grDevices::palette.colors()
pm <- as_bm_pixmap(mazing::maze(24L, 32L),
start = "top", end = "bottom",
col = c(pal[6], "white", pal[7], pal[5]))
pm <- bm_pad(pm, sides = 1L)
print(pm, compress = "v", bg = "white")
}
if (requireNamespace("gridpattern", quietly = TRUE) &&
cli::is_utf8_output() &&
cli::num_ansi_colors() >= 256L) {
s <- gridpattern::pattern_square(subtype = 8L, nrow = 8L, ncol = 50L)
pm <- as_bm_pixmap(s, col = grDevices::rainbow(8L))
print(pm, compress = "vertical")
}
Run the code above in your browser using DataLab