We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I see that the PApplet class has some methods with the exact same names as those of PImage (copy(), filter(), set(), get()), but it seems that they are not inherited from each other and as such, I cannot call the PImage copy() method with the PApplet (this
) as an argument.
Is the best way really to manually call get() and set() for each individual pixel? This seems like missing functionality, since we have an image() function that draws a PImage into the applet.
Answers
In order to access sketch's main canvas, call getGraphics(). B-)
Or simply use variable g or clone the PGraphics canvas via get(). :>
Thanks. But in my program, I draw a lot of points for my scatter plot, and it seems that using PGraphics.set() is much slower than the same code using PImage.set(). I'm guessing PGraphics somehow buffers up the draw operations and then replays them on demand (when image() is called)? I guess I'll stick to using the PImage class for now.