propane 3.8.0-java → 4.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +7 -1
  6. data/README.md +7 -7
  7. data/Rakefile +6 -5
  8. data/lib/propane/app.rb +10 -17
  9. data/lib/propane/helper_methods.rb +6 -6
  10. data/lib/propane/version.rb +1 -1
  11. data/lib/propane-4.0.0.jar +0 -0
  12. data/library/pdf/itextpdf-5.5.13.2.jar +0 -0
  13. data/library/pdf/pdf.rb +7 -0
  14. data/library/slider/slider.rb +1 -1
  15. data/library/svg/batik-all-1.14.jar +0 -0
  16. data/library/svg/svg.rb +7 -0
  17. data/mvnw +3 -3
  18. data/mvnw.cmd +2 -2
  19. data/pom.rb +35 -8
  20. data/pom.xml +60 -9
  21. data/propane.gemspec +9 -7
  22. data/src/main/java/monkstone/ColorUtil.java +1 -1
  23. data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
  24. data/src/main/java/monkstone/MathToolModule.java +31 -31
  25. data/src/main/java/monkstone/PropaneLibrary.java +3 -1
  26. data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
  27. data/src/main/java/monkstone/fastmath/DegLutTables.java +25 -26
  28. data/src/main/java/monkstone/fastmath/Deglut.java +1 -1
  29. data/src/main/java/monkstone/filechooser/Chooser.java +2 -2
  30. data/src/main/java/monkstone/noise/LICENSE +121 -0
  31. data/src/main/java/monkstone/noise/OpenSimplex2F.java +914 -0
  32. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -0
  33. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  34. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  35. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  36. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  37. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  38. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  39. data/src/main/java/monkstone/slider/WheelHandler.java +2 -2
  40. data/src/main/java/monkstone/vecmath/JRender.java +6 -6
  41. data/src/main/java/monkstone/vecmath/package-info.java +1 -1
  42. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +103 -83
  43. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +27 -41
  44. data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
  45. data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
  46. data/src/main/java/monkstone/videoevent/package-info.java +1 -1
  47. data/src/main/java/processing/awt/PGraphicsJava2D.java +11 -4
  48. data/src/main/java/processing/awt/PImageAWT.java +8 -8
  49. data/src/main/java/processing/core/PApplet.java +245 -254
  50. data/src/main/java/processing/core/PConstants.java +155 -163
  51. data/src/main/java/processing/core/PGraphics.java +116 -109
  52. data/src/main/java/processing/core/PImage.java +3025 -3047
  53. data/src/main/java/processing/core/PMatrix.java +5 -2
  54. data/src/main/java/processing/data/DoubleDict.java +72 -43
  55. data/src/main/java/processing/data/DoubleList.java +6 -2
  56. data/src/main/java/processing/data/FloatDict.java +744 -756
  57. data/src/main/java/processing/data/FloatList.java +68 -26
  58. data/src/main/java/processing/data/IntDict.java +72 -45
  59. data/src/main/java/processing/data/IntList.java +63 -26
  60. data/src/main/java/processing/data/JSONArray.java +892 -931
  61. data/src/main/java/processing/data/JSONObject.java +1169 -1262
  62. data/src/main/java/processing/data/JSONTokener.java +30 -49
  63. data/src/main/java/processing/data/LongDict.java +699 -712
  64. data/src/main/java/processing/data/LongList.java +676 -700
  65. data/src/main/java/processing/data/Sort.java +1 -0
  66. data/src/main/java/processing/data/Table.java +4040 -3661
  67. data/src/main/java/processing/data/TableRow.java +16 -0
  68. data/src/main/java/processing/data/XML.java +1041 -956
  69. data/src/main/java/processing/event/TouchEvent.java +1 -1
  70. data/src/main/java/processing/opengl/FontTexture.java +2 -2
  71. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +28 -31
  72. data/src/main/java/processing/opengl/PJOGL.java +8 -7
  73. data/src/main/java/processing/opengl/PShader.java +1 -6
  74. data/src/main/java/processing/opengl/PShapeOpenGL.java +23 -24
  75. data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
  76. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  77. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  78. data/src/main/{java/processing/opengl → resources}/cursors/arrow.png +0 -0
  79. data/src/main/{java/processing/opengl → resources}/cursors/cross.png +0 -0
  80. data/src/main/{java/processing/opengl → resources}/cursors/hand.png +0 -0
  81. data/src/main/{java/processing/opengl → resources}/cursors/license.txt +0 -0
  82. data/src/main/{java/processing/opengl → resources}/cursors/move.png +0 -0
  83. data/src/main/{java/processing/opengl → resources}/cursors/text.png +0 -0
  84. data/src/main/{java/processing/opengl → resources}/cursors/wait.png +0 -0
  85. data/src/main/{java/processing/opengl → resources}/shaders/ColorFrag.glsl +0 -0
  86. data/src/main/{java/processing/opengl → resources}/shaders/ColorVert.glsl +0 -0
  87. data/src/main/{java/processing/opengl → resources}/shaders/LightFrag.glsl +0 -0
  88. data/src/main/{java/processing/opengl → resources}/shaders/LightVert.glsl +0 -0
  89. data/src/main/{java/processing/opengl → resources}/shaders/LineFrag.glsl +0 -0
  90. data/src/main/{java/processing/opengl → resources}/shaders/LineVert.glsl +0 -0
  91. data/src/main/{java/processing/opengl → resources}/shaders/MaskFrag.glsl +0 -0
  92. data/src/main/{java/processing/opengl → resources}/shaders/PointFrag.glsl +0 -0
  93. data/src/main/{java/processing/opengl → resources}/shaders/PointVert.glsl +0 -0
  94. data/src/main/{java/processing/opengl → resources}/shaders/TexFrag.glsl +0 -0
  95. data/src/main/{java/processing/opengl → resources}/shaders/TexLightFrag.glsl +0 -0
  96. data/src/main/{java/processing/opengl → resources}/shaders/TexLightVert.glsl +0 -0
  97. data/src/main/{java/processing/opengl → resources}/shaders/TexVert.glsl +0 -0
  98. data/test/test_helper.rb +1 -0
  99. data/test/vecmath_spec_test.rb +14 -3
  100. data/vendors/Rakefile +1 -1
  101. metadata +53 -53
  102. data/lib/propane-3.8.0.jar +0 -0
  103. data/src/main/java/monkstone/noise/Noise.java +0 -116
  104. data/src/main/java/monkstone/noise/NoiseGenerator.java +0 -63
  105. data/src/main/java/monkstone/noise/NoiseMode.java +0 -15
  106. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -470
  107. data/src/main/java/monkstone/noise/ValueNoise.java +0 -170
