picrate 0.7.0-java → 0.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -1
  5. data/.travis.yml +2 -5
  6. data/CHANGELOG.md +4 -0
  7. data/README.md +3 -3
  8. data/Rakefile +15 -27
  9. data/docs/_config.yml +1 -1
  10. data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -1
  11. data/docs/_posts/2018-11-18-building-gem.md +1 -1
  12. data/lib/picrate/app.rb +1 -1
  13. data/lib/picrate/native_folder.rb +1 -1
  14. data/lib/picrate/version.rb +1 -1
  15. data/mvnw +127 -51
  16. data/mvnw.cmd +182 -0
  17. data/pom.rb +39 -30
  18. data/pom.xml +50 -37
  19. data/src/main/java/monkstone/ColorUtil.java +1 -1
  20. data/src/main/java/monkstone/core/LibraryProxy.java +0 -1
  21. data/src/main/java/monkstone/noise/SimplexNoise.java +1 -1
  22. data/src/main/java/monkstone/vecmath/GfxRender.java +87 -0
  23. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -1
  24. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  25. data/src/main/java/processing/awt/PGraphicsJava2D.java +48 -50
  26. data/src/main/java/processing/awt/PShapeJava2D.java +10 -0
  27. data/src/main/java/processing/awt/PSurfaceAWT.java +315 -371
  28. data/src/main/java/processing/core/PApplet.java +15424 -15495
  29. data/src/main/java/processing/core/PConstants.java +4 -4
  30. data/src/main/java/processing/core/PFont.java +394 -369
  31. data/src/main/java/processing/core/PGraphics.java +11 -10
  32. data/src/main/java/processing/core/PImage.java +1389 -1435
  33. data/src/main/java/processing/core/PMatrix2D.java +297 -294
  34. data/src/main/java/processing/core/PMatrix3D.java +641 -594
  35. data/src/main/java/processing/core/PShape.java +1755 -1784
  36. data/src/main/java/processing/core/PShapeOBJ.java +145 -133
  37. data/src/main/java/processing/core/PShapeSVG.java +808 -801
  38. data/src/main/java/processing/core/PStyle.java +141 -149
  39. data/src/main/java/processing/core/PSurface.java +111 -117
  40. data/src/main/java/processing/core/PSurfaceNone.java +178 -187
  41. data/src/main/java/processing/javafx/PGraphicsFX2D.java +349 -346
  42. data/src/main/java/processing/opengl/FontTexture.java +40 -59
  43. data/src/main/java/processing/opengl/FrameBuffer.java +28 -18
  44. data/src/main/java/processing/opengl/LinePath.java +7 -7
  45. data/src/main/java/processing/opengl/LineStroker.java +6 -10
  46. data/src/main/java/processing/opengl/PGL.java +56 -44
  47. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +909 -2338
  48. data/src/main/java/processing/opengl/PJOGL.java +1722 -1763
  49. data/src/main/java/processing/opengl/PShader.java +1308 -1192
  50. data/src/main/java/processing/opengl/PShapeOpenGL.java +487 -1811
  51. data/src/main/java/processing/opengl/PSurfaceJOGL.java +482 -497
  52. data/src/main/java/processing/opengl/Texture.java +99 -76
  53. data/src/main/java/processing/opengl/VertexBuffer.java +41 -43
  54. data/vendors/Rakefile +1 -1
  55. metadata +7 -4
@@ -1,6 +1,6 @@
1
1
  /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
2
 
3
- /*
3
+ /*
4
4
  Part of the Processing project - http://processing.org
5
5
 
6
6
  Copyright (c) 2015 The Processing Foundation
@@ -18,175 +18,173 @@
18
18
  Public License along with this library; if not, write to the
19
19
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
20
  Boston, MA 02111-1307 USA
21
- */
22
-
21
+ */
23
22
  package processing.core;
24
23
 
25
-
26
24
  /**
27
25
  * Surface that's not really visible. Used for PDF and friends, or as a base
28
26
  * class for other drawing surfaces. It includes the standard rendering loop.
29
27
  */
