bm_overlay {bittermelon} | R Documentation |
bm_overlay()
merges bitmaps by overlaying a bitmap over another.
bm_overlay(
bm_object,
over = NULL,
under = NULL,
hjust = "center-left",
vjust = "center-top"
)
bm_object |
Either a |
over |
A 'bm_bitmap()' object to overlay
over the |
under |
A 'bm_bitmap()' object which will be overlaid
by 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". |
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". |
If necessary bitmaps will be extended by bm_extend()
such that
they are the same size. Then the non-zero pixels of the “over”
bitmap will be inserted into the “under” bitmap.
Either a bm_bitmap()
, bm_list()
, or bm_font()
object.
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
grave <- font[[str2ucp("`")]]
a <- font[[str2ucp("a")]]
a_grave <- bm_overlay(a, over = grave)
print(a_grave, px = px_ascii)
# Can also instead specify the under glyph as a named argument
a_grave2 <- bm_overlay(grave, under = a)
print(a_grave2, px = px_ascii)