Getting a screendump of the current view

Posted on
  • Hi, I've had a look and couldn't find anything on getting a screen dump of the current view on the watch - I tried a few of the things from the Graphics library like fromBPM but that gives me:

    Uncaught Error: asBMP/asURL only works on 1bpp/24bpp Graphics

    And if I try getImage with an object or string I get:

    Interpreter error: [
      "LOW_MEMORY",
      "MEMORY"
     ]
    New interpreter error: LOW_MEMORY,MEMORY
    

    g.buffer seems to be undefined - I was trying to see if I could convert it to a UInt8Array and then to string.

    Does anyone have any suggestions?

  • It's a bit difficult I'm afraid. The problem is the display itself is write-only, so Bangle.js cannot read back what's on it - and there's only ~40kB RAM available so there can't be an offscreen buffer.

    However there are some options:

    • If your app will run in the emulator, use that - there's even a screenshot button. https://www.espruino.com/ide/emulator.ht­ml
    • Define a new graphics object that's only 1bpp (black and white) which will fit in RAM, and then dump that...

      g = Graphics.createArrayBuffer(240,240,1);
      // draw...
      g.dump();  // this prints the bitmap to the console of the Web IDE, then you can just copy/paste or screen grab
      

    Potentially you could render the 16bpp image in slices, but that's a lot of work!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Getting a screendump of the current view

Posted by Avatar for tanepiper @tanepiper

Actions