@@ -3,7 +3,7 @@
3
3
  /*
4
4
  Part of the Processing project - http://processing.org
5
5
 
6
- Copyright (c) 2012-20 The Processing Foundation
6
+ Copyright (c) 2012-22 The Processing Foundation
7
7
  Copyright (c) 2004-12 Ben Fry and Casey Reas
8
8
  Copyright (c) 2001-04 Massachusetts Institute of Technology
9
9
 
@@ -39,8 +39,8 @@ import java.util.zip.*;
39
39
 
40
40
  // loadXML() error handling
41
41
  import javax.xml.parsers.ParserConfigurationException;
42
- import monkstone.noise.NoiseMode;
43
- import monkstone.noise.Noise;
42
+ // import monkstone.noise.NoiseMode;
43
+ // import monkstone.noise.Noise;
44
44
  import org.xml.sax.SAXException;
45
45
 
46
46
  // TODO have this removed by 4.0 final
@@ -49,9 +49,7 @@ import processing.awt.ShimAWT;
49
49
  import processing.data.*;
50
50
  import processing.event.*;
51
51
  import processing.opengl.*;
52
- import monkstone.noise.NoiseGenerator;
53
- import monkstone.noise.SimplexNoise;
54
- import monkstone.noise.ValueNoise;
52
+ // import monkstone.noise.NoiseGenerator;
55
53
 
56
54
  /**
57
55
  * Base class for all sketches that use processing.core.
@@ -120,8 +118,8 @@ public class PApplet implements PConstants {
120
118
  * For 3.3.5, this defaults to true on all platforms.
121
119
  */
122
120
  static public boolean useNativeSelect = true;
123
-
124
- Noise noiseGenerator = new NoiseGenerator();
121
+
122
+ // Noise noiseGenerator = new NoiseGenerator();
125
123
 
126
124
  /**
127
125
  * The PGraphics renderer associated with this PApplet
@@ -261,13 +259,13 @@ public class PApplet implements PConstants {
261
259
  /**
262
260
  * ( begin auto-generated from pixelWidth.xml )
263
261
  *
264
- * When <b>pixelDensity(2)</d> is used to make use of a high resolution
262
+ * When <b>pixelDensity(2)</b> is used to make use of a high resolution
265
263
  * display (called a Retina display on OS X or high-dpi on Windows and
266
264
  * Linux), the width and height of the sketch do not change, but the number
267
265
  * of pixels is doubled. As a result, all operations that use pixels (like
268
266
  * <b>loadPixels()</b>, <b>get()</b>, <b>set()</b>, etc.) happen in this
269
267
  * doubled space. As a convenience, the variables <b>pixelWidth</b>
270
- * and <b>pixelHeight<b> hold the actual width and height of the sketch in
268
+ * and <b>pixelHeight</b> hold the actual width and height of the sketch in
271
269
  * pixels. This is useful for any sketch that uses the <b>pixels[]</b>
272
270
  * array, for instance, because the number of elements in the array will be
273
271
  * <b>pixelWidth*pixelHeight</b>, not <b>width*height</b>.
@@ -284,13 +282,13 @@ public class PApplet implements PConstants {
284
282
  /**
285
283
  * ( begin auto-generated from pixelHeight.xml )
286
284
  *
287
- * When <b>pixelDensity(2)</d> is used to make use of a high resolution
285
+ * When <b>pixelDensity(2)</b> is used to make use of a high resolution
288
286
  * display (called a Retina display on OS X or high-dpi on Windows and
289
287
  * Linux), the width and height of the sketch do not change, but the number
290
288
  * of pixels is doubled. As a result, all operations that use pixels (like
291
289
  * <b>loadPixels()</b>, <b>get()</b>, <b>set()</b>, etc.) happen in this
292
290
  * doubled space. As a convenience, the variables <b>pixelWidth</b>
293
- * and <b>pixelHeight<b> hold the actual width and height of the sketch in
291
+ * and <b>pixelHeight</b> hold the actual width and height of the sketch in
294
292
  * pixels. This is useful for any sketch that uses the <b>pixels[]</b>
295
293
  * array, for instance, because the number of elements in the array will be
296
294
  * <b>pixelWidth*pixelHeight</b>, not <b>width*height</b>.
@@ -372,8 +370,8 @@ public class PApplet implements PConstants {
372
370
  * <b>draw()</b>). But, inside mouse events, they update each time the event
373
371
  * is called. If they weren't separated, then the mouse would be read only
374
372
  * once per frame, making response choppy. If the mouse variables were
375
- * always updated multiple times per frame, using <NOBR><b>line(pmouseX,
376
- * pmouseY, mouseX, mouseY)</b></NOBR> inside <b>draw()</b> would have lots
373
+ * always updated multiple times per frame, using <b>line(pmouseX,
374
+ * pmouseY, mouseX, mouseY)</b> inside <b>draw()</b> would have lots
377
375
  * of gaps, because <b>pmouseX</b> may have changed several times in between
378
376
  * the calls to <b>line()</b>. Use <b>pmouseX</b> and
379
377
  * <b>pmouseY</b> inside <b>draw()</b> if you want values relative to the
@@ -969,11 +967,10 @@ public class PApplet implements PConstants {
969
967
  *
970
968
  * This function returns the number "2" if the screen is a high-density
971
969
  * screen (called a Retina display on OS X or high-dpi on Windows and Linux)
972
- * and a "1" if not. This information is useful for a program to adapt to
973
- * run at double the pixel density on a screen that supports it.
974
- *
975
- * ( end auto-generated )
970
+ * and a "1" if not.This information is useful for a program to adapt to
971
+ run at double the pixel density on a screen that supports it. ( end auto-generated )
976
972
  *
973
+ * @return
977
974
  * @webref environment
978
975
  * @see PApplet#pixelDensity(int)
979
976
  * @see PApplet#size(int,int)
@@ -1003,6 +1000,7 @@ public class PApplet implements PConstants {
1003
1000
  /**
1004
1001
  * @param display the display number to check (1-indexed to match the
1005
1002
  * Preferences dialog box)
1003
+ * @return
1006
1004
  */
