bm_trim {bittermelon} | R Documentation |
bm_trim()
trims bm_bitmap()
objects reducing the number of pixels.
The directions and amount of removed pixels are settable
(defaulting to 0L
).
bm_trim(
bm_object,
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL,
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
bm_object |
Either a |
sides |
If not |
top |
How many pixels to trim the top. |
right |
How many pixels to trim the right. |
bottom |
How many pixels to trim the bottom. |
left |
How many pixels to trim the left. |
width |
How many pixels wide should the new bitmap be.
Use with the |
height |
How many pixels tall should the new bitmap be.
Use with the |
hjust |
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". Note if "left" we will trim on the right (and vice-versa). |
vjust |
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". Note if "top" we will trim on the bottom (and vice-versa). |
Either a bm_bitmap()
, bm_list()
, or bm_font()
object.
bm_extend()
, bm_pad()
, and bm_resize()
.
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_trimmed <- bm_trim(capital_r, c(1, 1, 3, 0))
print(capital_r_trimmed, px = c("-", "#"))