as_bm_bitmap | R Documentation |
as_bm_bitmap()
turns an existing object into a bm_bitmap()
object.
as_bm_bitmap(x, ...) ## S3 method for class 'matrix' as_bm_bitmap(x, ...) ## Default S3 method: as_bm_bitmap(x, ...) ## S3 method for class 'character' as_bm_bitmap( x, ..., direction = "left-to-right, top-to-bottom", font = bm_font(), hjust = "left", vjust = "top", compose = TRUE, pua_combining = character(0) ) ## S3 method for class 'grob' as_bm_bitmap( x, ..., width = 8L, height = 16L, png_device = NULL, threshold = 0.25 )
x |
An object that can reasonably be coerced to a |
... |
Further arguments passed to or from other methods. |
direction |
For purely horizontal binding either "left-to-right" (default) or its aliases "ltr" and "lr"
OR "right-to-left" or its aliases "rtl" and "rl".
For purley vertical binding either "top-to-bottom" (default) or its aliases "ttb" and "tb"
OR "bottom-to-top" or its aliases "btt" and "bt".
For character vectors of length greater than one: for first horizontal binding within
values in the vector
and then vertical binding across values in the vector "left-to-right, top-to-bottom" (default)
or its aliases "lrtb" and "lr-tb"; "left-to-right, bottom-to-top" or its aliases "lrbt" and "lr-bt";
"right-to-left, top-to-bottom" or its aliases "rltb" and "rl-tb"; or
"right-to-left, bottom-to-top" or its aliases "rlbt" and "rl-bt".
For first vertical binding within values in the vector and then horizontal binding across values
"top-to-bottom, left-to-right" or its aliases "tblr" and "tb-lr";
"top-to-bottom, right-to-left" or its aliases "tbrl" and "tb-rl";
"bottom-to-top, left-to-right" or its aliases "btlr" and "bt-lr"; or
"bottom-to-top, right-to-left" or its aliases "btrl" and "bt-rl".
The |
font |
A |
hjust |
Used by |
vjust |
Used by |
compose |
Compose graphemes using |
pua_combining |
Passed to |
width |
Desired width of bitmap |
height |
Desired height of bitmap |
png_device |
A function taking arguments |
threshold |
If any png channel weakly exceeds this threshold (on an interval from zero to one) then the pixel is determined to be “black”. |
A bm_bitmap()
object.
bm_bitmap()
space_matrix <- matrix(0L, nrow = 16L, ncol = 16L) space_glyph <- as_bm_bitmap(space_matrix) is_bm_bitmap(space_glyph) font_file <- system.file("fonts/fixed/4x6.yaff.gz", package = "bittermelon") font <- read_yaff(font_file) bm <- as_bm_bitmap("RSTATS", font = font) print(bm, px = px_ascii) bm <- as_bm_bitmap("RSTATS", direction = "top-to-bottom", font = font) print(bm, px = px_ascii) if (require("grid") && capabilities("png")) { circle <- as_bm_bitmap(circleGrob(r = 0.25), width = 16L, height = 16L) print(circle, px = c(".", "@")) inverted_exclamation <- as_bm_bitmap(textGrob("!", rot = 180), width = 8L, height = 16L) print(inverted_exclamation, px = c(".", "@")) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.