Surface that's not really visible. Used for PDF and friends, or as a base class for other drawing surfaces. It includes the standard rendering loop.
| 28 | * class for other drawing surfaces. It includes the standard rendering loop. |
| 29 | */ |
| 30 | public class PSurfaceNone implements PSurface { |
| 31 | protected PApplet sketch; |
| 32 | protected PGraphics graphics; |
| 33 | |
| 34 | protected Thread thread; |
| 35 | protected boolean paused; |
| 36 | protected Object pauseObject = new Object(); |
| 37 | |
| 38 | protected float frameRateTarget = 60; |
| 39 | protected long frameRatePeriod = 1000000000L / 60L; |
| 40 | |
| 41 | |
| 42 | public PSurfaceNone(PGraphics graphics) { |
| 43 | this.graphics = graphics; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | @Override |
| 48 | public void initOffscreen(PApplet sketch) { |
| 49 | this.sketch = sketch; |
| 50 | |
| 51 | setSize(sketch.sketchWidth(), sketch.sketchHeight()); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | // public Component initComponent(PApplet sketch) { |
| 56 | // return null; |
| 57 | // } |
| 58 | |
| 59 | |
| 60 | @Override |
| 61 | public void initFrame(PApplet sketch) { |
| 62 | throw new IllegalStateException("initFrame() not available with " + |
| 63 | getClass().getSimpleName()); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | public Object getNative() { |
| 68 | return null; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /** Set the window (and dock, or whatever necessary) title. */ |
| 73 | @Override |
| 74 | public void setTitle(String title) { |
| 75 | // You're in a utopian PSurface implementation where titles don't exist. |
| 76 | } |
| 77 | |
| 78 | |
| 79 | @Override |
| 80 | public void setIcon(PImage image) { |
| 81 | // I ain't visible, man. |
| 82 | } |
| 83 | |
| 84 | |
| 85 | /** Show or hide the window. */ |
| 86 | @Override |
| 87 | public void setVisible(boolean visible) { |
nothing calls this directly
no outgoing calls
no test coverage detected