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(bm_object, value = 0L)

Arguments

bm_object

Either a bm_bitmap(), bm_list(), or bm_font() object.

value

The value of the “padding” integer to compute lengths for.

Value

If bm_object 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 bm_object 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, px = c(".", "@"))
 print(bm_padding_lengths(capital_r))

[Package bittermelon version 1.1.2 Index]