Skip to contents

bm_orientations() returns the orientations of the bitmaps. A bitmap is "landscape" if it is wider than it is tall, "portrait" if it is taller than it is wide, and (by default) "square" if it is as wide as it is tall. Use the square argument to instead classify square bitmaps as "portrait" (the CSS media query convention) or "landscape". bm_orientations() is an S3 generic function.

Usage

bm_orientations(x, square = c("square", "portrait", "landscape"), ...)

# Default S3 method
bm_orientations(x, square = c("square", "portrait", "landscape"), ...)

# S3 method for class 'bm_list'
bm_orientations(
  x,
  square = c("square", "portrait", "landscape"),
  unique = TRUE,
  ...
)

Arguments

x

Either a bm_bitmap(), bm_font(), bm_list(), "magick-image", "nativeRaster", bm_pixmap(), or "raster" object.

square

The orientation to return for square bitmaps. Either "square" (default), "portrait", or "landscape".

...

Ignored.

unique

Apply base::unique() to the returned character vector.

Value

A character vector of the orientation of each of the bitmap objects in x. Each element is either "landscape", "portrait", or "square". If unique is TRUE then any duplicates will have been removed.

See also

Examples

font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz",
  package = "bittermelon"
)
font <- read_hex(font_file)
bm_orientations(font) # every glyph is 8 pixels wide and 16 pixels high
#> [1] "portrait"
bm_orientations(bm_rotate(font, 90))
#> [1] "landscape"
corn <- farming_crops_16x16()$corn$portrait
bm_orientations(corn) # 16 pixels wide and 16 pixels high
#> [1] "square"
bm_orientations(corn, square = "portrait") # CSS media query convention
#> [1] "portrait"
bm_orientations(corn, square = "landscape")
#> [1] "landscape"