Performance issues with PGraphics layers and image() calls

Hello @Braunstein,

I was inspired by your topic and shared code in the Gallery:
Processing PGraphics Image Scaling and Renderer Test

Tatooine came to mind and I found the image (classic scene) I was remembering:

I saw the first movie in the theatre! Good memories.

I have done similar in the past and have encountered the same performance and other issues.

  1. JAVA2D uses CPU rendering; image(pg, a, b, c, d) resizing is slow for a PGraphic.

  2. P2D uses GPU rendering; image(pg, a, b, c, d) resizing is faster for a PGraphic.

  3. In JAVA2D you can also copy the PGraphic canvas directly into a PImage and resize which is faster than 1:

    PImage target = pgSun.get();  
    target.resize(900, 900);
    image(target, 0, 0);

It was getting late so scrutinize and test the content provided.

Have fun!

:)