1007
1005
  public int displayDensity(int display) {
1008
1006
  if (!disableAWT) {
@@ -1057,6 +1055,8 @@ public class PApplet implements PConstants {
1057
1055
  /**
1058
1056
  * Called by PSurface objects to set the width and height variables, and
1059
1057
  * update the pixelWidth and pixelHeight variables.
1058
+ * @param width
1059
+ * @param height
1060
1060
  */
1061
1061
  public void setSize(int width, int height) {
1062
1062
  this.width = width;
@@ -1322,7 +1322,7 @@ public class PApplet implements PConstants {
1322
1322
  * <li>resume – called when the sketch is resumed
1323
1323
  * <li>dispose – when the sketch is shutting down (definitely not safe to
1324
1324
  * draw)
1325
- * <ul>
1325
+ * </ul>
1326
1326
  * In addition, the new (for 2.0) processing.event classes are passed to the
1327
1327
  * following event types:
1328
1328
  * <ul>
@@ -1337,17 +1337,19 @@ public class PApplet implements PConstants {
1337
1337
  * @param target the target object that should receive the event
1338
1338
  */
1339
1339
  public void registerMethod(String methodName, Object target) {
1340
- if (methodName.equals("mouseEvent")) {
1341
- registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class});
1342
-
1343
- } else if (methodName.equals("keyEvent")) {
1344
- registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class});
1345
-
1346
- } else if (methodName.equals("touchEvent")) {
1347
- registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class});
1348
-
1349
- } else {
1350
- registerNoArgs(methodName, target);
1340
+ switch (methodName) {
1341
+ case "mouseEvent":
1342
+ registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class});
1343
+ break;
1344
+ case "keyEvent":
1345
+ registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class});
1346
+ break;
1347
+ case "touchEvent":
1348
+ registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class});
1349
+ break;
1350
+ default:
1351
+ registerNoArgs(methodName, target);
1352
+ break;
1351
1353
  }
1352
1354
  }
1353
1355
 
@@ -1683,6 +1685,7 @@ public class PApplet implements PConstants {
1683
1685
  }
1684
1686
 
1685
1687
  /**
1688
+ * @param renderer
1686
1689
  * @param display the screen to run the sketch on (1, 2, 3, etc. or on
1687
1690
  * multiple screens using SPAN)
1688
1691
  */
@@ -1802,6 +1805,10 @@ public class PApplet implements PConstants {
1802
1805
  }
1803
1806
 
1804
1807
  /**
1808
+ * @param width
1809
+ * @param height
1810
+ * @param renderer
1811
+ * @param path
1805
1812
  * @nowebref
1806
1813
  */
