propane 3.8.0-java → 3.9.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,8 +50,6 @@ import processing.data.*;
50
50
  import processing.event.*;
51
51
  import processing.opengl.*;
52
52
  import monkstone.noise.NoiseGenerator;
53
- import monkstone.noise.SimplexNoise;
54
- import monkstone.noise.ValueNoise;
55
53
 
56
54
  /**
57
55
  * Base class for all sketches that use processing.core.
@@ -120,7 +118,7 @@ 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
-
121
+
124
122
  Noise noiseGenerator = new NoiseGenerator();
125
123
 
126
124
  /**
@@ -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>
@@ -1683,6 +1683,7 @@ public class PApplet implements PConstants {
1683
1683
  }
1684
1684
 
1685
1685
  /**
1686
+ * @param renderer
1686
1687
  * @param display the screen to run the sketch on (1, 2, 3, etc. or on
1687
1688
  * multiple screens using SPAN)
1688
1689
  */
@@ -1802,6 +1803,10 @@ public class PApplet implements PConstants {
1802
1803
  }
1803
1804
 
1804
1805
  /**
1806
+ * @param width
1807
+ * @param height
1808
+ * @param renderer
1809
+ * @param path
1805
1810
  * @nowebref
1806
1811
  */
1807
1812
  public void size(int width, int height, String renderer, String path) {
@@ -1893,9 +1898,9 @@ public class PApplet implements PConstants {
1893
1898
  * ( begin auto-generated from createGraphics.xml )
1894
1899
  *
1895
1900
  * 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
1901
+ * P3D.Use this class if you need to draw into an off-screen graphics
1902
+ buffer. The PDF renderer requires the filename parameter. The DXF
1903
+ renderer should not be used with <b>createGraphics()</b>, it's only built
1899
1904
  * for use with <b>beginRaw()</b> and <b>endRaw()</b>.
1900
1905
  *
1901
1906
  * It's important to call any drawing functions between <b>beginDraw()</b>
@@ -1957,6 +1962,7 @@ public class PApplet implements PConstants {
1957
1962
  * <A HREF="http://dev.processing.org/reference/core/javadoc/processing/core/PImage.html#save(java.lang.String)">PImage.save()</A>.
1958
1963
  * </UL>
1959
1964
  *
1965
+ * @return
1960
1966
  * @webref rendering
1961
1967
  * @param w width in pixels
1962
1968
  * @param h height in pixels
@@ -1972,7 +1978,11 @@ public class PApplet implements PConstants {
1972
1978
  * Create an offscreen graphics surface for drawing, in this case for a
1973
1979
  * renderer that writes to a file (such as PDF or DXF).
1974
1980
  *
1981
+ * @param w
1975
1982
  * @param path the name of the file (can be an absolute or relative path)
1983
+ * @param renderer
1984
+ * @param h
1985
+ * @return
1976
1986
  */
1977
1987
  public PGraphics createGraphics(int w, int h,
1978
1988
  String renderer, String path) {
@@ -1995,8 +2005,13 @@ public class PApplet implements PConstants {
1995
2005
  /**
1996
2006
  * Version of createGraphics() used internally.
1997
2007
  *
2008
+ * @param w
2009
+ * @param h
2010
+ * @param renderer
1998
2011
  * @param path A path (or null if none), can be absolute or relative
1999
2012
  * ({@link PApplet#savePath} will be called)
2013
+ * @param primary
2014
+ * @return
2000
2015
  */
2001
2016
  protected PGraphics makeGraphics(int w, int h,
2002
2017
  String renderer, String path,
@@ -2041,7 +2056,7 @@ public class PApplet implements PConstants {
2041
2056
  } catch (InvocationTargetException ite) {
2042
2057
  String msg = ite.getTargetException().getMessage();
2043
2058
  if ((msg != null)
2044
- && (msg.indexOf("no jogl in java.library.path") != -1)) {
2059
+ && (msg.contains("no jogl in java.library.path"))) {
2045
2060
  // Is this true anymore, since the JARs contain the native libs?
2046
2061
  throw new RuntimeException("The jogl library folder needs to be "
2047
2062
  + "specified with -Djava.library.path=/path/to/jogl");
@@ -2933,16 +2948,15 @@ public class PApplet implements PConstants {
2933
2948
  * ( begin auto-generated from millis.xml )
2934
2949
  *
2935
2950
  * 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>
2951
+ * starting an applet.This information is often used for timing animation
2952
+ sequences. ( end auto-generated )
2953
+
2954
+ <h3>Advanced</h3>
2942
2955
  * <p>
2943
2956
  * This is a function, rather than a variable, because it may change
2944
2957
  * multiple times per frame.
2945
2958
  *
2959
+ * @return
2946
2960
  * @webref input:time_date
2947
2961
  * @see PApplet#second()
2948
2962
  * @see PApplet#minute()
@@ -2959,12 +2973,11 @@ public class PApplet implements PConstants {
2959
2973
  /**
2960
2974
  * ( begin auto-generated from second.xml )
2961
2975
  *
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 )
2976
+ * Processing communicates with the clock on your computer.The
2977
+ <b>second()</b> function returns the current second as a value from 0 -
2978
+ 59. ( end auto-generated )
2967
2979
  *
2980
+ * @return
2968
2981
  * @webref input:time_date
2969
2982
  * @see PApplet#millis()
2970
2983
  * @see PApplet#minute()
@@ -2972,7 +2985,7 @@ public class PApplet implements PConstants {
2972
2985
  * @see PApplet#day()
2973
2986
  * @see PApplet#month()
2974
2987
  * @see PApplet#year()
2975
- *
2988
+ *
2976
2989
  */
2977
2990
  static public int second() {
2978
2991
  return Calendar.getInstance().get(Calendar.SECOND);
@@ -2981,12 +2994,11 @@ public class PApplet implements PConstants {
2981
2994
  /**
2982
2995
  * ( begin auto-generated from minute.xml )
2983
2996
  *
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 )
2997
+ * Processing communicates with the clock on your computer.The
2998
+ <b>minute()</b> function returns the current minute as a value from 0 -
2999
+ 59. ( end auto-generated )
2989
3000
  *
3001
+ * @return
2990
3002
  * @webref input:time_date
2991
3003
  * @see PApplet#millis()
2992
3004
  * @see PApplet#second()
@@ -3004,11 +3016,10 @@ public class PApplet implements PConstants {
3004
3016
  /**
3005
3017
  * ( begin auto-generated from hour.xml )
3006
3018
  *
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 )
3019
+ * Processing communicates with the clock on your computer.The
3020
+ <b>hour()</b> function returns the current hour as a value from 0 - 23. ( end auto-generated )
3011
3021
  *
3022
+ * @return
3012
3023
  * @webref input:time_date
3013
3024
  * @see PApplet#millis()
3014
3025
  * @see PApplet#second()
@@ -3050,11 +3061,10 @@ public class PApplet implements PConstants {
3050
3061
  /**
3051
3062
  * ( begin auto-generated from month.xml )
3052
3063
  *
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 )
3064
+ * Processing communicates with the clock on your computer.The
3065
+ <b>month()</b> function returns the current month as a value from 1 - 12. ( end auto-generated )
3057
3066
  *
3067
+ * @return
3058
3068
  * @webref input:time_date
3059
3069
  * @see PApplet#millis()
3060
3070
  * @see PApplet#second()
@@ -3990,9 +4000,10 @@ public class PApplet implements PConstants {
3990
4000
  }
3991
4001
  */
3992
4002
  /**
3993
- * For arrays, use printArray() instead. This function causes a warning
4003
+ * For arrays, use printArray() instead.This function causes a warning
3994
4004
  * because the new print(Object...) and println(Object...) functions can't
3995
4005
  * be reliably bound by the compiler.
4006
+ * @param what
3996
4007
  */
3997
4008
  static public void println(Object what) {
3998
4009
  if (what == null) {
@@ -4911,21 +4922,26 @@ public class PApplet implements PConstants {
4911
4922
  }
4912
4923
  internalRandom.setSeed(seed);
4913
4924
  }
4914
-
4915
- public void noiseMode(NoiseMode mode){
4925
+
4926
+ public void noiseMode(NoiseMode mode) {
4916
4927
  noiseGenerator.noiseMode(mode);
4917
4928
  }
4918
4929
 
4919
4930
  /**
4931
+ * @param x
4932
+ * @return
4920
4933
  */
4921
4934
  public float noise(float x) {
4922
4935
  return noiseGenerator.noise(x);
4923
4936
  }
4924
4937
 
4925
- /**
4938
+ /**
4939
+ * @param x
4940
+ * @param y
4941
+ * @return
4926
4942
  */
4927
4943
  public float noise(float x, float y) {
4928
- return noiseGenerator.noise(x, y);
4944
+ return noiseGenerator.noise(x, y);
4929
4945
  }
4930
4946
 
4931
4947
  /**
@@ -4962,54 +4978,39 @@ public class PApplet implements PConstants {
4962
4978
  * @param x x-coordinate in noise space
4963
4979
  * @param y y-coordinate in noise space
4964
4980
  * @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
4981
  */
4969
4982
  public float noise(float x, float y, float z) {
4970
4983
  return noiseGenerator.noise(x, y, z);
4971
4984
  }
4985
+ /**
4986
+ * 4D noise where typically w is time
4987
+ * @param x
4988
+ * @param y
4989
+ * @param z
4990
+ * @param w
4991
+ * @return
4992
+ */
4993
+ public float noise(float x, float y, float z, float w) {
4994
+ return noiseGenerator.noise(x, y, z, w);
4995
+ }
4972
4996
 
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
4997
  /**
4980
- * ( begin auto-generated from noiseDetail.xml )
4981
4998
  *
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)
4999
+ * @param lod
5000
+ * @deprecated
5002
5001
  */
5002
+ @Deprecated
5003
5003
  public void noiseDetail(int lod) {
5004
- noiseGenerator.noiseDetail(lod);
5005
5004
  }
5006
5005
 
5007
5006
  /**
5008
- * @see #noiseDetail(int)
5009
- * @param falloff falloff factor for each octave
5007
+ *
5008
+ * @param lod
5009
+ * @param falloff
5010
+ * @deprecated
5010
5011
  */
5012
+ @Deprecated
5011
5013
  public void noiseDetail(int lod, float falloff) {
5012
- noiseGenerator.noiseDetail(lod, falloff);
5013
5014
  }
5014
5015
 
5015
5016
  /**
@@ -5029,7 +5030,6 @@ public class PApplet implements PConstants {
5029
5030
  * @see PApplet#random(float,float)
5030
5031
  * @see PApplet#randomSeed(long)
5031
5032
  */
5032
-
5033
5033
  public void noiseSeed(long seed) {
5034
5034
  noiseGenerator.noiseSeed(seed);
5035
5035
  }
@@ -6783,7 +6783,6 @@ public class PApplet implements PConstants {
6783
6783
  return new BufferedOutputStream(output);
6784
6784
 
6785
6785
  } catch (IOException e) {
6786
- e.printStackTrace();
6787
6786
  }
6788
6787
  return null;
6789
6788
  }
@@ -6860,12 +6859,13 @@ public class PApplet implements PConstants {
6860
6859
  System.err.println("Could not rename temporary file " + tempFile);
6861
6860
  }
6862
6861
  }
6863
- e.printStackTrace();
6864
6862
  return false;
6865
6863
  }
6866
6864
  }
6867
6865
 
6868
6866
  /**
6867
+ * @param target
6868
+ * @param source
6869
6869
  * @nowebref
6870
6870
  */
6871
6871
  static public void saveStream(OutputStream target,
@@ -6975,11 +6975,12 @@ public class PApplet implements PConstants {
6975
6975
  System.err.println("Could not delete temporary file " + tempFile);
6976
6976
  }
6977
6977
  }
6978
- e.printStackTrace();
6979
6978
  }
6980
6979
  }
6981
6980
 
6982
6981
  /**
6982
+ * @param output
6983
+ * @param data
6983
6984
  * @nowebref Spews a buffer of bytes to an OutputStream.
6984
6985
  */
6985
6986
  static public void saveBytes(OutputStream output, byte[] data) {
@@ -6988,7 +6989,6 @@ public class PApplet implements PConstants {
6988
6989
  output.flush();
6989
6990
 
6990
6991
  } catch (IOException e) {
6991
- e.printStackTrace();
6992
6992
  }
6993
6993
  }
6994
6994
 
@@ -7033,15 +7033,17 @@ public class PApplet implements PConstants {
7033
7033
  }
7034
7034
 
7035
7035
  /**
7036
+ * @param output
7037
+ * @param data
7036
7038
  * @nowebref
7037
7039
  */
7038
7040
  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]);
7041
+ try ( PrintWriter writer = createWriter(output)) {
7042
+ for (String data1 : data) {
7043
+ writer.println(data1);
7044
+ }
7045
+ writer.flush();
7042
7046
  }
7043
- writer.flush();
7044
- writer.close();
7045
7047
  }
7046
7048
 
7047
7049
  //////////////////////////////////////////////////////////////
@@ -7421,45 +7423,19 @@ public class PApplet implements PConstants {
7421
7423
  System.arraycopy(src, 0, dst, 0, Array.getLength(src));
7422
7424
  }
7423
7425
 
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
7426
  /**
7451
7427
  * ( begin auto-generated from expand.xml )
7452
7428
  *
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>.
7429
+ * Increases the size of an array.By default, this function doubles the size
7430
+ * of the array, but the optional <b>newSize</b> parameter provides precise
7431
+ * control over the increase in size. When using an array of objects, the
7432
+ * data returned from the function must be cast to the object array's data
7433
+ * type. For example: <em>SomeClass[] items = (SomeClass[])
7434
+ * expand(originalArray)</em>.
7460
7435
  *
7461
7436
  * ( end auto-generated )
7462
7437
  *
7438
+ * @return
7463
7439
  * @webref data:array_functions
7464
7440
  * @param list the array to expand
7465
7441
  * @see PApplet#shorten(boolean[])
@@ -7469,7 +7445,9 @@ public class PApplet implements PConstants {
7469
7445
  }
7470
7446
 
7471
7447
  /**
7448
+ * @param list
7472
7449
  * @param newSize new size for the array
7450
+ * @return
7473
7451
  */
7474
7452
  static public boolean[] expand(boolean[] list, int newSize) {
7475
7453
  boolean[] temp = new boolean[newSize];
@@ -14628,7 +14606,8 @@ public class PApplet implements PConstants {
14628
14606
  * function is easy to use and undestand, but is slower than another
14629
14607
  * technique. To achieve the same results when working in <b>colorMode(RGB,
14630
14608
  * 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:
14609
+ * with a bit mask. For example, the following two lines of code are
14610
+ * equivalent:
14632
14611
  * <pre>float r1 = green(myColor);float r2 =
14633
14612
  * myColor &gt;&gt; 8 &amp; 0xFF;</pre>
14634
14613
  *
@@ -14659,7 +14638,7 @@ public class PApplet implements PConstants {
14659
14638
  * technique. To achieve the same results when working in <b>colorMode(RGB,
14660
14639
  * 255)</b>, but with greater speed, use a bit mask to remove the other
14661
14640
  * color components. For example, the following two lines of code are
14662
- * equivalent:
14641
+ * equivalent:
14663
14642
  * <pre>float r1 = blue(myColor);float r2 = myColor
14664
14643
  * &amp; 0xFF;</pre>
14665
14644
  *