View source: R/bm_padding_lengths.R
bm_padding_lengths | R Documentation |
bm_padding_lengths()
computes the padding lengths of a
target value for the top, right, bottom, and left sides of the bitmap.
If the entire bitmap is of the target value then the left/right and top/bottom
will simply split the width/height in half.
bm_padding_lengths(x, value)
## S3 method for class 'bm_bitmap'
bm_padding_lengths(x, value = 0L)
## S3 method for class 'bm_list'
bm_padding_lengths(x, ...)
## S3 method for class 'bm_pixmap'
bm_padding_lengths(x, value = col2hex("transparent"))
## S3 method for class ''magick-image''
bm_padding_lengths(x, value = "transparent")
## S3 method for class 'nativeRaster'
bm_padding_lengths(x, value = col2int("transparent"))
## S3 method for class 'raster'
bm_padding_lengths(x, value = "transparent")
x |
Either a |
value |
The value of the “padding” element to compute lengths for. |
... |
Additional arguments to be passed to or from methods. |
If x
is a bm_bitmap()
object then a integer vector of length four
representing the padding lengths for the top, right, bottom, and left sides respectively.
If x
is a bm_list()
or bm_font()
then a list of integer vectors of length four.
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
# add a border to an "R"
capital_r <- font[[str2ucp("R")]]
print(capital_r)
print(bm_padding_lengths(capital_r))
corn <- farming_crops_16x16()$corn$portrait
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
print(corn, bg = "cyan", compress = "v")
}
print(bm_padding_lengths(corn))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.