Learn R Programming

bittermelon (version 2.2.1)

bm_expand: Expand bitmaps by repeating each row and/or column

Description

bm_expand() expands bitmap(s) by repeating each row and/or column an indicated number of times.

Usage

bm_expand(x, width = 1L, height = width)

# S3 method for bm_bitmap bm_expand(x, width = 1L, height = width)

# S3 method for bm_list bm_expand(x, ...)

# S3 method for bm_pixmap bm_expand(x, width = 1L, height = width)

# S3 method for `magick-image` bm_expand(x, width = 1L, height = width)

# S3 method for nativeRaster bm_expand(x, width = 1L, height = width)

# S3 method for raster bm_expand(x, width = 1L, height = width)

Value

Depending on x either a bm_bitmap(), bm_font(), bm_list(), magick-image, "nativeRaster", bm_pixmap(), or raster object.

Arguments

x

Either a bm_bitmap(), bm_font(), bm_list(), "magick-image", "nativeRaster", bm_pixmap(), or "raster" object.

width

An integer of how many times to repeat each column.

height

An integer of how many times to repeat each row.

...

Additional arguments to be passed to or from methods.

See Also

bm_extend() (and bm_resize() which makes larger bitmaps by adding pixels to their sides.

Examples

Run this code
 font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
 font <- read_hex(font_file)
 capital_r <- font[[str2ucp("R")]]
 print(capital_r)
 print(bm_expand(capital_r, 2L),
       px = px_ascii)
 print(bm_expand(capital_r, width = 1L, height = 2L),
       px = px_ascii)
 print(bm_expand(capital_r, width = 2L, height = 1L),
       px = px_ascii)
crops <- farming_crops_16x16()
corn <- crops$corn$portrait
corn_2x <- bm_expand(corn, 2L)
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
  print(corn_2x, compress = "v")
}

Run the code above in your browser using DataLab