bm_rotate: Rotate bitmaps 0, 90, 180, or 270 degrees

Description Usage Arguments Value See Also Examples

View source: R/bm_rotate.R

Description

bm_rotate() losslessly rotates bitmaps by 0, 90, 180, or 270 degrees. If 90 or 270 degrees are indicated the width and height of the bitmap will be flipped.

Usage

1
bm_rotate(bm_object, angle = 0, clockwise = TRUE)

Arguments

bm_object

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

angle

Angle to rotate bitmap by.

clockwise

If TRUE rotate bitmaps clockwise. Note Unicode's convention is to rotate glyphs clockwise i.e. the top of the "BLACK CHESS PAWN ROTATED NINETY DEGREES" glyph points right.

Value

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

See Also

bm_distort() can do other (distorted) rotations by careful use of its vp grid::viewport() argument. bm_flip() with direction "both" and in_place TRUE can rotate glyphs 180 degrees in place.

Examples

1
2
3
4
5
6
7
8
  # as_bm_list.character()
  font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
  font <- read_hex(font_file)
  capital_r <- font[[str2ucp("R")]]
  print(bm_rotate(capital_r, 90), px = px_ascii)
  print(bm_rotate(capital_r, 180), px = px_ascii)
  print(bm_rotate(capital_r, 270), px = px_ascii)
  print(bm_rotate(capital_r, 90, clockwise = FALSE), px = px_ascii)

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