Docs

Bitmap.constructor

Constructs a new Bitmap.

Syntax

new Bitmap(pixels, width, height, scale?)

Parameters

Examples

// Create a 2x2 red bitmap
let pixels = new Uint8Array([
  255, 0, 0, 255,  // Red pixel
  255, 0, 0, 255,  // Red pixel
  255, 0, 0, 255,  // Red pixel
  255, 0, 0, 255   // Red pixel
])
let bitmap = new Bitmap(pixels, 2, 2)
Bitmap {pixels: Uint8Array(16), width: 2, height: 2, scale: 1}