# BilevelBitmap

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / BilevelBitmap

# Class: BilevelBitmap

Represents a bi-level transparency mask or an image containing two colors: black and white
in either a white-is-zero or black-is-zero format.

## Extends

- [`ObjectBase`](ObjectBase)

## Constructors

### Constructor

> **new BilevelBitmap**(`width`, `height`, `bbProperties?`): `BilevelBitmap`

Creates a BilevelBitmap instance with optionally initialized pixels.

#### Parameters

##### width

`number`

The bi-level bitmap width, in pixels.

##### height

`number`

The bi-level bitmap height, in pixels.

##### bbProperties?

[`BilevelBitmapProperties`](../type-aliases/BilevelBitmapProperties)

The settings for creating a bi-level bitmap.

#### Returns

`BilevelBitmap`

#### Overrides

`ObjectBase.constructor`

### Constructor

> **new BilevelBitmap**(`om`, `width`, `height`, `bbProperties?`): `BilevelBitmap`

Creates a BilevelBitmap instance with optionally initialized pixels.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the BilevelBitmap object.

##### width

`number`

The bi-level bitmap width, in pixels.

##### height

`number`

The bi-level bitmap height, in pixels.

##### bbProperties?

[`BilevelBitmapProperties`](../type-aliases/BilevelBitmapProperties)

The settings for creating a bi-level bitmap.

#### Returns

`BilevelBitmap`

#### Overrides

`ObjectBase.constructor`

## Accessors

### height

#### Get Signature

> **get** **height**(): `number`

Gets the height of the BilevelBitmap, in pixels.

##### Returns

`number`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### lowerBitsFirst

#### Get Signature

> **get** **lowerBitsFirst**(): `boolean`

Gets or sets a value specifying whether pixels with lower column indices are stored in the lower-order bits of the byte.

##### Returns

`boolean`

#### Set Signature

> **set** **lowerBitsFirst**(`value`): `void`

Gets or sets a value specifying whether pixels with lower column indices are stored in the lower-order bits of the byte.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

***

### transparencyMask

#### Get Signature

> **get** **transparencyMask**(): `boolean`

Gets or sets a value indicating whether the image is used to define an alpha mask of another image.

##### Returns

`boolean`

#### Set Signature

> **set** **transparencyMask**(`value`): `void`

Gets or sets a value indicating whether the image is used to define an alpha mask of another image.

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### whiteIsZero

#### Get Signature

> **get** **whiteIsZero**(): `boolean`

Gets or sets a value indicating whether 0 represents white and 1 represents black (if true) or vice versa (if false).

##### Returns

`boolean`

#### Set Signature

> **set** **whiteIsZero**(`value`): `void`

Gets or sets a value indicating whether 0 represents white and 1 represents black (if true) or vice versa (if false).

##### Parameters

###### value

`boolean`

##### Returns

`void`

***

### width

#### Get Signature

> **get** **width**(): `number`

Gets the width of the BilevelBitmap, in pixels.

##### Returns

`number`

## Methods

### clear()

> **clear**(`value`, `bounds?`): `void`

Clears the BilevelBitmap with the specified value (true is 1, false is 0).

#### Parameters

##### value

`boolean`

The value to fill the image (true is 1, false is 0).

##### bounds?

The target rectangle of the BilevelBitmap.

[`Bounds`](../type-aliases/Bounds) | `null`

#### Returns

`void`

***

### clip()

#### Call Signature

> **clip**(`x`, `y`, `width`, `height`, `metadataOnly?`): `BilevelBitmap`

Creates a new BilevelBitmap with a fragment of the image.

##### Parameters

###### x

`number`

The X coordinate of the clipping rectangle.

###### y

`number`

The Y coordinate of the clipping rectangle.

###### width

`number`

The width of the clipping rectangle.

###### height

`number`

The height of the clipping rectangle.

###### metadataOnly?

`boolean`

Specifies whether to copy the image metadata only, not actual pixel data. The default is false.

##### Returns

`BilevelBitmap`

A new BilevelBitmap with a fragment of the source image.

#### Call Signature

> **clip**(`bounds`, `metadataOnly?`): `BilevelBitmap`

Creates a new BilevelBitmap with a fragment of the image.

##### Parameters

###### bounds

[`Bounds`](../type-aliases/Bounds)

Clipping rectangle of the source image to be extracted as a new BilevelBitmap.

###### metadataOnly?

`boolean`

Specifies whether to copy the image metadata only, not actual pixel data. The default is false.

##### Returns

`BilevelBitmap`

A new BilevelBitmap with a fragment of the source image.

***

### clone()

> **clone**(`metadataOnly?`): `BilevelBitmap`

Creates a new BilevelBitmap with a copy of the image.

#### Parameters

##### metadataOnly?

`boolean` = `false`

specifies whether to copy the image metadata only, not actual pixel data.

#### Returns

`BilevelBitmap`

A new instance of the BilevelBitmap.

***

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### invertColors()

> **invertColors**(): `void`

Inverts all black pixels to white and all white pixels to black.

#### Returns

`void`

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)

***

### toBitmap()

> **toBitmap**(): [`Bitmap`](Bitmap)

Creates a [Bitmap](Bitmap) instance from the current BilevelBitmap.

#### Returns

[`Bitmap`](Bitmap)

A new instance of the [Bitmap](Bitmap) class.
