Skip to content

@mbtech-nl/bitmap / stackBitmaps

Function: stackBitmaps()

ts
function stackBitmaps(bitmaps: readonly LabelBitmap[], direction: "horizontal" | "vertical"): LabelBitmap;

Defined in: transform.ts:245

Concatenate bitmaps horizontally or vertically.

Horizontal stacking requires every input to share the same heightPx; vertical stacking requires every input to share the same widthPx.

Parameters

ParameterTypeDescription
bitmapsreadonly LabelBitmap[]At least one bitmap to stack.
direction"horizontal" | "vertical"'horizontal' (left-to-right) or 'vertical' (top-to-bottom).

Returns

LabelBitmap

A new bitmap containing the stacked input.

Throws

If the input is empty or dimensions don't align.

Example

ts
const labelTop = stackBitmaps([logo, title], 'horizontal');
const fullLabel = stackBitmaps([labelTop, body], 'vertical');

Released under the MIT License.