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 'array'
as_bm_bitmap(
x,
...,
mode = c("alpha", "darkness", "brightness"),
threshold = 0.5
)
## Default S3 method:
as_bm_bitmap(x, ...)
## S3 method for class 'bm_bitmap'
as_bm_bitmap(x, ...)
## S3 method for class 'bm_pixmap'
as_bm_bitmap(
x,
...,
mode = c("alpha", "darkness", "brightness"),
threshold = 0.5
)
## 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 'glyph_bitmap'
as_bm_bitmap(x, ..., threshold = 0.5)
## S3 method for class 'grob'
as_bm_bitmap(
x,
...,
width = 8L,
height = 16L,
png_device = NULL,
threshold = 0.25
)
## S3 method for class ''lofi-matrix''
as_bm_bitmap(x, ...)
## S3 method for class ''magick-image''
as_bm_bitmap(
x,
...,
mode = c("alpha", "darkness", "brightness"),
threshold = 0.5
)
## S3 method for class 'matrix'
as_bm_bitmap(x, ...)
## S3 method for class 'maze'
as_bm_bitmap(
x,
...,
walls = FALSE,
start = NULL,
end = NULL,
solve = !is.null(start) && !is.null(end)
)
## S3 method for class 'nativeRaster'
as_bm_bitmap(
x,
...,
mode = c("alpha", "darkness", "brightness"),
threshold = 0.5
)
## S3 method for class 'pattern_square'
as_bm_bitmap(x, ...)
## S3 method for class 'pattern_weave'
as_bm_bitmap(x, ...)
## S3 method for class 'pattern_square'
as_bm_bitmap(x, ...)
## S3 method for class 'pixeltrix'
as_bm_bitmap(x, ...)
## S3 method for class 'pixmapGrey'
as_bm_bitmap(x, ..., mode = c("darkness", "brightness"), threshold = 0.5)
## S3 method for class 'pixmapIndexed'
as_bm_bitmap(x, ...)
## S3 method for class 'pixmapRGB'
as_bm_bitmap(x, ..., mode = c("darkness", "brightness"), threshold = 0.5)
## S3 method for class 'raster'
as_bm_bitmap(
x,
...,
mode = c("alpha", "darkness", "brightness"),
threshold = 0.5
)
x |
An object that can reasonably be coerced to a |
... |
Further arguments passed to or from other methods. |
mode |
Method to determine the integer values of the
|
threshold |
If the alpha/darkness/brightness value weakly exceeds this threshold (on an interval from zero to one) then the pixel is determined to be “black”. |
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 |
walls |
If |
start , end |
If not |
solve |
If |
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)
bm <- as_bm_bitmap("RSTATS", direction = "top-to-bottom", font = font)
print(bm)
if (require("grid") && capabilities("png")) {
circle <- as_bm_bitmap(circleGrob(r = 0.25), width = 16L, height = 16L)
print(circle)
}
if (require("grid") && capabilities("png")) {
inverted_exclamation <- as_bm_bitmap(textGrob("!", rot = 180),
width = 8L, height = 16L)
print(inverted_exclamation)
}
if (requireNamespace("mazing", quietly = TRUE)) {
m <- mazing::maze(16, 32)
bm <- as_bm_bitmap(m, walls = TRUE)
print(bm, compress = "vertical")
}
if (requireNamespace("gridpattern", quietly = TRUE)) {
w <- gridpattern::pattern_weave("twill_herringbone", nrow=14L, ncol = 40L)
bm <- as_bm_bitmap(w)
print(bm, compress = "vertical")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.