r/processing • u/snapkarklepop • 13d ago
Help request drawing program
i’m creating a drawing program within processing and i’m trying to add a way to change the background/canvas color. within the draw function, i have a color wheel that changes the brush color, as well as a color wheel that changes the canvas color. all is going smoothly, except when i try to put it all together. if i draw the canvas within the void setup, the user is unable to change its color. however, if i draw the canvas within the void draw, it redraws itself between every iteration of the brushstroke, so the brush only ever shows up at its current state and never leaves a mark behind.
i think i worded this oddly but hopefully it makes sense. can anybody help me figure out how to allow the canvas color to change while not “erasing” the brush strokes?
View all comments
6
u/forgotmyusernamedamm 13d ago
There's a couple ways to solve this. The easiest is to use PGraphics. With a pgraphic you can save your painting into an image with no background. Then show that image over a background with a color you can change. Here's sample code.