Working with layers ?

I bought a 16 bit 128128 OLED from adafruit, and I’m having quite a difficult time figuring out the best way to work with layers (inside the SRAM of an Arduino Due). So far what I’ve done, is modify the Adafruit GFX and the SSD1351 libraries a tiny bit so that every time a pixel is written to the display, it is also stored in a 128128 16 bit buffer. This way, my playhead (it’s a small sequencer I’m building) doesn’t erase all the underlying graphics all the time. But in order to make the visuals smooth, I didn’t simply redraw the entire display. Instead I’m storing the playhead (a simple line) each time before I draw the new one, and then I can restore the pixel states again.

This works fine for the playhead, but I also have circles that change in size as velocity is changed by the user. Here it’s not quite as easy it seems: eg. imagine this scenario:

  1. a circle is drawn, representing a note
  2. another circle is drawn, representing another note, but its area overlaps into the previous circle a bit
  3. either of the notes are removed, and thus the circle (note) that remains needs to have its missing part remade

If I just knew that it would also be the same circle that would be removed, I could use the same method as with the playhead.

My idea so far was to allocate a 128*128 screen buffer for all the 5 instruments in my sequencer, buuut then the SRAM of the Due is exceeded.

So I’m hoping, quite a lot, that someone here has a tip or idea. Perhaps there’s something simple or elegant that I didn’t think of, or didn’t know of. Or perhaps I simply need to upgrade from the Due?

Photo attached of the prototype sequencer.

Cheers,
Søren