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 › graphical objects and drawing functions
Page Index Toggle Pages: 1
graphical objects and drawing functions (Read 507 times)
graphical objects and drawing functions
Sep 4th, 2007, 6:23pm
 
Hi,
I'm quite new in processing, but I'm experienced in object oriented programming.

Here's my question:
Is there a class for graphical objects that have methods for translations, like moving them around, resizing them, or rotating them? I know, there is the draw() function and I can clear the stage and draw the objects at a different position etc in the new frame step. But this seems to me a little low level and simply redrawing the whole canvas is not very efficient, especially if the difference between the last and the current frame is just local. If I only animate one object in front of a plain background I could just fill the area where the object was in the last step with the background color and then draw the object at the new position. But what if the background is not plain or if there is another graphical not moving object partly behind the moving object? I don't want to redraw the parts of the static object that don't change at all in the new step.

In short: Is there a more clever/efficient mechanism for redrawing the canvas or are there objects that represent grafical artifacts I can access later on, instead of just using drawing routines that don't remember any objects?

Hope I made myself clear enough.
Cheers, Grit
Re: graphical objects and drawing functions
Reply #1 - Sep 5th, 2007, 12:16am
 
The simple answer: no.

Once you do anything that draws to the canvas, it is just some pixels, there's no link back to whatever you did to cause those pixels to be added to the screen.
Page Index Toggle Pages: 1