The new Processing 3.0 beta is available in the Processing website for download. There are some changes in the internal operations that we may need to pay attention to in case our programs depend on them.
Here is a sketch with 2D graphics, I try to list out those internal hidden variables and functions, especially those related to the PSurface class.
import processing.awt.PSurfaceAWT; import processing.awt.PSurfaceAWT.SmoothCanvas; import javax.swing.JFrame; void setup() { size(640, 480); println(frame); println(g); PSurfaceAWT s = (PSurfaceAWT) this.getSurface(); println(s); SmoothCanvas c = (SmoothCanvas) s.getNative(); println(c); JFrame f = (JFrame) c.getFrame(); println(f); } void draw() { background(0); } |
It is announced that the PApplet class is no longer a subclass of Applet. Here are what I test in the sample program.
frame
It seems not working now.
c
It still provides the link to the PGraphics.
getSurface()
It points to an object instance of the drawing surface that is a variation of the PSurface class.
getNative()
It is a function inside the PSurfaceAWT class. It will return a link to the SmoothCanvas instance, and which is a subclass of Canvas object.
getFrame()
It is a function from the SmoothCanvas class. It will provide a link to a JFrame instance where we can manipulate.