bm_pad {bittermelon} | R Documentation |
Adjust bitmap padding lengths
Description
bm_pad()
adjusts bitmap padding lengths.
Usage
bm_pad(
x,
value,
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
## S3 method for class 'bm_bitmap'
bm_pad(
x,
value = 0L,
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
## S3 method for class 'bm_list'
bm_pad(x, ...)
## S3 method for class 'bm_pixmap'
bm_pad(
x,
value = col2hex("transparent"),
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
## S3 method for class ''magick-image''
bm_pad(
x,
value = "transparent",
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
## S3 method for class 'nativeRaster'
bm_pad(
x,
value = col2int("transparent"),
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
## S3 method for class 'raster'
bm_pad(
x,
value = "transparent",
type = c("exact", "extend", "trim"),
sides = NULL,
top = NULL,
right = NULL,
bottom = NULL,
left = NULL
)
Arguments
x |
Either a |
value |
Value for the new pixels. |
type |
Either "exact", '"extend", or "trim". "exact" makes sure the padding is exactly the indicated amount, "extend" does not trim any padding if existing padding is more than the indicated amount, and "trim" does not extend any padding if existing padding is less than the indicated amount. |
sides |
If not |
top |
Desired number of pixels of padding on the top. |
right |
Desired number of pixels of padding on the right. |
bottom |
Desired number of pixels of padding on the bottom. |
left |
Desired number of pixels of padding on the left. |
... |
Additional arguments to be passed to or from methods. |
Value
Depending on x
either a bm_bitmap()
, bm_font()
, bm_list()
, magick-image, "nativeRaster", bm_pixmap()
, or raster object.
See Also
bm_extend()
, bm_resize()
, and bm_trim()
Examples
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
capital_r <- font[[str2ucp("R")]]
print(capital_r)
capital_r_padded <- bm_pad(capital_r, sides = 2L)
print(capital_r_padded)
crops <- farming_crops_16x16()
corn <- crops$corn$portrait
corn_pad4 <- bm_pad(corn, sides = 4L)
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
print(corn_pad4, compress = "v", bg = "cyan")
}