Constructs a new Bitmap.
new Bitmap(pixels, width, height, scale?)
pixels
A Uint8Array containing RGBA pixel data (4 bytes per pixel).
width
The width of the bitmap in pixels.
height
The height of the bitmap in pixels.
scale optional
The display scale factor. Default is 1.
// 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}