Actually, here's a simpler method: create a new graphics object that uses a 1-bit buffer, use getPixel and setPixel on that, and then draw it to the screen as an image.
// Create the buffer
let b = Graphics.createArrayBuffer(240, 240, 1, {msb: true});
// Get and set pixels
b.setPixel(x, y, 1);
let value = b.getPixel(x, y);
// Draw to screen
g.drawImage({width: 240, height: 240, bpp: 1, buffer: b.buffer});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Actually, here's a simpler method: create a new graphics object that uses a 1-bit buffer, use getPixel and setPixel on that, and then draw it to the screen as an image.