NullPointerException when calling save() after surface.setSize() in P2D

I haven’t tested or looked at that code carefully, but guesses at some starting points to check for when alpha is disappearing or weirdly flattened –

  1. repeat drawing without clearing with background (as above)
  2. compositing multiple frame draws, e.g. keyPressed vs keyReleased
  3. drawing onto and copying off of the main canvas (which doesn’t support alpha)
  4. using an RGB PImage rather than ARGB
  5. blendMode isn’t set correctly