Ops.bm_bitmap | R Documentation |
The S3 Ops group generic methods for bm_bitmap()
objects
are simply the result of the generic integer matrix method
cast back to a binary bm_bitmap()
object (which
is an integer matrix of ones and zeros).
The S3 Ops group generic methods for bm_list()
and bm_font()
objects simply returns another object
with that operator applied to every bitmap in the original object.
Since base::which()
does not automatically cast
its argument to a logical value we also redefine it as a generic
and besides a default method which simply calls base:which()
we
offer a which.bm_bitmap()
method that first
casts the bitmap to logical before calling base::which()
.
## S3 method for class 'bm_bitmap' Ops(e1, e2) ## S3 method for class 'bm_list' Ops(e1, e2) which(x, arr.ind = FALSE, useNames = TRUE) ## Default S3 method: which(x, arr.ind = FALSE, useNames = TRUE) ## S3 method for class 'bm_bitmap' which(x, arr.ind = FALSE, useNames = TRUE)
e1, e2 |
objects. |
x |
a |
arr.ind |
logical; should array indices be returned
when |
useNames |
logical indicating if the value of |
which.bm_bitmap()
returns a logical vector.
The various Ops.bm_bitmap
methods return a bm_bitmap()
object.
The various Ops.bm_list
methods return a bm_list()
object.
base::Ops
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon") font <- read_hex(font_file) # Examples applied to individual bitmaps capital_r <- font[[str2ucp("R")]] print(!capital_r, px = px_ascii) capital_b <- font[[str2ucp("B")]] print(capital_r & capital_b, px = px_ascii) print(capital_r | capital_b, px = px_ascii) print(capital_r + 1L, px = px_ascii) print(capital_r + 1L > 1L, px = px_ascii) which(capital_r > 0L) # Examples applied to `bm_list()` objects bml <- font[c("U+0023", "U+0052", "U+0053", "U+0054", "U+0041", "U+0054", "U+0053")] # #RSTATS bml <- as_bm_list(bml) bm <- do.call(cbind, bml) print(bm, px = px_ascii) bml <- !bml bm <- do.call(cbind, bml) print(bm, px = px_ascii) bml <- 2 * (bml + 1L) bm <- do.call(cbind, bml) print(bm, px = px_ascii)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.