30
28
  public class PSurfaceNone implements PSurface {
31
29
 
32
- /**
33
- *
34
- */
35
- protected PApplet sketch;
36
-
37
- /**
38
- *
39
- */
40
- protected PGraphics graphics;
41
-
42
- /**
43
- *
44
- */
45
- protected Thread thread;
46
-
47
- /**
48
- *
49
- */
50
- protected boolean paused;
51
-
52
- /**
53
- *
54
- */
55
- protected Object pauseObject = new Object();
56
-
57
- /**
58
- *
59
- */
60
- protected float frameRateTarget = 60;
61
-
62
- /**
63
- *
64
- */
65
- protected long frameRatePeriod = 1000000000L / 60L;
66
-
67
- /**
68
- *
69
- * @param graphics
70
- */
71
- public PSurfaceNone(PGraphics graphics) {
30
+ /**
31
+ *
32
+ */
33
+ protected PApplet sketch;
34
+
35
+ /**
36
+ *
37
+ */
38
+ protected PGraphics graphics;
39
+
40
+ /**
41
+ *
42
+ */
43
+ protected Thread thread;
44
+
45
+ /**
46
+ *
47
+ */
48
+ protected boolean paused;
49
+
50
+ /**
51
+ *
52
+ */
53
+ protected Object pauseObject = new Object();
54
+
55
+ /**
56
+ *
57
+ */
58
+ protected float frameRateTarget = 60;
59
+
60
+ /**
61
+ *
62
+ */
63
+ protected long frameRatePeriod = 1000000000L / 60L;
64
+
65
+ /**
66
+ *
67
+ * @param graphics
68
+ */
69
+ public PSurfaceNone(PGraphics graphics) {
72
70
  this.graphics = graphics;
73
71
  }
74
72
 
75
- /**
76
- *
77
- * @param sketch
78
- */
79
- @Override
73
+ /**
74
+ *
75
+ * @param sketch
76
+ */
77
+ @Override
80
78
  public void initOffscreen(PApplet sketch) {
81
79
  this.sketch = sketch;
82
80
 
83
81
  setSize(sketch.sketchWidth(), sketch.sketchHeight());
84
82
  }
85
83
 
86
-
87
84
  // public Component initComponent(PApplet sketch) {
88
85
  // return null;
89
86
  // }
90
-
91
- /**
92
- *
93
- * @param sketch
94
- */
95
-
96
-
87
+ /**
88
+ *
89
+ * @param sketch
90
+ */
97
91
  @Override
98
92
  public void initFrame(PApplet sketch) {/*, int backgroundColor,
99
93
  int deviceIndex, boolean fullScreen,
100
94
  boolean spanDisplays) {*/
101
95
  //this.sketch = sketch;
102
- throw new IllegalStateException("initFrame() not available with " +
103
- getClass().getSimpleName());
96
+ throw new IllegalStateException("initFrame() not available with "
97
+ + getClass().getSimpleName());
104
98
  }
105
99
 
106
-
107
100
  public Object getNative() {
108
101
  return null;
109
102
  }
110
103
 
111
-
112
- /** Set the window (and dock, or whatever necessary) title.
113
- * @param title */
104
+ /**
105
+ * Set the window (and dock, or whatever necessary) title.
106
+ *
107
+ * @param title
108
+ */
114
109
  @Override
115
110
  public void setTitle(String title) {
116
111
  // You're in a utopian PSurface implementation where titles don't exist.
117
112
  }
118
113
 
119
- /**
120
- *
121
- * @param image
122
- */
123
- @Override
114
+ /**
115
+ *
116
+ * @param image
117
+ */
118
+ @Override
124
119
  public void setIcon(PImage image) {
125
120
  // I ain't visible, man.
126
121
  }
127
122
 
128
-
129
- /** Show or hide the window.
130
- * @param visible */
123
+ /**
124
+ * Show or hide the window.
125
+ *
126
+ * @param visible
127
+ */
131
128
  @Override
132
129
  public void setVisible(boolean visible) {
133
130
  // I'm always invisible. You can't catch me.
134
131
  }
135
132
 
136
-
137
- /** Set true if we want to resize things (default is not resizable)
138
- * @param resizable */
133
+ /**
134
+ * Set true if we want to resize things (default is not resizable)
135
+ *
136
+ * @param resizable
137
+ */
139
138
  @Override
140
139
  public void setResizable(boolean resizable) {
141
140
  // I don't need size to know my worth.
142
141
  }
143
142
 
144
- /**
145
- *
146
- * @param location
147
- * @param editorLocation
148
- */
149
- @Override
150
- public void placeWindow(int[] location, int[] editorLocation) { }
151
-
152
- /**
153
- *
154
- * @param stopColor
155
- */
156
- @Override
157
- public void placePresent(int stopColor) { }
158
-
159
- /**
160
- *
161
- */
162
- @Override
163
- public void setupExternalMessages() { }
143
+ /**
144
+ *
145
+ * @param location
146
+ * @param editorLocation
147
+ */
148
+ @Override
149
+ public void placeWindow(int[] location, int[] editorLocation) {
150
+ }
164
151
 
152
+ /**
153
+ *
154
+ * @param stopColor
155
+ */
156
+ @Override
157
+ public void placePresent(int stopColor) {
158
+ }
165
159
 
160
+ /**
161
+ *
162
+ */
166
163
  @Override
167
- public void setAlwaysOnTop(boolean always) { }
164
+ public void setupExternalMessages() {
165
+ }
168
166
 
167
+ @Override
168
+ public void setAlwaysOnTop(boolean always) {
169
+ }
169
170
 
170
171
  //
171
-
172
- /**
173
- *
174
- * @param x
175
- * @param y
176
- */
177
-
178
-
172
+ /**
173
+ *
174
+ * @param x
175
+ * @param y
176
+ */
179
177
  @Override
180
178
  public void setLocation(int x, int y) {
181
179
  // I'm everywhere, because I'm nowhere.
182
180
  }
183
181
 
184
- /**
185
- *
186
- * @param wide
187
- * @param high
188
- */
189
- @Override
182
+ /**
183
+ *
184
+ * @param wide
185
+ * @param high
186
+ */
187
+ @Override
190
188
  public void setSize(int wide, int high) {
191
189
  if (PApplet.DEBUG) {
192
190
  //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
@@ -209,78 +207,74 @@ public class PSurfaceNone implements PSurface {
209
207
  graphics.setSize(wide, high);
210
208
  }
211
209
 
212
-
213
210
  // public void initImage(PGraphics graphics) {
214
211
  // // TODO Auto-generated method stub
215
212
  //
216
213
  // }
217
-
218
214
  // public Component getComponent() {
219
215
  // return null;
220
216
  // }
221
-
222
-
223
217
  // public void setSmooth(int level) {
224
218
  // // TODO Auto-generated method stub
225
219
  // }
226
-
227
220
  // void requestFocus() {
228
221
  // }
229
-
230
222
  // public void blit() {
231
223
  // // TODO Auto-generated method stub
232
224
  // }
225
+ /**
226
+ *
227
+ * @param kind
228
+ */
229
+ @Override
230
+ public void setCursor(int kind) {
231
+ }
233
232
 
234
- /**
235
- *
236
- * @param kind
237
- */
238
-
239
- public void setCursor(int kind) { }
240
-
241
- /**
242
- *
243
- * @param image
244
- * @param hotspotX
245
- * @param hotspotY
246
- */
247
- public void setCursor(PImage image, int hotspotX, int hotspotY) { }
248
-
249
- /**
250
- *
251
- */
252
- public void showCursor() { }
233
+ /**
234
+ *
235
+ * @param image
236
+ * @param hotspotX
237
+ * @param hotspotY
238
+ */
239
+ @Override
240
+ public void setCursor(PImage image, int hotspotX, int hotspotY) {
241
+ }
253
242
 
254
- /**
255
- *
256
- */
257
- public void hideCursor() { }
243
+ /**
244
+ *
245
+ */
246
+ @Override
247
+ public void showCursor() {
248
+ }
258
249
 
250
+ /**
251
+ *
252
+ */
253
+ @Override
254
+ public void hideCursor() {
255
+ }
259
256
 
260
257
  //
261
-
262
- /**
263
- *
264
- * @return
265
- */
266
-
267
-
258
+ /**
259
+ *
260
+ * @return
261
+ */
268
262
  public Thread createThread() {
269
263
  return new AnimationThread();
270
264
  }
271
265
 
272
-
266
+ @Override
273
267
  public void startThread() {
274
268
  if (thread == null) {
275
269
  thread = createThread();
276
270
  thread.start();
277
271
  } else {
278
- throw new IllegalStateException("Thread already started in " +
279
- getClass().getSimpleName());
272
+ throw new IllegalStateException("Thread already started in "
273
+ + getClass().getSimpleName());
280
274
  }
281
275
  }
282
276
 
283
-
277
+ @Override
284
278
  public boolean stopThread() {
285
279
  if (thread == null) {
286
280
  return false;
@@ -289,27 +283,26 @@ public class PSurfaceNone implements PSurface {
289
283
  return true;
290
284
  }
291
285
 
292
- /**
293
- *
294
- * @return
295
- */
296
- public boolean isStopped() {
286
+ /**
287
+ *
288
+ * @return
289
+ */
290
+ @Override
291
+ public boolean isStopped() {
297
292
  return thread == null || !thread.isAlive();
298
293
  }
299
294
 
300
-
301
295
  // sets a flag to pause the thread when ready
296
+ @Override
302
297
  public void pauseThread() {
303
298
  PApplet.debug("PApplet.run() paused, calling object wait...");
304
299
  paused = true;
305
300
  }
306
301
 
307
-
308
302
  // halts the animation thread if the pause flag is set
309
-
310
- /**
311
- *
312
- */
303
+ /**
304
+ *
305
+ */
313
306
  protected void checkPause() {
314
307
  if (paused) {
315
308
  synchronized (pauseObject) {
@@ -324,50 +317,52 @@ public class PSurfaceNone implements PSurface {
324
317
  // PApplet.debug("done with pause");
325
318
  }
326
319
 
327
- /**
328
- *
329
- */
330
- public void resumeThread() {
320
+ /**
321
+ *
322
+ */
323
+ @Override
324
+ public void resumeThread() {
331
325
  paused = false;
332
326
  synchronized (pauseObject) {
333
327
  pauseObject.notifyAll(); // wake up the animation thread
334
328
  }
335
329
  }
336
330
 
337
- /**
338
- *
339
- * @param fps
340
- */
341
- public void setFrameRate(float fps) {
331
+ /**
332
+ *
333
+ * @param fps
334
+ */
335
+ @Override
336
+ public void setFrameRate(float fps) {
342
337
  frameRateTarget = fps;
343
338
  frameRatePeriod = (long) (1000000000.0 / frameRateTarget);
344
339
  //g.setFrameRate(fps);
345
340
  }
346
341
 
342
+ /**
343
+ *
344
+ */
345
+ public class AnimationThread extends Thread {
346
+
347
347
  /**
348
348
  *
349
349
  */
350
- public class AnimationThread extends Thread {
351
-
352
- /**
353
- *
354
- */
355
- public AnimationThread() {
350
+ public AnimationThread() {
356
351
  super("Animation Thread");
357
352
  }
358
353
 
359
354
  // broken out so it can be overridden by Danger et al
360
-
361
- /**
362
- *
363
- */
355
+ /**
356
+ *
357
+ */
364
358
  public void callDraw() {
365
359
  sketch.handleDraw();
366
360
  }
367
361
 
368
362
  /**
369
363
  * Main method for the primary animation thread.
370
- * <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
364
+ * <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting
365
+ * in AWT and Swing</A>
371
366
  */
372
367
  @Override
373
368
  public void run() { // not good to make this synchronized, locks things up
@@ -397,8 +392,7 @@ public class PSurfaceNone implements PSurface {
397
392
  }
398
393
  // System.out.format(" but now, sketchW/H changed to %d %d%n", sketchWidth, sketchHeight);
399
394
  }
400
- */
401
-
395
+ */
402
396
  // un-pause the sketch and get rolling
403
397
  sketch.start();
404
398
 
@@ -411,7 +405,6 @@ public class PSurfaceNone implements PSurface {
411
405
  // if (currentSize.width != sketchWidth || currentSize.height != sketchHeight) {
412
406
  // System.err.format("need to resize from %s to %d, %d%n", currentSize, sketchWidth, sketchHeight);
413
407
  // }
414
-
415
408
  // render a single frame
416
409
  // try {
417
410
  // EventQueue.invokeAndWait(new Runnable() {
@@ -427,7 +420,6 @@ public class PSurfaceNone implements PSurface {
427
420
  // }
428
421
  // }
429
422
  // });
430
-
431
423
  // }
432
424
  // });
433
425
  // } catch (InterruptedException ie) {
@@ -435,12 +427,10 @@ public class PSurfaceNone implements PSurface {
435
427
  // } catch (InvocationTargetException ite) {
436
428
  // ite.getTargetException().printStackTrace();
437
429
  // }
438
-
439
430
  // wait for update & paint to happen before drawing next frame
440
431
  // this is necessary since the drawing is sometimes in a
441
432
  // separate thread, meaning that the next frame will start
442
433
  // before the update/paint is completed
443
-
444
434
  long afterTime = System.nanoTime();
445
435
  long timeDiff = afterTime - beforeTime;
446
436
  //System.out.println("time diff is " + timeDiff);
@@ -450,7 +440,8 @@ public class PSurfaceNone implements PSurface {
450
440
  try {
451
441
  Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
452
442
  noDelays = 0; // Got some sleep, not delaying anymore
453
- } catch (InterruptedException ex) { }
443
+ } catch (InterruptedException ex) {
444
+ }
454
445
 
455
446
  overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
456
447