propane 3.10.0-java → 3.11.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +2 -0
- data/README.md +7 -7
- data/lib/propane/app.rb +2 -5
- data/lib/propane/helper_methods.rb +6 -6
- data/lib/propane/version.rb +1 -1
- data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
- data/pom.rb +6 -6
- data/pom.xml +6 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
- data/src/main/java/processing/awt/PImageAWT.java +6 -4
- data/src/main/java/processing/core/PApplet.java +71 -59
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
- data/src/main/java/processing/opengl/PShader.java +1 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
- data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
- data/test/test_helper.rb +1 -0
- data/vendors/Rakefile +1 -1
- metadata +29 -155
- data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
- data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/lib/java/monkstone/ColorUtil.java +0 -127
- data/lib/java/monkstone/MathToolModule.java +0 -287
- data/lib/java/monkstone/PropaneLibrary.java +0 -46
- data/lib/java/monkstone/core/LibraryProxy.java +0 -136
- data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
- data/lib/java/monkstone/fastmath/Deglut.java +0 -71
- data/lib/java/monkstone/fastmath/package-info.java +0 -6
- data/lib/java/monkstone/filechooser/Chooser.java +0 -39
- data/lib/java/monkstone/noise/FastTerrain.java +0 -874
- data/lib/java/monkstone/noise/Noise.java +0 -90
- data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/lib/java/monkstone/noise/NoiseMode.java +0 -28
- data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
- data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
- data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
- data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
- data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
- data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
- data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
- data/lib/java/monkstone/slider/Slider.java +0 -61
- data/lib/java/monkstone/slider/SliderBar.java +0 -245
- data/lib/java/monkstone/slider/SliderGroup.java +0 -56
- data/lib/java/monkstone/slider/WheelHandler.java +0 -35
- data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
- data/lib/java/monkstone/vecmath/JRender.java +0 -56
- data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
- data/lib/java/monkstone/vecmath/package-info.java +0 -20
- data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
- data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
- data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
- data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
- data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
- data/lib/java/monkstone/videoevent/package-info.java +0 -20
- data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
- data/lib/java/processing/awt/PImageAWT.java +0 -377
- data/lib/java/processing/awt/PShapeJava2D.java +0 -387
- data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
- data/lib/java/processing/awt/ShimAWT.java +0 -581
- data/lib/java/processing/core/PApplet.java +0 -15156
- data/lib/java/processing/core/PConstants.java +0 -523
- data/lib/java/processing/core/PFont.java +0 -1126
- data/lib/java/processing/core/PGraphics.java +0 -8600
- data/lib/java/processing/core/PImage.java +0 -3377
- data/lib/java/processing/core/PMatrix.java +0 -208
- data/lib/java/processing/core/PMatrix2D.java +0 -562
- data/lib/java/processing/core/PMatrix3D.java +0 -890
- data/lib/java/processing/core/PShape.java +0 -3561
- data/lib/java/processing/core/PShapeOBJ.java +0 -483
- data/lib/java/processing/core/PShapeSVG.java +0 -2016
- data/lib/java/processing/core/PStyle.java +0 -63
- data/lib/java/processing/core/PSurface.java +0 -198
- data/lib/java/processing/core/PSurfaceNone.java +0 -431
- data/lib/java/processing/core/PVector.java +0 -1066
- data/lib/java/processing/core/ThinkDifferent.java +0 -115
- data/lib/java/processing/data/DoubleDict.java +0 -850
- data/lib/java/processing/data/DoubleList.java +0 -928
- data/lib/java/processing/data/FloatDict.java +0 -847
- data/lib/java/processing/data/FloatList.java +0 -936
- data/lib/java/processing/data/IntDict.java +0 -807
- data/lib/java/processing/data/IntList.java +0 -936
- data/lib/java/processing/data/JSONArray.java +0 -1260
- data/lib/java/processing/data/JSONObject.java +0 -2282
- data/lib/java/processing/data/JSONTokener.java +0 -435
- data/lib/java/processing/data/LongDict.java +0 -802
- data/lib/java/processing/data/LongList.java +0 -937
- data/lib/java/processing/data/Sort.java +0 -46
- data/lib/java/processing/data/StringDict.java +0 -613
- data/lib/java/processing/data/StringList.java +0 -800
- data/lib/java/processing/data/Table.java +0 -4936
- data/lib/java/processing/data/TableRow.java +0 -198
- data/lib/java/processing/data/XML.java +0 -1156
- data/lib/java/processing/dxf/RawDXF.java +0 -404
- data/lib/java/processing/event/Event.java +0 -125
- data/lib/java/processing/event/KeyEvent.java +0 -70
- data/lib/java/processing/event/MouseEvent.java +0 -114
- data/lib/java/processing/event/TouchEvent.java +0 -57
- data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
- data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
- data/lib/java/processing/net/Client.java +0 -744
- data/lib/java/processing/net/Server.java +0 -388
- data/lib/java/processing/opengl/FontTexture.java +0 -378
- data/lib/java/processing/opengl/FrameBuffer.java +0 -513
- data/lib/java/processing/opengl/LinePath.java +0 -627
- data/lib/java/processing/opengl/LineStroker.java +0 -681
- data/lib/java/processing/opengl/PGL.java +0 -3483
- data/lib/java/processing/opengl/PGraphics2D.java +0 -615
- data/lib/java/processing/opengl/PGraphics3D.java +0 -281
- data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
- data/lib/java/processing/opengl/PJOGL.java +0 -2008
- data/lib/java/processing/opengl/PShader.java +0 -1484
- data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
- data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
- data/lib/java/processing/opengl/Texture.java +0 -1696
- data/lib/java/processing/opengl/VertexBuffer.java +0 -88
- data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
- data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +0 -27
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,63 +0,0 @@
|
|
1
|
-
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
/*
|
4
|
-
Part of the Processing project - http://processing.org
|
5
|
-
|
6
|
-
Copyright (c) 2008 Ben Fry and Casey Reas
|
7
|
-
|
8
|
-
This library is free software; you can redistribute it and/or
|
9
|
-
modify it under the terms of the GNU Lesser General Public
|
10
|
-
License as published by the Free Software Foundation; either
|
11
|
-
version 2.1 of the License, or (at your option) any later version.
|
12
|
-
|
13
|
-
This library is distributed in the hope that it will be useful,
|
14
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16
|
-
Lesser General Public License for more details.
|
17
|
-
|
18
|
-
You should have received a copy of the GNU Lesser General
|
19
|
-
Public License along with this library; if not, write to the
|
20
|
-
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
21
|
-
Boston, MA 02111-1307 USA
|
22
|
-
*/
|
23
|
-
|
24
|
-
package processing.core;
|
25
|
-
|
26
|
-
|
27
|
-
public class PStyle implements PConstants {
|
28
|
-
public int imageMode;
|
29
|
-
public int rectMode;
|
30
|
-
public int ellipseMode;
|
31
|
-
public int shapeMode;
|
32
|
-
|
33
|
-
public int blendMode;
|
34
|
-
|
35
|
-
public int colorMode;
|
36
|
-
public float colorModeX;
|
37
|
-
public float colorModeY;
|
38
|
-
public float colorModeZ;
|
39
|
-
public float colorModeA;
|
40
|
-
|
41
|
-
public boolean tint;
|
42
|
-
public int tintColor;
|
43
|
-
public boolean fill;
|
44
|
-
public int fillColor;
|
45
|
-
public boolean stroke;
|
46
|
-
public int strokeColor;
|
47
|
-
public float strokeWeight;
|
48
|
-
public int strokeCap;
|
49
|
-
public int strokeJoin;
|
50
|
-
|
51
|
-
// TODO these fellas are inconsistent, and may need to go elsewhere
|
52
|
-
public float ambientR, ambientG, ambientB;
|
53
|
-
public float specularR, specularG, specularB;
|
54
|
-
public float emissiveR, emissiveG, emissiveB;
|
55
|
-
public float shininess;
|
56
|
-
|
57
|
-
public PFont textFont;
|
58
|
-
public int textAlign;
|
59
|
-
public int textAlignY;
|
60
|
-
public int textMode;
|
61
|
-
public float textSize;
|
62
|
-
public float textLeading;
|
63
|
-
}
|
@@ -1,198 +0,0 @@
|
|
1
|
-
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
/*
|
4
|
-
Part of the Processing project - http://processing.org
|
5
|
-
|
6
|
-
Copyright (c) 2014-15 The Processing Foundation
|
7
|
-
|
8
|
-
This library is free software; you can redistribute it and/or
|
9
|
-
modify it under the terms of the GNU Lesser General Public
|
10
|
-
License as published by the Free Software Foundation, version 2.1.
|
11
|
-
|
12
|
-
This library is distributed in the hope that it will be useful,
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
-
Lesser General Public License for more details.
|
16
|
-
|
17
|
-
You should have received a copy of the GNU Lesser General
|
18
|
-
Public License along with this library; if not, write to the
|
19
|
-
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
20
|
-
Boston, MA 02111-1307 USA
|
21
|
-
*/
|
22
|
-
|
23
|
-
package processing.core;
|
24
|
-
|
25
|
-
import java.io.File;
|
26
|
-
|
27
|
-
public interface PSurface {
|
28
|
-
/**
|
29
|
-
* Minimum dimensions for the window holding an applet. This varies between
|
30
|
-
* platforms, Mac OS X 10.3 (confirmed with 10.7 and Java 6) can do any
|
31
|
-
* height but requires at least 128 pixels width. Windows XP has another
|
32
|
-
* set of limitations. And for all I know, Linux probably allows window
|
33
|
-
* sizes to be negative numbers.
|
34
|
-
*/
|
35
|
-
static public final int MIN_WINDOW_WIDTH = 128;
|
36
|
-
static public final int MIN_WINDOW_HEIGHT = 128;
|
37
|
-
|
38
|
-
//public int displayDensity();
|
39
|
-
|
40
|
-
//public int displayDensity(int display);
|
41
|
-
|
42
|
-
//
|
43
|
-
|
44
|
-
// renderer that doesn't draw to the screen
|
45
|
-
public void initOffscreen(PApplet sketch);
|
46
|
-
|
47
|
-
// considering removal in favor of separate Component classes for appropriate renderers
|
48
|
-
// (i.e. for Java2D or a generic Image surface, but not PDF, debatable for GL or FX)
|
49
|
-
//public Component initComponent(PApplet sketch);
|
50
|
-
|
51
|
-
//public Frame initFrame(PApplet sketch, Color backgroundColor,
|
52
|
-
// public void initFrame(PApplet sketch, int backgroundColor,
|
53
|
-
// int deviceIndex, boolean fullScreen, boolean spanDisplays);
|
54
|
-
public void initFrame(PApplet sketch);
|
55
|
-
|
56
|
-
//
|
57
|
-
|
58
|
-
public PImage loadImage(String path, Object... args);
|
59
|
-
|
60
|
-
//
|
61
|
-
|
62
|
-
public void selectInput(String prompt, String callback,
|
63
|
-
File file, Object callbackObject);
|
64
|
-
|
65
|
-
public void selectOutput(String prompt, String callback,
|
66
|
-
File file, Object callbackObject);
|
67
|
-
|
68
|
-
public void selectFolder(String prompt, String callback,
|
69
|
-
File file, Object callbackObject);
|
70
|
-
|
71
|
-
//
|
72
|
-
|
73
|
-
/**
|
74
|
-
* Get the native window object associated with this drawing surface.For Java2D, this will be an AWT Frame object.
|
75
|
-
* For OpenGL, the window.
|
76
|
-
The data returned here is subject to the whims of the renderer,
|
77
|
-
and using this method means you're willing to deal with underlying
|
78
|
-
implementation changes and that you won't throw a fit like a toddler
|
79
|
-
if your code breaks sometime in the future.
|
80
|
-
* @return
|
81
|
-
*/
|
82
|
-
public Object getNative();
|
83
|
-
|
84
|
-
//
|
85
|
-
|
86
|
-
// Just call these on an AWT Frame object stored in PApplet.
|
87
|
-
// Silly, but prevents a lot of rewrite and extra methods for little benefit.
|
88
|
-
// However, maybe prevents us from having to document the 'frame' variable?
|
89
|
-
|
90
|
-
/** Set the window (and dock, or whatever necessary) title.
|
91
|
-
* @param title */
|
92
|
-
public void setTitle(String title);
|
93
|
-
|
94
|
-
/** Show or hide the window.
|
95
|
-
* @param visible */
|
96
|
-
public void setVisible(boolean visible);
|
97
|
-
|
98
|
-
/** Set true if we want to resize things (default is not resizable)
|
99
|
-
* @param resizable */
|
100
|
-
public void setResizable(boolean resizable);
|
101
|
-
|
102
|
-
/** Dumb name, but inherited from Frame and no better ideas.
|
103
|
-
* @param always */
|
104
|
-
public void setAlwaysOnTop(boolean always);
|
105
|
-
|
106
|
-
public void setIcon(PImage icon);
|
107
|
-
|
108
|
-
//
|
109
|
-
|
110
|
-
// public void placeWindow(int[] location);
|
111
|
-
|
112
|
-
public void placeWindow(int[] location, int[] editorLocation);
|
113
|
-
|
114
|
-
//public void placeFullScreen(boolean hideStop);
|
115
|
-
public void placePresent(int stopColor);
|
116
|
-
|
117
|
-
// Sketch is running from the PDE, set up messaging back to the PDE
|
118
|
-
public void setupExternalMessages();
|
119
|
-
|
120
|
-
//
|
121
|
-
|
122
|
-
// sets displayWidth/Height inside PApplet
|
123
|
-
//public void checkDisplaySize();
|
124
|
-
|
125
|
-
public void setLocation(int x, int y);
|
126
|
-
|
127
|
-
public void setSize(int width, int height);
|
128
|
-
|
129
|
-
// /**
|
130
|
-
// * Called by {@link PApplet#createGraphics} to initialize the
|
131
|
-
// * {@link PGraphics#image} object with an image that's compatible with this
|
132
|
-
// * drawing surface/display/hardware.
|
133
|
-
// * @param gr PGraphics object whose image will be set
|
134
|
-
// * @param wide
|
135
|
-
// * @param high
|
136
|
-
// */
|
137
|
-
// create pixel buffer (pulled out for offscreen graphics)
|
138
|
-
//public void initImage(PGraphics gr, int wide, int high);
|
139
|
-
// create pixel buffer, called from allocate() to produce a compatible image for rendering efficiently
|
140
|
-
// public void initImage(PGraphics gr);
|
141
|
-
|
142
|
-
//public Component getComponent();
|
143
|
-
|
144
|
-
// /**
|
145
|
-
// * Sometimes smoothing must be set at the drawing surface level
|
146
|
-
// * not just inside the renderer itself.
|
147
|
-
// */
|
148
|
-
// public void setSmooth(int level);
|
149
|
-
|
150
|
-
public void setFrameRate(float fps);
|
151
|
-
|
152
|
-
// // called on the first frame so that the now-visible drawing surface can
|
153
|
-
// // receive key and mouse events
|
154
|
-
// public void requestFocus();
|
155
|
-
|
156
|
-
// // finish rendering to the screen (called by PApplet)
|
157
|
-
// public void blit();
|
158
|
-
|
159
|
-
//
|
160
|
-
|
161
|
-
public void setCursor(int kind);
|
162
|
-
|
163
|
-
public void setCursor(PImage image, int hotspotX, int hotspotY);
|
164
|
-
|
165
|
-
public void showCursor();
|
166
|
-
|
167
|
-
public void hideCursor();
|
168
|
-
|
169
|
-
//
|
170
|
-
|
171
|
-
/**
|
172
|
-
* @param url the link to open
|
173
|
-
* @return false if unable to find a viable way to open
|
174
|
-
*/
|
175
|
-
public boolean openLink(String url);
|
176
|
-
|
177
|
-
//
|
178
|
-
|
179
|
-
/** Start the animation thread */
|
180
|
-
public void startThread();
|
181
|
-
|
182
|
-
/**
|
183
|
-
* On the next trip through the animation thread, things should go sleepy-bye.
|
184
|
-
* Does not pause the thread immediately because that needs to happen on the
|
185
|
-
* animation thread itself, so fires on the next trip through draw().
|
186
|
-
*/
|
187
|
-
public void pauseThread();
|
188
|
-
|
189
|
-
public void resumeThread();
|
190
|
-
|
191
|
-
/**
|
192
|
-
* Stop the animation thread (set it null)
|
193
|
-
* @return false if already stopped
|
194
|
-
*/
|
195
|
-
public boolean stopThread();
|
196
|
-
|
197
|
-
public boolean isStopped();
|
198
|
-
}
|
@@ -1,431 +0,0 @@
|
|
1
|
-
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
/*
|
4
|
-
Part of the Processing project - http://processing.org
|
5
|
-
|
6
|
-
Copyright (c) 2015 The Processing Foundation
|
7
|
-
|
8
|
-
This library is free software; you can redistribute it and/or
|
9
|
-
modify it under the terms of the GNU Lesser General Public
|
10
|
-
License as published by the Free Software Foundation, version 2.1.
|
11
|
-
|
12
|
-
This library is distributed in the hope that it will be useful,
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
-
Lesser General Public License for more details.
|
16
|
-
|
17
|
-
You should have received a copy of the GNU Lesser General
|
18
|
-
Public License along with this library; if not, write to the
|
19
|
-
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
20
|
-
Boston, MA 02111-1307 USA
|
21
|
-
*/
|
22
|
-
|
23
|
-
package processing.core;
|
24
|
-
|
25
|
-
import java.io.File;
|
26
|
-
|
27
|
-
import processing.awt.ShimAWT;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Surface that's not really visible. Used for PDF and friends, or as a base
|
31
|
-
* class for other drawing surfaces. It includes the standard rendering loop.
|
32
|
-
*/
|
33
|
-
public class PSurfaceNone implements PSurface {
|
34
|
-
protected PApplet sketch;
|
35
|
-
protected PGraphics graphics;
|
36
|
-
|
37
|
-
protected Thread thread;
|
38
|
-
protected boolean paused;
|
39
|
-
protected Object pauseObject = new Object();
|
40
|
-
|
41
|
-
protected float frameRateTarget = 60;
|
42
|
-
protected long frameRatePeriod = 1000000000L / 60L;
|
43
|
-
|
44
|
-
|
45
|
-
public PSurfaceNone(PGraphics graphics) {
|
46
|
-
this.graphics = graphics;
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
public int displayDensity() {
|
51
|
-
return 1;
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
public int displayDensity(int display) {
|
56
|
-
return 1;
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
@Override
|
61
|
-
public PImage loadImage(String path, Object... args) {
|
62
|
-
return ShimAWT.loadImage(sketch, path, args);
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
@Override
|
67
|
-
public void selectInput(String prompt, String callback, File file,
|
68
|
-
Object callbackObject) {
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
@Override
|
73
|
-
public void selectOutput(String prompt, String callback, File file,
|
74
|
-
Object callbackObject) {
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
@Override
|
79
|
-
public void selectFolder(String prompt, String callback, File file,
|
80
|
-
Object callbackObject) {
|
81
|
-
}
|
82
|
-
|
83
|
-
|
84
|
-
@Override
|
85
|
-
public void initOffscreen(PApplet sketch) {
|
86
|
-
this.sketch = sketch;
|
87
|
-
|
88
|
-
setSize(sketch.sketchWidth(), sketch.sketchHeight());
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
// public Component initComponent(PApplet sketch) {
|
93
|
-
// return null;
|
94
|
-
// }
|
95
|
-
|
96
|
-
|
97
|
-
@Override
|
98
|
-
public void initFrame(PApplet sketch) {
|
99
|
-
throw new IllegalStateException("initFrame() not available with " +
|
100
|
-
getClass().getSimpleName());
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
@Override
|
105
|
-
public Object getNative() {
|
106
|
-
return null;
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
/** Set the window (and dock, or whatever necessary) title.
|
111
|
-
* @param title */
|
112
|
-
@Override
|
113
|
-
public void setTitle(String title) {
|
114
|
-
// You're in a utopian PSurface implementation where titles don't exist.
|
115
|
-
}
|
116
|
-
|
117
|
-
|
118
|
-
@Override
|
119
|
-
public void setIcon(PImage image) {
|
120
|
-
// I ain't visible, man.
|
121
|
-
}
|
122
|
-
|
123
|
-
|
124
|
-
/** Show or hide the window.
|
125
|
-
* @param visible */
|
126
|
-
@Override
|
127
|
-
public void setVisible(boolean visible) {
|
128
|
-
// I'm always invisible. You can't catch me.
|
129
|
-
}
|
130
|
-
|
131
|
-
|
132
|
-
/** Set true if we want to resize things (default is not resizable)
|
133
|
-
* @param resizable */
|
134
|
-
@Override
|
135
|
-
public void setResizable(boolean resizable) {
|
136
|
-
// I don't need size to know my worth.
|
137
|
-
}
|
138
|
-
|
139
|
-
|
140
|
-
@Override
|
141
|
-
public void placeWindow(int[] location, int[] editorLocation) { }
|
142
|
-
|
143
|
-
|
144
|
-
@Override
|
145
|
-
public void placePresent(int stopColor) { }
|
146
|
-
|
147
|
-
|
148
|
-
@Override
|
149
|
-
public void setupExternalMessages() { }
|
150
|
-
|
151
|
-
|
152
|
-
@Override
|
153
|
-
public void setAlwaysOnTop(boolean always) { }
|
154
|
-
|
155
|
-
|
156
|
-
//
|
157
|
-
|
158
|
-
|
159
|
-
@Override
|
160
|
-
public void setLocation(int x, int y) {
|
161
|
-
// I'm everywhere, because I'm nowhere.
|
162
|
-
}
|
163
|
-
|
164
|
-
|
165
|
-
@Override
|
166
|
-
public void setSize(int wide, int high) {
|
167
|
-
if (PApplet.DEBUG) {
|
168
|
-
//System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
|
169
|
-
new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out);
|
170
|
-
}
|
171
|
-
|
172
|
-
//if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch
|
173
|
-
if (wide == sketch.width && high == sketch.height) {
|
174
|
-
if (PApplet.DEBUG) {
|
175
|
-
new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out);
|
176
|
-
}
|
177
|
-
return; // unchanged, don't rebuild everything
|
178
|
-
}
|
179
|
-
|
180
|
-
//throw new RuntimeException("implement me, see readme.md");
|
181
|
-
sketch.width = wide;
|
182
|
-
sketch.height = high;
|
183
|
-
|
184
|
-
// set PGraphics variables for width/height/pixelWidth/pixelHeight
|
185
|
-
graphics.setSize(wide, high);
|
186
|
-
}
|
187
|
-
|
188
|
-
|
189
|
-
// public void initImage(PGraphics graphics) {
|
190
|
-
// // TODO Auto-generated method stub
|
191
|
-
//
|
192
|
-
// }
|
193
|
-
|
194
|
-
// public Component getComponent() {
|
195
|
-
// return null;
|
196
|
-
// }
|
197
|
-
|
198
|
-
|
199
|
-
// public void setSmooth(int level) {
|
200
|
-
// // TODO Auto-generated method stub
|
201
|
-
// }
|
202
|
-
|
203
|
-
// void requestFocus() {
|
204
|
-
// }
|
205
|
-
|
206
|
-
// public void blit() {
|
207
|
-
// // TODO Auto-generated method stub
|
208
|
-
// }
|
209
|
-
|
210
|
-
@Override
|
211
|
-
public void setCursor(int kind) { }
|
212
|
-
|
213
|
-
@Override
|
214
|
-
public void setCursor(PImage image, int hotspotX, int hotspotY) { }
|
215
|
-
|
216
|
-
@Override
|
217
|
-
public void showCursor() { }
|
218
|
-
|
219
|
-
@Override
|
220
|
-
public void hideCursor() { }
|
221
|
-
|
222
|
-
|
223
|
-
//
|
224
|
-
|
225
|
-
|
226
|
-
@Override
|
227
|
-
public boolean openLink(String url) {
|
228
|
-
return false;
|
229
|
-
}
|
230
|
-
|
231
|
-
|
232
|
-
//
|
233
|
-
|
234
|
-
|
235
|
-
public Thread createThread() {
|
236
|
-
return new AnimationThread();
|
237
|
-
}
|
238
|
-
|
239
|
-
|
240
|
-
@Override
|
241
|
-
public void startThread() {
|
242
|
-
if (thread == null) {
|
243
|
-
thread = createThread();
|
244
|
-
thread.start();
|
245
|
-
} else {
|
246
|
-
throw new IllegalStateException("Thread already started in " +
|
247
|
-
getClass().getSimpleName());
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
|
252
|
-
@Override
|
253
|
-
public boolean stopThread() {
|
254
|
-
if (thread == null) {
|
255
|
-
return false;
|
256
|
-
}
|
257
|
-
thread = null;
|
258
|
-
return true;
|
259
|
-
}
|
260
|
-
|
261
|
-
|
262
|
-
@Override
|
263
|
-
public boolean isStopped() {
|
264
|
-
return thread == null || !thread.isAlive();
|
265
|
-
}
|
266
|
-
|
267
|
-
|
268
|
-
// sets a flag to pause the thread when ready
|
269
|
-
@Override
|
270
|
-
public void pauseThread() {
|
271
|
-
PApplet.debug("PApplet.run() paused, calling object wait...");
|
272
|
-
paused = true;
|
273
|
-
}
|
274
|
-
|
275
|
-
|
276
|
-
// halts the animation thread if the pause flag is set
|
277
|
-
protected void checkPause() {
|
278
|
-
if (paused) {
|
279
|
-
synchronized (pauseObject) {
|
280
|
-
try {
|
281
|
-
pauseObject.wait();
|
282
|
-
// PApplet.debug("out of wait");
|
283
|
-
} catch (InterruptedException e) {
|
284
|
-
// waiting for this interrupt on a start() (resume) call
|
285
|
-
}
|
286
|
-
}
|
287
|
-
}
|
288
|
-
// PApplet.debug("done with pause");
|
289
|
-
}
|
290
|
-
|
291
|
-
|
292
|
-
@Override
|
293
|
-
public void resumeThread() {
|
294
|
-
paused = false;
|
295
|
-
synchronized (pauseObject) {
|
296
|
-
pauseObject.notifyAll(); // wake up the animation thread
|
297
|
-
}
|
298
|
-
}
|
299
|
-
|
300
|
-
|
301
|
-
@Override
|
302
|
-
public void setFrameRate(float fps) {
|
303
|
-
frameRateTarget = fps;
|
304
|
-
frameRatePeriod = (long) (1000000000.0 / frameRateTarget);
|
305
|
-
//g.setFrameRate(fps);
|
306
|
-
}
|
307
|
-
|
308
|
-
|
309
|
-
public class AnimationThread extends Thread {
|
310
|
-
|
311
|
-
public AnimationThread() {
|
312
|
-
super("Animation Thread");
|
313
|
-
}
|
314
|
-
|
315
|
-
// broken out so it can be overridden by Danger et al
|
316
|
-
public void callDraw() {
|
317
|
-
sketch.handleDraw();
|
318
|
-
}
|
319
|
-
|
320
|
-
/**
|
321
|
-
* Main method for the primary animation thread.
|
322
|
-
* <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
|
323
|
-
*/
|
324
|
-
@Override
|
325
|
-
public void run() { // not good to make this synchronized, locks things up
|
326
|
-
long beforeTime = System.nanoTime();
|
327
|
-
long overSleepTime = 0L;
|
328
|
-
|
329
|
-
int noDelays = 0;
|
330
|
-
// Number of frames with a delay of 0 ms before the
|
331
|
-
// animation thread yields to other running threads.
|
332
|
-
final int NO_DELAYS_PER_YIELD = 15;
|
333
|
-
|
334
|
-
/*
|
335
|
-
// If size un-initialized, might be a Canvas. Call setSize() here since
|
336
|
-
// we now have a parent object that this Canvas can use as a peer.
|
337
|
-
if (graphics.image == null) {
|
338
|
-
// System.out.format("it's null, sketchW/H already set to %d %d%n", sketchWidth, sketchHeight);
|
339
|
-
try {
|
340
|
-
EventQueue.invokeAndWait(new Runnable() {
|
341
|
-
public void run() {
|
342
|
-
setSize(sketchWidth, sketchHeight);
|
343
|
-
}
|
344
|
-
});
|
345
|
-
} catch (InterruptedException ie) {
|
346
|
-
ie.printStackTrace();
|
347
|
-
} catch (InvocationTargetException ite) {
|
348
|
-
ite.printStackTrace();
|
349
|
-
}
|
350
|
-
// System.out.format(" but now, sketchW/H changed to %d %d%n", sketchWidth, sketchHeight);
|
351
|
-
}
|
352
|
-
*/
|
353
|
-
|
354
|
-
// un-pause the sketch and get rolling
|
355
|
-
sketch.start();
|
356
|
-
|
357
|
-
while ((Thread.currentThread() == thread) && !sketch.finished) {
|
358
|
-
checkPause();
|
359
|
-
|
360
|
-
// Don't resize the renderer from the EDT (i.e. from a ComponentEvent),
|
361
|
-
// otherwise it may attempt a resize mid-render.
|
362
|
-
// Dimension currentSize = canvas.getSize();
|
363
|
-
// if (currentSize.width != sketchWidth || currentSize.height != sketchHeight) {
|
364
|
-
// System.err.format("need to resize from %s to %d, %d%n", currentSize, sketchWidth, sketchHeight);
|
365
|
-
// }
|
366
|
-
|
367
|
-
// render a single frame
|
368
|
-
// try {
|
369
|
-
// EventQueue.invokeAndWait(new Runnable() {
|
370
|
-
// public void run() {
|
371
|
-
// System.out.println("calling draw, finished = " + sketch.finished);
|
372
|
-
//System.out.println("calling draw, looping = " + sketch.looping + ", frameCount = " + sketch.frameCount);
|
373
|
-
callDraw();
|
374
|
-
|
375
|
-
// EventQueue.invokeLater(new Runnable() {
|
376
|
-
// public void run() {
|
377
|
-
// if (sketch.frameCount == 1) {
|
378
|
-
// requestFocus();
|
379
|
-
// }
|
380
|
-
// }
|
381
|
-
// });
|
382
|
-
|
383
|
-
// }
|
384
|
-
// });
|
385
|
-
// } catch (InterruptedException ie) {
|
386
|
-
// ie.printStackTrace();
|
387
|
-
// } catch (InvocationTargetException ite) {
|
388
|
-
// ite.getTargetException().printStackTrace();
|
389
|
-
// }
|
390
|
-
|
391
|
-
// wait for update & paint to happen before drawing next frame
|
392
|
-
// this is necessary since the drawing is sometimes in a
|
393
|
-
// separate thread, meaning that the next frame will start
|
394
|
-
// before the update/paint is completed
|
395
|
-
|
396
|
-
long afterTime = System.nanoTime();
|
397
|
-
long timeDiff = afterTime - beforeTime;
|
398
|
-
//System.out.println("time diff is " + timeDiff);
|
399
|
-
long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
|
400
|
-
|
401
|
-
if (sleepTime > 0) { // some time left in this cycle
|
402
|
-
try {
|
403
|
-
Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
|
404
|
-
noDelays = 0; // Got some sleep, not delaying anymore
|
405
|
-
} catch (InterruptedException ex) { }
|
406
|
-
|
407
|
-
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
|
408
|
-
|
409
|
-
} else { // sleepTime <= 0; the frame took longer than the period
|
410
|
-
overSleepTime = 0L;
|
411
|
-
noDelays++;
|
412
|
-
|
413
|
-
if (noDelays > NO_DELAYS_PER_YIELD) {
|
414
|
-
Thread.yield(); // give another thread a chance to run
|
415
|
-
noDelays = 0;
|
416
|
-
}
|
417
|
-
}
|
418
|
-
|
419
|
-
beforeTime = System.nanoTime();
|
420
|
-
}
|
421
|
-
|
422
|
-
sketch.dispose(); // call to shutdown libs?
|
423
|
-
|
424
|
-
// If the user called the exit() function, the window should close,
|
425
|
-
// rather than the sketch just halting.
|
426
|
-
if (sketch.exitCalled) {
|
427
|
-
sketch.exitActual();
|
428
|
-
}
|
429
|
-
}
|
430
|
-
}
|
431
|
-
}
|