How to set background for PGraphics?

I'm trying to save an image from a PGraphics I've created, but I can't figure out how to change the background color of the PGrahics. It either comes out as black background or transparent. Any suggestions?

Answers

  • Answer ✓

    Simply use the background statement to clear the PGraphics object before drawing.

    pg.beginDraw();
    pg.background(???);  // set the background colour
    // your drawing commands
    pg.endDraw();
    pg.save();
    
  • yes! I forgot about beginDraw and endDraw, thanks!

Sign In or Register to comment.