Skip to content

@mbtech-nl/bitmap / invertBitmap

Function: invertBitmap()

ts
function invertBitmap(bitmap: LabelBitmap): LabelBitmap;

Defined in: transform.ts:137

Swap black and white pixels.

Trailing bits in the last byte of each row stay zero (preserves the LabelBitmap invariant that unused bits are always 0).

Parameters

ParameterType
bitmapLabelBitmap

Returns

LabelBitmap

A new bitmap with every bit flipped, except trailing padding bits.

Example

ts
const negative = invertBitmap(positive);

Released under the MIT License.