bm_extend() extends bm_bitmap() objects with extra pixels. The directions and the integer value of the extra pixels are settable (defaulting to 0L).

bm_extend(
bm_object,
value = 0L,
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL,
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)

## Arguments

bm_object Either a bm_bitmap(), bm_list(), or bm_font() object. Integer value for the new pixels. If not NULL then an integer vector indicating how many pixels to pad on all four sides. If the integer vector is of length one it indicates the number of pixels for all four sides. If of length two gives first the number for the vertical sides and then the horizontal sides. If of length three gives the number of pixels for top, the horizontal sides, and then bottom sides. If of length four gives the number of pixels for top, right, bottom, and then left sides. This is the same scheme as used by the CSS padding and margin properties. How many pixels to pad the top. How many pixels to pad the right. How many pixels to pad the bottom. How many pixels to pad the left. How many pixels wide should the new bitmap be. Use with the hjust argument or just one of either the left or right arguments. How many pixels tall should the new bitmap be. Use with the vjust argument or just one of either the top or bottom arguments. One of "left", "center-left", "center-right", "right". "center-left" and "center-right" will attempt to place in "center" if possible but if not possible will bias it one pixel left or right respectively. "centre", "center", and "centre-left" are aliases for "center-left". "centre-right" is an alias for "center-right". One of "bottom", "center-bottom", "center-top", "top". "center-bottom" and "center-top" will attempt to place in "center" if possible but if not possible will bias it one pixel down or up respectively. "centre", "center", and "centre-top" are aliases for "center-top". "centre-bottom" is an alias for "center-bottom".

## Value

Either a bm_bitmap(), bm_list(), or bm_font() object.

bm_expand(), bm_pad(), bm_resize(), and bm_trim().

## Examples

 font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
# add a border to an "R"
capital_r <- font[[str2ucp("R")]]
capital_r <- bm_extend(capital_r, value = 2L, sides = 1L)
capital_r <- bm_extend(capital_r, value = 3L, sides = 1L)
print(capital_r, px = c(" ", "#", ".", "@"))
#> @@@@@@@@@@@@
#> @..........@
#> @.        .@
#> @.        .@
#> @.######  .@
#> @.##   ## .@
#> @.##   ## .@
#> @.##   ## .@
#> @.######  .@
#> @.##   ## .@
#> @.##   ## .@
#> @.##   ## .@
#> @.##   ## .@
#> @.##   ## .@
#> @.        .@
#> @.        .@
#> @.        .@
#> @.        .@
#> @..........@
#> @@@@@@@@@@@@