1807
1814
  public void size(int width, int height, String renderer, String path) {
@@ -1893,9 +1900,9 @@ public class PApplet implements PConstants {
1893
1900
  * ( begin auto-generated from createGraphics.xml )
1894
1901
  *
1895
1902
  * Creates and returns a new <b>PGraphics</b> object of the types P2D or
1896
- * P3D. Use this class if you need to draw into an off-screen graphics
1897
- * buffer. The PDF renderer requires the filename parameter. The DXF
1898
- * renderer should not be used with <b>createGraphics()</b>, it's only built
1903
+ * P3D.Use this class if you need to draw into an off-screen graphics
1904
+ buffer. The PDF renderer requires the filename parameter. The DXF
1905
+ renderer should not be used with <b>createGraphics()</b>, it's only built
1899
1906
  * for use with <b>beginRaw()</b> and <b>endRaw()</b>.
1900
1907
  *
1901
1908
  * It's important to call any drawing functions between <b>beginDraw()</b>
@@ -1957,6 +1964,7 @@ public class PApplet implements PConstants {
1957
1964
  * <A HREF="http://dev.processing.org/reference/core/javadoc/processing/core/PImage.html#save(java.lang.String)">PImage.save()</A>.
1958
1965
  * </UL>
1959
1966
  *
1967
+ * @return
1960
1968
  * @webref rendering
1961
1969
  * @param w width in pixels
1962
1970
  * @param h height in pixels
@@ -1972,7 +1980,11 @@ public class PApplet implements PConstants {
1972
1980
  * Create an offscreen graphics surface for drawing, in this case for a
1973
1981
  * renderer that writes to a file (such as PDF or DXF).
1974
1982
  *
1983
+ * @param w
1975
1984
  * @param path the name of the file (can be an absolute or relative path)
1985
+ * @param renderer
1986
+ * @param h
1987
+ * @return
1976
1988
  */
1977
1989
  public PGraphics createGraphics(int w, int h,
1978
1990
  String renderer, String path) {
@@ -1995,8 +2007,13 @@ public class PApplet implements PConstants {
1995
2007
  /**
1996
2008
  * Version of createGraphics() used internally.
1997
2009
  *
2010
+ * @param w
2011
+ * @param h
2012
+ * @param renderer
1998
2013
  * @param path A path (or null if none), can be absolute or relative
1999
2014
  * ({@link PApplet#savePath} will be called)
2015
+ * @param primary
2016
+ * @return
2000
2017
  */
2001
2018
  protected PGraphics makeGraphics(int w, int h,
2002
2019
  String renderer, String path,
@@ -2041,7 +2058,7 @@ public class PApplet implements PConstants {
2041
2058
  } catch (InvocationTargetException ite) {
2042
2059
  String msg = ite.getTargetException().getMessage();
2043
2060
  if ((msg != null)
2044
- && (msg.indexOf("no jogl in java.library.path") != -1)) {
2061
+ && (msg.contains("no jogl in java.library.path"))) {
2045
2062
  // Is this true anymore, since the JARs contain the native libs?
2046
2063
  throw new RuntimeException("The jogl library folder needs to be "
2047
2064
  + "specified with -Djava.library.path=/path/to/jogl");
@@ -2071,7 +2088,7 @@ public class PApplet implements PConstants {
2071
2088
  + " renderer is not in the class path.");
2072
2089
  }
2073
2090
 
2074
- } catch (Exception e) {
2091
+ } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException e) {
2075
2092
  if ((e instanceof IllegalArgumentException)
2076
2093
  || (e instanceof NoSuchMethodException)
2077
2094
  || (e instanceof IllegalAccessException)) {
@@ -2101,6 +2118,7 @@ public class PApplet implements PConstants {
2101
2118
  /**
2102
2119
  * Create default renderer, likely to be resized, but needed for surface
2103
2120
  * init.
2121
+ * @return
2104
2122
  */
2105
2123
  protected PGraphics createPrimaryGraphics() {
2106
2124
  return makeGraphics(sketchWidth(), sketchHeight(),
@@ -2110,9 +2128,9 @@ public class PApplet implements PConstants {
2110
2128
  /**
2111
2129
  * ( begin auto-generated from createImage.xml )
2112
2130
  *
2113
- * Creates a new PImage (the datatype for storing images). This provides a
2114
- * fresh buffer of pixels to play with. Set the size of the buffer with the
2115
- * <b>width</b> and <b>height</b> parameters. The <b>format</b> parameter
2131
+ * Creates a new PImage (the datatype for storing images).This provides a
2132
+ fresh buffer of pixels to play with. Set the size of the buffer with the
2133
+ <b>width</b> and <b>height</b> parameters. The <b>format</b> parameter
2116
2134
  * defines how the pixels are stored. See the PImage reference for more
2117
2135
  * information.
2118
2136
  *
@@ -2128,6 +2146,7 @@ public class PApplet implements PConstants {
2128
2146
  * to the parent PApplet is included, which makes save() work without
2129
2147
  * needing an absolute path.
2130
2148
  *
2149
+ * @return
2131
2150
  * @webref image
2132
2151
  * @param w width in pixels
2133
2152
  * @param h height in pixels
@@ -2386,6 +2405,7 @@ public class PApplet implements PConstants {
2386
2405
  /**
2387
2406
  * Add an event to the internal event queue, or process it immediately if
2388
2407
  * the sketch is not currently looping.
2408
+ * @param pe
2389
2409
  */
2390
2410
  public void postEvent(processing.event.Event pe) {
2391
2411
  eventQueue.add(pe);
@@ -2933,16 +2953,15 @@ public class PApplet implements PConstants {
2933
2953
  * ( begin auto-generated from millis.xml )
2934
2954
  *
2935
2955
  * Returns the number of milliseconds (thousandths of a second) since
2936
- * starting an applet. This information is often used for timing animation
2937
- * sequences.
2938
- *
2939
- * ( end auto-generated )
2940
- *
2941
- * <h3>Advanced</h3>
2956
+ * starting an applet.This information is often used for timing animation
2957
+ sequences. ( end auto-generated )
2958
+
2959
+ <h3>Advanced</h3>
2942
2960
  * <p>
2943
2961
  * This is a function, rather than a variable, because it may change
2944
2962
  * multiple times per frame.
2945
2963
  *
2964
+ * @return
2946
2965
  * @webref input:time_date
2947
2966
  * @see PApplet#second()
2948
2967
  * @see PApplet#minute()
@@ -2959,12 +2978,11 @@ public class PApplet implements PConstants {
2959
2978
  /**
2960
2979
  * ( begin auto-generated from second.xml )
2961
2980
  *
2962
- * Processing communicates with the clock on your computer. The
2963
- * <b>second()</b> function returns the current second as a value from 0 -
2964
- * 59.
2965
- *
2966
- * ( end auto-generated )
2981
+ * Processing communicates with the clock on your computer.The
2982
+ <b>second()</b> function returns the current second as a value from 0 -
2983
+ 59. ( end auto-generated )
2967
2984
  *
2985
+ * @return
2968
2986
  * @webref input:time_date
2969
2987
  * @see PApplet#millis()
2970
2988
  * @see PApplet#minute()
@@ -2972,7 +2990,7 @@ public class PApplet implements PConstants {
2972
2990
  * @see PApplet#day()
2973
2991
  * @see PApplet#month()
2974
2992
  * @see PApplet#year()
2975
- *
2993
+ *
2976
2994
  */
2977
2995
  static public int second() {
2978
2996
  return Calendar.getInstance().get(Calendar.SECOND);
@@ -2981,12 +2999,11 @@ public class PApplet implements PConstants {
2981
2999
  /**
2982
3000
  * ( begin auto-generated from minute.xml )
2983
3001
  *
2984
- * Processing communicates with the clock on your computer. The
2985
- * <b>minute()</b> function returns the current minute as a value from 0 -
2986
- * 59.
2987
- *
2988
- * ( end auto-generated )
3002
+ * Processing communicates with the clock on your computer.The
3003
+ <b>minute()</b> function returns the current minute as a value from 0 -
3004
+ 59. ( end auto-generated )
2989
3005
  *
3006
+ * @return
2990
3007
  * @webref input:time_date
2991
3008
  * @see PApplet#millis()
2992
3009
  * @see PApplet#second()
@@ -3004,11 +3021,10 @@ public class PApplet implements PConstants {
3004
3021
  /**
3005
3022
  * ( begin auto-generated from hour.xml )
3006
3023
  *
3007
- * Processing communicates with the clock on your computer. The
3008
- * <b>hour()</b> function returns the current hour as a value from 0 - 23.
3009
- *
3010
- * ( end auto-generated )
3024
+ * Processing communicates with the clock on your computer.The
3025
+ <b>hour()</b> function returns the current hour as a value from 0 - 23. ( end auto-generated )
3011
3026
  *
3027
+ * @return
3012
3028
  * @webref input:time_date
3013
3029
  * @see PApplet#millis()
3014
3030
  * @see PApplet#second()
@@ -3050,11 +3066,10 @@ public class PApplet implements PConstants {
3050
3066
  /**
3051
3067
  * ( begin auto-generated from month.xml )
3052
3068
  *
3053
- * Processing communicates with the clock on your computer. The
3054
- * <b>month()</b> function returns the current month as a value from 1 - 12.
3055
- *
3056
- * ( end auto-generated )
3069
+ * Processing communicates with the clock on your computer.The
3070
+ <b>month()</b> function returns the current month as a value from 1 - 12. ( end auto-generated )
3057
3071
  *
3072
+ * @return
3058
3073
  * @webref input:time_date
3059
3074
  * @see PApplet#millis()
3060
3075
  * @see PApplet#second()
@@ -3177,14 +3192,14 @@ public class PApplet implements PConstants {
3177
3192
  /**
3178
3193
  * ( begin auto-generated from launch.xml )
3179
3194
  *
3180
- * Attempts to open an application or file using your platform's launcher.
3181
- * The <b>file</b> parameter is a String specifying the file name and
3182
- * location. The location parameter must be a full path name, or the name of
3183
- * an executable in the system's PATH. In most cases, using a full path is
3184
- * the best option, rather than relying on the system PATH. Be sure to make
3185
- * the file executable before attempting to open it (chmod +x).
3186
- *
3187
- * The <b>args</b> parameter is a String or String array which is passed to
3195
+ * Attempts to open an application or file using your platform's launcher.The <b>file</b> parameter is a String specifying the file name and
3196
+ location.
3197
+ * The location parameter must be a full path name, or the name of
3198
+ an executable in the system's PATH. In most cases, using a full path is
3199
+ the best option, rather than relying on the system PATH. Be sure to make
3200
+ the file executable before attempting to open it (chmod +x).
3201
+
3202
+ The <b>args</b> parameter is a String or String array which is passed to
3188
3203
  * the command line. If you have multiple parameters, e.g. an application
3189
3204
  * and a document, or a command with multiple switches, use the version that
3190
3205
  * takes a String array, and place each individual item in a separate
@@ -3209,6 +3224,7 @@ public class PApplet implements PConstants {
3209
3224
  *
3210
3225
  * ( end auto-generated )
3211
3226
  *
3227
+ * @return
3212
3228
  * @webref input:files
3213
3229
  * @param args arguments to the launcher, eg. a filename.
3214
3230
  * @usage Application
@@ -3216,42 +3232,44 @@ public class PApplet implements PConstants {
3216
3232
  static public Process launch(String... args) {
3217
3233
  String[] params = null;
3218
3234
 
3219
- if (platform == WINDOWS) {
3220
- // just launching the .html file via the shell works
3221
- // but make sure to chmod +x the .html files first
3222
- // also place quotes around it in case there's a space
3223
- // in the user.dir part of the url
3224
- params = new String[]{"cmd", "/c"};
3225
-
3226
- } else if (platform == MACOS) {
3227
- params = new String[]{"open"};
3228
-
3229
- } else if (platform == LINUX) {
3230
- // xdg-open is in the Free Desktop Specification and really should just
3231
- // work on desktop Linux. Not risking it though.
3232
- final String[] launchers = {"xdg-open", "gnome-open", "kde-open"};
3233
- for (String launcher : launchers) {
3234
- if (openLauncher != null) {
3235
- break;
3236
- }
3237
- try {
3238
- Process p = Runtime.getRuntime().exec(new String[]{launcher});
3239
- /*int result =*/ p.waitFor();
3240
- // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
3241
- openLauncher = launcher;
3242
- } catch (Exception e) {
3235
+ switch (platform) {
3236
+ case WINDOWS:
3237
+ // just launching the .html file via the shell works
3238
+ // but make sure to chmod +x the .html files first
3239
+ // also place quotes around it in case there's a space
3240
+ // in the user.dir part of the url
3241
+ params = new String[]{"cmd", "/c"};
3242
+ break;
3243
+ case MACOS:
3244
+ params = new String[]{"open"};
3245
+ break;
3246
+ case LINUX:
3247
+ // xdg-open is in the Free Desktop Specification and really should just
3248
+ // work on desktop Linux. Not risking it though.
3249
+ final String[] launchers = {"xdg-open", "gnome-open", "kde-open"};
3250
+ for (String launcher : launchers) {
3251
+ if (openLauncher != null) {
3252
+ break;
3253
+ }
3254
+ try {
3255
+ Process p = Runtime.getRuntime().exec(new String[]{launcher});
3256
+ /*int result =*/ p.waitFor();
3257
+ // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
3258
+ openLauncher = launcher;
3259
+ } catch (Exception e) {
3260
+ }
3261
+ } if (openLauncher == null) {
3262
+ System.err.println("Could not find xdg-open, gnome-open, or kde-open: "
3263
+ + "the open() command may not work.");
3264
+ } if (openLauncher != null) {
3265
+ params = new String[]{openLauncher};
3243
3266
  }
3244
- }
3245
- if (openLauncher == null) {
3246
- System.err.println("Could not find xdg-open, gnome-open, or kde-open: "
3247
- + "the open() command may not work.");
3248
- }
3249
- if (openLauncher != null) {
3250
- params = new String[]{openLauncher};
3251
- }
3252
- //} else { // give up and just pass it to Runtime.exec()
3253
- //open(new String[] { filename });
3254
- //params = new String[] { filename };
3267
+ //} else { // give up and just pass it to Runtime.exec()
3268
+ //open(new String[] { filename });
3269
+ //params = new String[] { filename };
3270
+ break;
3271
+ default:
3272
+ break;
3255
3273
  }
3256
3274
  if (params != null) {
3257
3275
  // If the 'open', 'gnome-open' or 'cmd' are already included
@@ -3990,9 +4008,10 @@ public class PApplet implements PConstants {
3990
4008
  }
3991
4009
  */
3992
4010
  /**
3993
- * For arrays, use printArray() instead. This function causes a warning
4011
+ * For arrays, use printArray() instead.This function causes a warning
3994
4012
  * because the new print(Object...) and println(Object...) functions can't
3995
4013
  * be reliably bound by the compiler.
4014
+ * @param what
3996
4015
  */
3997
4016
  static public void println(Object what) {
3998
4017
  if (what == null) {
@@ -4905,111 +4924,101 @@ public class PApplet implements PConstants {
4905
4924
  * @see PApplet#noise(float, float, float)
4906
4925
  * @see PApplet#noiseSeed(long)
4907
4926
  */
4908
- public final void randomSeed(long seed) {
4909
- if (internalRandom == null) {
4910
- internalRandom = new Random();
4911
- }
4912
- internalRandom.setSeed(seed);
4913
- }
4914
-
4915
- public void noiseMode(NoiseMode mode){
4916
- noiseGenerator.noiseMode(mode);
4917
- }
4918
-
4919
- /**
4920
- */
4921
- public float noise(float x) {
4922
- return noiseGenerator.noise(x);
4923
- }
4924
-
4925
- /**
4926
- */
4927
- public float noise(float x, float y) {
4928
- return noiseGenerator.noise(x, y);
4929
- }
4930
-
4931
- /**
4932
- * ( begin auto-generated from noise.xml )
4933
- *
4934
- * Returns the Perlin noise value at specified coordinates. Perlin noise is
4935
- * a random sequence generator producing a more natural ordered, harmonic
4936
- * succession of numbers compared to the standard <b>random()</b> function.
4937
- * It was invented by Ken Perlin in the 1980s and been used since in
4938
- * graphical applications to produce procedural textures, natural motion,
4939
- * shapes, terrains etc. The main difference to the
4940
- * <b>random()</b> function is that Perlin noise is defined in an infinite
4941
- * n-dimensional space where each pair of coordinates corresponds to a fixed
4942
- * semi-random value (fixed only for the lifespan of the program). The
4943
- * resulting value will always be between 0.0 and 1.0. Processing can
4944
- * compute 1D, 2D and 3D noise, depending on the number of coordinates
4945
- * given. The noise value can be animated by moving through the noise space
4946
- * as demonstrated in the example above. The 2nd and 3rd dimension can also
4947
- * be interpreted as time.The actual noise is structured similar to an audio
4948
- * signal, in respect to the function's use of frequencies. Similar to the
4949
- * concept of harmonics in physics, perlin noise is computed over several
4950
- * octaves which are added together for the final result. Another way to
4951
- * adjust the character of the resulting sequence is the scale of the input
4952
- * coordinates. As the function works within an infinite space the value of
4953
- * the coordinates doesn't matter as such, only the distance between
4954
- * successive coordinates does (eg. when using <b>noise()</b> within a
4955
- * loop). As a general rule the smaller the difference between coordinates,
4956
- * the smoother the resulting noise sequence will be. Steps of 0.005-0.03
4957
- * work best for most applications, but this will differ depending on use.
4958
- *
4959
- * ( end auto-generated )
4960
- *
4961
- * @webref math:random
4962
- * @param x x-coordinate in noise space
4963
- * @param y y-coordinate in noise space
4964
- * @param z z-coordinate in noise space
4965
- * @see PApplet#noiseSeed(long)
4966
- * @see PApplet#noiseDetail(int, float)
4967
- * @see PApplet#random(float,float)
4968
- */
4969
- public float noise(float x, float y, float z) {
4970
- return noiseGenerator.noise(x, y, z);
4971
- }
4972
-
4973
-
4974
-
4975
- // [toxi 040903]
4976
- // make perlin noise quality user controlled to allow
4977
- // for different levels of detail. lower values will produce
4978
- // smoother results as higher octaves are surpressed
4979
- /**
4980
- * ( begin auto-generated from noiseDetail.xml )
4981
- *
4982
- * Adjusts the character and level of detail produced by the Perlin noise
4983
- * function. Similar to harmonics in physics, noise is computed over several
4984
- * octaves. Lower octaves contribute more to the output signal and as such
4985
- * define the overal intensity of the noise, whereas higher octaves create
4986
- * finer grained details in the noise sequence. By default, noise is
4987
- * computed over 4 octaves with each octave contributing exactly half than
4988
- * its predecessor, starting at 50% strength for the 1st octave. This
4989
- * falloff amount can be changed by adding an additional function parameter.
4990
- * Eg. a falloff factor of 0.75 means each octave will now have 75% impact
4991
- * (25% less) of the previous lower octave. Any value between 0.0 and 1.0 is
4992
- * valid, however note that values greater than 0.5 might result in greater
4993
- * than 1.0 values returned by <b>noise()</b>.<br
4994
- * />By changing these parameters, the signal created by the <b>noise()</b>
4995
- * function can be adapted to fit very specific needs and characteristics.
4996
- *
4997
- * ( end auto-generated )
4998
- *
4999
- * @webref math:random
5000
- * @param lod number of octaves to be used by the noise
5001
- * @see PApplet#noise(float, float, float)
4927
+ // public final void randomSeed(long seed) {
4928
+ // if (internalRandom == null) {
4929
+ // internalRandom = new Random();
4930
+ // }
4931
+ // internalRandom.setSeed(seed);
4932
+ // }
4933
+ //
4934
+ // public void noiseMode(NoiseMode mode) {
4935
+ // noiseGenerator.noiseMode(mode);
4936
+ // }
4937
+ //
4938
+ // /**
4939
+ // * @param x
4940
+ // * @return
4941
+ // */
4942
+ // public float noise(float x) {
4943
+ // return noiseGenerator.noise(x);
4944
+ // }
4945
+ //
4946
+ // /**
4947
+ // * @param x
4948
+ // * @param y
4949
+ // * @return
4950
+ // */
4951
+ // public float noise(float x, float y) {
4952
+ // return noiseGenerator.noise(x, y);
4953
+ // }
4954
+ //
4955
+ // /**
4956
+ // * ( begin auto-generated from noise.xml )
4957
+ // *
4958
+ // * Returns the Perlin noise value at specified coordinates. Perlin noise is
4959
+ // * a random sequence generator producing a more natural ordered, harmonic
4960
+ // * succession of numbers compared to the standard <b>random()</b> function.
4961
+ // * It was invented by Ken Perlin in the 1980s and been used since in
4962
+ // * graphical applications to produce procedural textures, natural motion,
4963
+ // * shapes, terrains etc. The main difference to the
4964
+ // * <b>random()</b> function is that Perlin noise is defined in an infinite
4965
+ // * n-dimensional space where each pair of coordinates corresponds to a fixed
4966
+ // * semi-random value (fixed only for the lifespan of the program). The
4967
+ // * resulting value will always be between 0.0 and 1.0. Processing can
4968
+ // * compute 1D, 2D and 3D noise, depending on the number of coordinates
4969
+ // * given. The noise value can be animated by moving through the noise space
4970
+ // * as demonstrated in the example above. The 2nd and 3rd dimension can also
4971
+ // * be interpreted as time.The actual noise is structured similar to an audio
4972
+ // * signal, in respect to the function's use of frequencies. Similar to the
4973
+ // * concept of harmonics in physics, perlin noise is computed over several
4974
+ // * octaves which are added together for the final result. Another way to
4975
+ // * adjust the character of the resulting sequence is the scale of the input
4976
+ // * coordinates. As the function works within an infinite space the value of
4977
+ // * the coordinates doesn't matter as such, only the distance between
4978
+ // * successive coordinates does (eg. when using <b>noise()</b> within a
4979
+ // * loop). As a general rule the smaller the difference between coordinates,
4980
+ // * the smoother the resulting noise sequence will be. Steps of 0.005-0.03
4981
+ // * work best for most applications, but this will differ depending on use.
4982
+ // *
4983
+ // * ( end auto-generated )
4984
+ // *
4985
+ // * @webref math:random
4986
+ // * @param x x-coordinate in noise space
4987
+ // * @param y y-coordinate in noise space
4988
+ // * @param z z-coordinate in noise space
4989
+ // */
4990
+ // public float noise(float x, float y, float z) {
4991
+ // return noiseGenerator.noise(x, y, z);
4992
+ // }
4993
+ // /**
4994
+ // * 4D noise where typically w is time
4995
+ // * @param x
4996
+ // * @param y
4997
+ // * @param z
4998
+ // * @param w
4999
+ // * @return
5000
+ // */
5001
+ // public float noise(float x, float y, float z, float w) {
5002
+ // return noiseGenerator.noise(x, y, z, w);
5003
+ // }
5004
+
5005
+ /**
5006
+ *
5007
+ * @param lod
5008
+ * @deprecated
5002
5009
  */
5010
+ @Deprecated
5003
5011
  public void noiseDetail(int lod) {
5004
- noiseGenerator.noiseDetail(lod);
5005
5012
  }
5006
5013
 
5007
5014
  /**
5008
- * @see #noiseDetail(int)
5009
- * @param falloff falloff factor for each octave
5015
+ *
5016
+ * @param lod
5017
+ * @param falloff
5018
+ * @deprecated
5010
5019
  */
5020
+ @Deprecated
5011
5021
  public void noiseDetail(int lod, float falloff) {
5012
- noiseGenerator.noiseDetail(lod, falloff);
5013
5022
  }
5014
5023
 
5015
5024
  /**
@@ -5029,10 +5038,9 @@ public class PApplet implements PConstants {
5029
5038
  * @see PApplet#random(float,float)
5030
5039
  * @see PApplet#randomSeed(long)
5031
5040
  */
5032
-
5033
- public void noiseSeed(long seed) {
5034
- noiseGenerator.noiseSeed(seed);
5035
- }
5041
+ // public void noiseSeed(long seed) {
5042
+ // noiseGenerator.noiseSeed(seed);
5043
+ // }
5036
5044
 
5037
5045
  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5038
5046
  /**
@@ -6783,7 +6791,6 @@ public class PApplet implements PConstants {
6783
6791
  return new BufferedOutputStream(output);
6784
6792
 
6785
6793
  } catch (IOException e) {
6786
- e.printStackTrace();
6787
6794
  }
6788
6795
  return null;
6789
6796
  }
@@ -6860,12 +6867,13 @@ public class PApplet implements PConstants {
6860
6867
  System.err.println("Could not rename temporary file " + tempFile);
6861
6868
  }
6862
6869
  }
6863
- e.printStackTrace();
6864
6870
  return false;
6865
6871
  }
6866
6872
  }
6867
6873
 
6868
6874
  /**
6875
+ * @param target
6876
+ * @param source
6869
6877
  * @nowebref
6870
6878
  */
6871
6879
  static public void saveStream(OutputStream target,
@@ -6975,11 +6983,12 @@ public class PApplet implements PConstants {
6975
6983
  System.err.println("Could not delete temporary file " + tempFile);
6976
6984
  }
6977
6985
  }
6978
- e.printStackTrace();
6979
6986
  }
6980
6987
  }
6981
6988
 
6982
6989
  /**
6990
+ * @param output
6991
+ * @param data
6983
6992
  * @nowebref Spews a buffer of bytes to an OutputStream.
6984
6993
  */
6985
6994
  static public void saveBytes(OutputStream output, byte[] data) {
@@ -6988,7 +6997,6 @@ public class PApplet implements PConstants {
6988
6997
  output.flush();
6989
6998
 
6990
6999
  } catch (IOException e) {
6991
- e.printStackTrace();
6992
7000
  }
6993
7001
  }
6994
7002
 
@@ -7033,15 +7041,17 @@ public class PApplet implements PConstants {
7033
7041
  }
7034
7042
 
7035
7043
  /**
7044
+ * @param output
7045
+ * @param data
7036
7046
  * @nowebref
7037
7047
  */
7038
7048
  static public void saveStrings(OutputStream output, String[] data) {
7039
- PrintWriter writer = createWriter(output);
7040
- for (int i = 0; i < data.length; i++) {
7041
- writer.println(data[i]);
7049
+ try ( PrintWriter writer = createWriter(output)) {
7050
+ for (String data1 : data) {
7051
+ writer.println(data1);
7052
+ }
7053
+ writer.flush();
7042
7054
  }
7043
- writer.flush();
7044
- writer.close();
7045
7055
  }
7046
7056
 
7047
7057
  //////////////////////////////////////////////////////////////
@@ -7133,7 +7143,7 @@ public class PApplet implements PConstants {
7133
7143
  * from a server, or marked in-use if running from a local file system. With
7134
7144
  * this in mind, saving to the data path doesn't make sense anyway. If you
7135
7145
  * know you're running locally, and want to save to the data folder, use
7136
- * <TT>saveXxxx("data/blah.dat")</TT>.
7146
+ * <code>saveXxxx("data/blah.dat")</code>.
7137
7147
  */
7138
7148
  public String savePath(String where) {
7139
7149
  if (where == null) {
@@ -7421,45 +7431,19 @@ public class PApplet implements PConstants {
7421
7431
  System.arraycopy(src, 0, dst, 0, Array.getLength(src));
7422
7432
  }
7423
7433
 
7424
- /**
7425
- * Use arrayCopy() instead.
7426
- */
7427
- @Deprecated
7428
- static public void arraycopy(Object src, int srcPosition,
7429
- Object dst, int dstPosition,
7430
- int length) {
7431
- System.arraycopy(src, srcPosition, dst, dstPosition, length);
7432
- }
7433
-
7434
- /**
7435
- * Use arrayCopy() instead.
7436
- */
7437
- @Deprecated
7438
- static public void arraycopy(Object src, Object dst, int length) {
7439
- System.arraycopy(src, 0, dst, 0, length);
7440
- }
7441
-
7442
- /**
7443
- * Use arrayCopy() instead.
7444
- */
7445
- @Deprecated
7446
- static public void arraycopy(Object src, Object dst) {
7447
- System.arraycopy(src, 0, dst, 0, Array.getLength(src));
7448
- }
7449
-
7450
7434
  /**
7451
7435
  * ( begin auto-generated from expand.xml )
7452
7436
  *
7453
- * Increases the size of an array. By default, this function doubles the
7454
- * size of the array, but the optional <b>newSize</b> parameter provides
7455
- * precise control over the increase in size.
7456
- *
7457
- * When using an array of objects, the data returned from the function must
7458
- * be cast to the object array's data type. For example: <em>SomeClass[]
7459
- * items = (SomeClass[]) expand(originalArray)</em>.
7437
+ * Increases the size of an array.By default, this function doubles the size
7438
+ * of the array, but the optional <b>newSize</b> parameter provides precise
7439
+ * control over the increase in size. When using an array of objects, the
7440
+ * data returned from the function must be cast to the object array's data
7441
+ * type. For example: <em>SomeClass[] items = (SomeClass[])
7442
+ * expand(originalArray)</em>.
7460
7443
  *
7461
7444
  * ( end auto-generated )
7462
7445
  *
7446
+ * @return
7463
7447
  * @webref data:array_functions
7464
7448
  * @param list the array to expand
7465
7449
  * @see PApplet#shorten(boolean[])
@@ -7469,7 +7453,9 @@ public class PApplet implements PConstants {
7469
7453
  }
7470
7454
 
7471
7455
  /**
7456
+ * @param list
7472
7457
  * @param newSize new size for the array
7458
+ * @return
7473
7459
  */
7474
7460
  static public boolean[] expand(boolean[] list, int newSize) {
7475
7461
  boolean[] temp = new boolean[newSize];
@@ -7549,6 +7535,7 @@ public class PApplet implements PConstants {
7549
7535
  }
7550
7536
 
7551
7537
  /**
7538
+ * @param array
7552
7539
  * @nowebref
7553
7540
  */
7554
7541
  static public Object expand(Object array) {
@@ -9671,6 +9658,7 @@ public class PApplet implements PConstants {
9671
9658
  * All parameters *after* the sketch class name are passed to the sketch
9672
9659
  * itself and available from its 'args' array while the sketch is running.
9673
9660
  *
9661
+ * @param args
9674
9662
  * @see PApplet#args
9675
9663
  * </PRE>
9676
9664
  */
@@ -9681,6 +9669,8 @@ public class PApplet implements PConstants {
9681
9669
  /**
9682
9670
  * Convenience method so that PApplet.main(YourSketch.class) launches a
9683
9671
  * sketch, rather than having to call getName() on it.
9672
+ * @param mainClass
9673
+ * @param args
9684
9674
  */
9685
9675
  static public void main(final Class<?> mainClass, String... args) {
9686
9676
  main(mainClass.getName(), args);
@@ -14628,7 +14618,8 @@ public class PApplet implements PConstants {
14628
14618
  * function is easy to use and undestand, but is slower than another
14629
14619
  * technique. To achieve the same results when working in <b>colorMode(RGB,
14630
14620
  * 255)</b>, but with greater speed, use the &gt;&gt; (right shift) operator
14631
- * with a bit mask. For example, the following two lines of code are equivalent:
14621
+ * with a bit mask. For example, the following two lines of code are
14622
+ * equivalent:
14632
14623
  * <pre>float r1 = green(myColor);float r2 =
14633
14624
  * myColor &gt;&gt; 8 &amp; 0xFF;</pre>
14634
14625
  *
@@ -14659,7 +14650,7 @@ public class PApplet implements PConstants {
14659
14650
  * technique. To achieve the same results when working in <b>colorMode(RGB,
14660
14651
  * 255)</b>, but with greater speed, use a bit mask to remove the other
14661
14652
  * color components. For example, the following two lines of code are
14662
- * equivalent:
14653
+ * equivalent:
14663
14654
  * <pre>float r1 = blue(myColor);float r2 = myColor
14664
14655
  * &amp; 0xFF;</pre>
14665
14656
  *