bm_flip: Flip (reflect) bitmaps

Description Usage Arguments Value Examples

View source: R/bm_flip.R

Description

bm_flip() flips (reflects) bitmaps horizontally, vertically, or both. It can flip the entire bitmap or just the glyph in place.

Usage

1
bm_flip(bm_object, direction = "vertical", in_place = FALSE)

Arguments

bm_object

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

direction

Either "vertical" or "v", "horizontal" or "h", OR "both" or "b".

in_place

If TRUE flip the glyphs in place (without changing any white space padding).

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
  font <- read_hex(font_file)

  # Print upside down
  bml <- as_bm_list("RSTATS", font = font)
  bml <- bm_flip(bml, "both")
  bm <- bm_call(bml, cbind, direction = "RTL")
  print(bm, px = px_ascii)

  # Can also modify glyphs "in place"
  exclamation <- font[[str2ucp("!")]]
  exclamation_flipped <- bm_flip(exclamation, in_place = TRUE)
  print(exclamation_flipped, px = px_ascii)

bittermelon documentation built on Nov. 2, 2021, 1:06 a.m.