We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Best way to preserve the background
Page Index Toggle Pages: 1
Best way to preserve the background (Read 525 times)
Best way to preserve the background
Mar 29th, 2009, 10:12pm
 
Hi,

I was wonder what the best (most efficient processor wise) way to preserve a background layer would be.

For example, if I made a simple paint program that had custom cursors that I was drawing on the screen, I'd want to be able to leave the background alone, aka not clear it next frame with a call to background.

The only way I know how to do this now is to capture the screen with get() and put it into a PImage before drawing the stuff that I want to move next frame, like UI stuff.

Any clues?
Re: Best way to preserve the background
Reply #1 - Mar 30th, 2009, 2:48am
 
I am not too sure of what is the problem. But if you want to paint over a fixed background, indeed you can load an image (or create it) and do image() at start of draw() to restore background. If you need to preserve painting as well, you can just draw on another PImage and image() it over the background.
Re: Best way to preserve the background
Reply #2 - Mar 30th, 2009, 12:20pm
 
Yeah, this is want I want to do.

Just wondering if there was a better way.

Thanks...
Page Index Toggle Pages: 1