bm_shift: Shift elements within bitmaps

View source: R/bm_shift.R

bm_shiftR Documentation

Shift elements within bitmaps

Description

Shifts non-padding elements within bitmaps by trimming on a specified side and padding on the other while preserving the width and height of the original bitmap.

Usage

bm_shift(
  bm_object,
  value = 0L,
  top = NULL,
  right = NULL,
  bottom = NULL,
  left = NULL
)

Arguments

bm_object

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

value

Integer value for the new pixels.

top

Number of pixels to shift towards the top side.

right

Number of pixels to shift towards the right side.

bottom

Number of pixels to shift towards the bottom side.

left

Number of pixels to shift towards the left side.

Details

This function is a convenience wrapper around bm_trim() and bm_extend().

Value

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

See Also

bm_trim() and bm_extend()

Examples

 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, px = c("-", "#"))
 capital_r <- bm_shift(capital_r, bottom = 2L, right = 1L)
 print(capital_r, px = c("-", "#"))

bittermelon documentation built on Feb. 16, 2023, 8:08 p.m.