Skip to content

@mbtech-nl/bitmap / getRow

Function: getRow()

ts
function getRow(bitmap: LabelBitmap, y: number): Uint8Array;

Defined in: encode.ts:19

Copy one packed row of a bitmap.

Returns a fresh Uint8Array of length bytesPerRow(bitmap.widthPx) — useful for writing a single row to a transport buffer. For zero-copy iteration over every row, use iterRows.

Parameters

ParameterTypeDescription
bitmapLabelBitmapSource bitmap.
ynumberRow index (0 ≤ y < bitmap.heightPx).

Returns

Uint8Array

Throws

If y is out of bounds.

Example

ts
const firstRow = getRow(bitmap, 0);

Released under the MIT License.