bm_invert() inverts (negates) a bitmap.
Usage
bm_invert(x)
# S3 method for class 'bm_bitmap'
bm_invert(x)
# S3 method for class 'bm_list'
bm_invert(x)
# S3 method for class 'bm_pixmap'
bm_invert(x)
# S3 method for class '`magick-image`'
bm_invert(x)
# S3 method for class 'nativeRaster'
bm_invert(x)
# S3 method for class 'raster'
bm_invert(x)Arguments
- x
Either a
bm_bitmap(),bm_font(),bm_list(), "magick-image", "nativeRaster",bm_pixmap(), or "raster" object.
Value
Depending on x either a bm_bitmap(), bm_font(), bm_list(), magick-image, "nativeRaster", bm_pixmap(), or raster object.
Examples
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
capital_r <- as_bm_bitmap("R", font = font)
capital_r_inverted <- bm_invert(capital_r)
print(capital_r_inverted)
#> ████████
#> ████████
#> ░░░░░░██
#> ░░███░░█
#> ░░███░░█
#> ░░███░░█
#> ░░░░░░██
#> ░░███░░█
#> ░░███░░█
#> ░░███░░█
#> ░░███░░█
#> ░░███░░█
#> ████████
#> ████████
#> ████████
#> ████████
corn <- farming_crops_16x16()$corn$portrait
corn_inverted <- bm_invert(corn)
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
print(corn_inverted, compress = "v", bg = "black")
}
#>
#> ▄▀▀▄▄▀█
#> █▀▀▀▀█▀▀▄
#> ▄▀▀▀█▀█▀▀▀▄
#> ▄▀▀▀█▀▀▀▀████
#> ▀▀▀ ▀▀▀▀▀▀▀██
#> ▀▀▀▀▀▀
#>