bm_padding_lengths {bittermelon} | R Documentation |
Compute bitmap padding lengths
Description
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.
Usage
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")
Arguments
x |
Either a |
value |
The value of the “padding” element to compute lengths for. |
... |
Additional arguments to be passed to or from methods. |
Value
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.
Examples
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))
[Package bittermelon version 2.0.2 Index]