propane 3.1.0.pre-java → 3.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -0
  3. data/CHANGELOG.md +1 -5
  4. data/README.md +23 -12
  5. data/Rakefile +23 -12
  6. data/lib/propane/helpers/version_error.rb +6 -0
  7. data/lib/propane/runner.rb +12 -0
  8. data/lib/propane/version.rb +1 -1
  9. data/library/slider/slider.rb +1 -1
  10. data/mvnw +234 -0
  11. data/mvnw.cmd +145 -0
  12. data/pom.xml +28 -27
  13. data/propane.gemspec +2 -2
  14. data/src/main/java/japplemenubar/JAppleMenuBar.java +41 -47
  15. data/src/main/java/monkstone/ColorUtil.java +1 -1
  16. data/src/main/java/monkstone/MathToolModule.java +12 -11
  17. data/src/main/java/monkstone/PropaneLibrary.java +9 -10
  18. data/src/main/java/monkstone/core/LibraryProxy.java +124 -113
  19. data/src/main/java/monkstone/fastmath/Deglut.java +86 -89
  20. data/src/main/java/monkstone/filechooser/Chooser.java +7 -13
  21. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -1
  22. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +4 -4
  23. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  24. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +9 -9
  25. data/src/main/java/monkstone/slider/SimpleSlider.java +0 -9
  26. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +11 -13
  27. data/src/main/java/monkstone/slider/Slider.java +1 -1
  28. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  29. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  30. data/src/main/java/monkstone/slider/WheelHandler.java +8 -9
  31. data/src/main/java/monkstone/vecmath/AppRender.java +2 -2
  32. data/src/main/java/monkstone/vecmath/ShapeRender.java +2 -2
  33. data/src/main/java/monkstone/vecmath/package-info.java +2 -2
  34. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +2 -2
  35. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
  36. data/src/main/java/monkstone/videoevent/VideoInterface.java +11 -5
  37. data/src/main/java/monkstone/videoevent/package-info.java +2 -2
  38. data/src/main/java/processing/awt/PGraphicsJava2D.java +1742 -2243
  39. data/src/main/java/processing/awt/PShapeJava2D.java +268 -270
  40. data/src/main/java/processing/awt/PSurfaceAWT.java +821 -920
  41. data/src/main/java/processing/core/DesktopHandler.java +94 -0
  42. data/src/main/java/processing/core/PApplet.java +14170 -14082
  43. data/src/main/java/processing/core/PConstants.java +447 -473
  44. data/src/main/java/processing/core/PFont.java +867 -873
  45. data/src/main/java/processing/core/PGraphics.java +7193 -7428
  46. data/src/main/java/processing/core/PImage.java +3051 -3117
  47. data/src/main/java/processing/core/PMatrix.java +159 -172
  48. data/src/main/java/processing/core/PMatrix2D.java +403 -444
  49. data/src/main/java/processing/core/PMatrix3D.java +735 -749
  50. data/src/main/java/processing/core/PShape.java +2651 -2793
  51. data/src/main/java/processing/core/PShapeOBJ.java +415 -422
  52. data/src/main/java/processing/core/PShapeSVG.java +1466 -1475
  53. data/src/main/java/processing/core/PStyle.java +37 -40
  54. data/src/main/java/processing/core/PSurface.java +98 -103
  55. data/src/main/java/processing/core/PSurfaceNone.java +208 -236
  56. data/src/main/java/processing/core/PVector.java +961 -990
  57. data/src/main/java/processing/data/DoubleDict.java +709 -753
  58. data/src/main/java/processing/data/DoubleList.java +695 -748
  59. data/src/main/java/processing/data/FloatDict.java +702 -746
  60. data/src/main/java/processing/data/FloatList.java +697 -751
  61. data/src/main/java/processing/data/IntDict.java +673 -718
  62. data/src/main/java/processing/data/IntList.java +633 -699
  63. data/src/main/java/processing/data/JSONArray.java +873 -931
  64. data/src/main/java/processing/data/JSONObject.java +1165 -1262
  65. data/src/main/java/processing/data/JSONTokener.java +341 -351
  66. data/src/main/java/processing/data/LongDict.java +662 -707
  67. data/src/main/java/processing/data/LongList.java +634 -700
  68. data/src/main/java/processing/data/Sort.java +41 -37
  69. data/src/main/java/processing/data/StringDict.java +486 -522
  70. data/src/main/java/processing/data/StringList.java +580 -624
  71. data/src/main/java/processing/data/Table.java +3508 -3686
  72. data/src/main/java/processing/data/TableRow.java +183 -182
  73. data/src/main/java/processing/data/XML.java +883 -957
  74. data/src/main/java/processing/event/Event.java +66 -87
  75. data/src/main/java/processing/event/KeyEvent.java +41 -48
  76. data/src/main/java/processing/event/MouseEvent.java +93 -103
  77. data/src/main/java/processing/event/TouchEvent.java +6 -10
  78. data/src/main/java/processing/javafx/PGraphicsFX2D.java +5 -69
  79. data/src/main/java/processing/javafx/PSurfaceFX.java +2 -7
  80. data/src/main/java/processing/opengl/FontTexture.java +270 -290
  81. data/src/main/java/processing/opengl/FrameBuffer.java +363 -375
  82. data/src/main/java/processing/opengl/LinePath.java +500 -543
  83. data/src/main/java/processing/opengl/LineStroker.java +582 -593
  84. data/src/main/java/processing/opengl/PGL.java +2881 -2904
  85. data/src/main/java/processing/opengl/PGraphics2D.java +315 -408
  86. data/src/main/java/processing/opengl/PGraphics3D.java +72 -107
  87. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12043 -12230
  88. data/src/main/java/processing/opengl/PJOGL.java +1681 -1745
  89. data/src/main/java/processing/opengl/PShader.java +1257 -1260
  90. data/src/main/java/processing/opengl/PShapeOpenGL.java +4599 -4662
  91. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1030 -1047
  92. data/src/main/java/processing/opengl/Texture.java +1397 -1462
  93. data/src/main/java/processing/opengl/VertexBuffer.java +55 -57
  94. data/src/main/resources/icon/icon-1024.png +0 -0
  95. data/src/main/resources/icon/icon-128.png +0 -0
  96. data/src/main/resources/icon/icon-16.png +0 -0
  97. data/src/main/resources/icon/icon-256.png +0 -0
  98. data/src/main/resources/icon/icon-32.png +0 -0
  99. data/src/main/resources/icon/icon-48.png +0 -0
  100. data/src/main/resources/icon/icon-512.png +0 -0
  101. data/src/main/resources/icon/icon-64.png +0 -0
  102. data/vendors/Rakefile +1 -1
  103. metadata +12 -8
  104. data/src/main/java/processing/core/ThinkDifferent.java +0 -70
@@ -6,120 +6,131 @@ import processing.event.MouseEvent;
6
6
  import processing.event.KeyEvent;
7
7
 
8
8
  /**
9
- * The purpose of this class is to enable
10
- * access to processing pre, draw and post loops in
11
- * ruby-processing as a regular java library class.
12
- * Also included background, fill and stroke methods.
13
- * PConstants should also be available from static import
14
- * @author Martin Prout
15
- */
9
+ * The purpose of this class is to enable access to processing pre, draw and
10
+ * post loops in ruby-processing as a regular java library class. Also included
11
+ * background, fill and stroke methods. PConstants should also be available from
12
+ * static import
13
+ *
14
+ * @author Martin Prout
15
+ */
16
16
  public abstract class LibraryProxy {
17
17
 
18
- private final PApplet app;
19
-
20
- /**
21
- * Useful accessors
22
- */
23
- public int width, height;
24
-
25
- /**
26
- *
27
- * @param app PApplet
28
- */
29
- public LibraryProxy(PApplet app) {
30
- this.app = app;
31
- this.width = app.width;
32
- this.height = app.height;
33
- setActive(true);
34
- }
35
-
36
- /**
37
- * Extending classes can override this, gives access to, by reflection,
38
- * processing PApplet pre loop (called before draw)
39
- */
40
- public void pre(){}
41
-
42
- /**
43
- * Extending classes must implement this gives access to processing PApplet
44
- * draw loop
45
- */
46
- public abstract void draw();
47
-
48
- /**
49
- * Extending classes can override this, gives access to, by reflection,
50
- * processing PApplet post loop (called after draw)
51
- */
52
- public void post(){}
53
-
54
- /**
55
- * Extending classes can override this, gives access to, by reflection,
56
- * processing PApplet post loop (called after draw)
57
- */
58
- public void keyEvent(KeyEvent e){}
59
-
60
- /**
61
- * Extending classes can override this, gives access to, by reflection,
62
- * processing PApplet post loop (called after draw)
63
- */
64
- public void mouseEvent(MouseEvent e){}
65
-
66
- /**
67
- * Register or unregister reflection methods
68
- * @param active
69
- */
70
- final void setActive(boolean active) {
71
- if (active) {
72
- this.app.registerMethod("pre", this);
73
- this.app.registerMethod("draw", this);
74
- this.app.registerMethod("post", this);
75
- this.app.registerMethod("mouseEvent", this);
76
- this.app.registerMethod("keyEvent", this);
77
- this.app.registerMethod("dispose", this);
78
- } else {
79
- this.app.unregisterMethod("pre", this);
80
- this.app.unregisterMethod("draw", this);
81
- this.app.unregisterMethod("post", this);
82
- this.app.unregisterMethod("mouseEvent", this);
83
- this.app.unregisterMethod("keyEvent", this);
18
+ private final PApplet app;
19
+
20
+ /**
21
+ * Useful accessors
22
+ */
23
+ public int width, height;
24
+
25
+ /**
26
+ *
27
+ * @param app PApplet
28
+ */
29
+ public LibraryProxy(PApplet app) {
30
+ this.app = app;
31
+ this.width = app.width;
32
+ this.height = app.height;
33
+ setActive(true);
34
+ }
35
+
36
+ /**
37
+ * Extending classes can override this, gives access to, by reflection,
38
+ * processing PApplet pre loop (called before draw)
39
+ */
40
+ public void pre() {
41
+ }
42
+
43
+ /**
44
+ * Extending classes must implement this gives access to processing PApplet
45
+ * draw loop
46
+ */
47
+ public abstract void draw();
48
+
49
+ /**
50
+ * Extending classes can override this, gives access to, by reflection,
51
+ * processing PApplet post loop (called after draw)
52
+ */
53
+ public void post() {
54
+ }
55
+
56
+ /**
57
+ * Extending classes can override this, gives access to, by reflection,
58
+ * processing PApplet post loop (called after draw)
59
+ * @param e
60
+ */
61
+ public void keyEvent(KeyEvent e) {
62
+ }
63
+
64
+ /**
65
+ * Extending classes can override this, gives access to, by reflection,
66
+ * processing PApplet post loop (called after draw)
67
+ * @param e
68
+ */
69
+ public void mouseEvent(MouseEvent e) {
70
+ }
71
+
72
+ /**
73
+ * Register or unregister reflection methods
74
+ *
75
+ * @param active
76
+ */
77
+ final void setActive(boolean active) {
78
+ if (active) {
79
+ this.app.registerMethod("pre", this);
80
+ this.app.registerMethod("draw", this);
81
+ this.app.registerMethod("post", this);
82
+ this.app.registerMethod("mouseEvent", this);
83
+ this.app.registerMethod("keyEvent", this);
84
+ this.app.registerMethod("dispose", this);
85
+ } else {
86
+ this.app.unregisterMethod("pre", this);
87
+ this.app.unregisterMethod("draw", this);
88
+ this.app.unregisterMethod("post", this);
89
+ this.app.unregisterMethod("mouseEvent", this);
90
+ this.app.unregisterMethod("keyEvent", this);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Simple signature for background hides need to call app
96
+ *
97
+ * @param col int
98
+ */
99
+ public void background(int col) {
100
+ this.app.background(col);
101
+ }
102
+
103
+ /**
104
+ * Simple signature for fill hides need to call app
105
+ *
106
+ * @param col int
107
+ */
108
+ public void fill(int col) {
109
+ this.app.fill(col);
110
+ }
111
+
112
+ /**
113
+ * Simple signature for stroke hides need to call app
114
+ *
115
+ * @param col int
116
+ */
117
+ public void stroke(int col) {
118
+ this.app.stroke(col);
119
+ }
120
+
121
+ /**
122
+ * Access applet if we must
123
+ *
124
+ * @return applet PApplet
125
+ */
126
+ public PApplet app() {
127
+ return this.app;
128
+ }
129
+
130
+ /**
131
+ * required for processing
132
+ */
133
+ public void dispose() {
134
+ setActive(false);
84
135
  }
85
- }
86
-
87
- /**
88
- * Simple signature for background hides need to call app
89
- * @param col int
90
- */
91
- public void background(int col) {
92
- this.app.background(col);
93
- }
94
-
95
- /**
96
- * Simple signature for fill hides need to call app
97
- * @param col int
98
- */
99
- public void fill(int col) {
100
- this.app.fill(col);
101
- }
102
-
103
- /**
104
- * Simple signature for stroke hides need to call app
105
- * @param col int
106
- */
107
- public void stroke(int col) {
108
- this.app.stroke(col);
109
- }
110
-
111
- /**
112
- * Access applet if we must
113
- * @return applet PApplet
114
- */
115
- public PApplet app() {
116
- return this.app;
117
- }
118
-
119
- /**
120
- * required for processing
121
- */
122
- public void dispose() {
123
- setActive(false);
124
- }
125
136
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2015-18 Martin Prout
2
+ * Copyright (c) 2015-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU Lesser General Public
@@ -17,7 +17,6 @@
17
17
  * License along with this library; if not, write to the Free Software
18
18
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
19
  */
20
-
21
20
  package monkstone.fastmath;
22
21
 
23
22
  import org.jruby.Ruby;
@@ -29,96 +28,94 @@ import org.jruby.runtime.ThreadContext;
29
28
  import org.jruby.runtime.builtin.IRubyObject;
30
29
 
31
30
  /**
32
- *
33
- * @author Martin Prout
34
- */
31
+ *
32
+ * @author Martin Prout
33
+ */
35
34
  @JRubyModule(name = "DegLut")
36
35
  public class Deglut {
37
-
38
- /**
39
- * Lookup table for degree cosine/sine, has a fixed precision 1.0
40
- * degrees Quite accurate but imprecise
41
- *
42
- * @author Martin Prout <martin_p@lineone.net>
43
- */
44
- static final double[] SIN_DEG_LUT = new double[91];
45
- /**
46
- *
47
- */
48
- public static final double TO_RADIANS = Math.PI / 180;
49
- /**
50
- *
51
- */
52
- private static boolean initialized = false;
53
-
54
- private final static int NINETY = 90;
55
- private final static int FULL = 360;
56
- private static final long serialVersionUID = -1466528933765940101L;
57
-
58
- /**
59
- * Initialize sin table with values (first quadrant only)
60
- */
61
- public static final void initTable() {
62
- if (initialized == false) {
63
- for (int i = 0; i <= NINETY; i++) {
64
- SIN_DEG_LUT[i] = Math.sin(TO_RADIANS * i);
65
- }
66
- initialized = true;
36
+
37
+ /**
38
+ * Lookup table for degree cosine/sine, has a fixed precision 1.0 degrees
39
+ * Quite accurate but imprecise
40
+ *
41
+ * @author Martin Prout <martin_p@lineone.net>
42
+ */
43
+ static final double[] SIN_DEG_LUT = new double[91];
44
+ /**
45
+ *
46
+ */
47
+ public static final double TO_RADIANS = Math.PI / 180;
48
+ /**
49
+ *
50
+ */
51
+ private static boolean initialized = false;
52
+
53
+ private final static int NINETY = 90;
54
+ private final static int FULL = 360;
55
+ private static final long serialVersionUID = -1466528933765940101L;
56
+
57
+ /**
58
+ * Initialize sin table with values (first quadrant only)
59
+ */
60
+ public static final void initTable() {
61
+ if (initialized == false) {
62
+ for (int i = 0; i <= NINETY; i++) {
63
+ SIN_DEG_LUT[i] = Math.sin(TO_RADIANS * i);
64
+ }
65
+ initialized = true;
66
+ }
67
67
  }
68
- }
69
-
70
- /**
71
- *
72
- * @param runtime Ruby
73
- */
74
-
75
- public static void createDeglut(final Ruby runtime){
76
- RubyModule deglutModule = runtime.defineModule("DegLut");
77
- deglutModule.defineAnnotatedMethods(Deglut.class);
78
- Deglut.initTable();
79
- }
80
-
81
-
82
- /**
83
- *
84
- * @param context ThreadContext
85
- * @param recv IRubyObject
86
- * @param other IRubyObject degrees
87
- * @return sin IRubyObject
88
- */
89
- @JRubyMethod(name = "sin", module = true)
90
-
91
- public static IRubyObject sin(ThreadContext context, IRubyObject recv, IRubyObject other) {
92
- int thet = (int) ((RubyInteger)other).getLongValue();
93
- while (thet < 0) {
94
- thet += FULL; // Needed because negative modulus plays badly in java
68
+
69
+ /**
70
+ *
71
+ * @param runtime Ruby
72
+ */
73
+ public static void createDeglut(final Ruby runtime) {
74
+ RubyModule deglutModule = runtime.defineModule("DegLut");
75
+ deglutModule.defineAnnotatedMethods(Deglut.class);
76
+ Deglut.initTable();
95
77
  }
96
- int theta = thet % FULL;
97
- int y = theta % NINETY;
98
- double result = (theta < NINETY) ? SIN_DEG_LUT[y] : (theta < 180)
99
- ? SIN_DEG_LUT[NINETY - y] : (theta < 270)
100
- ? -SIN_DEG_LUT[y] : -SIN_DEG_LUT[NINETY - y];
101
- return context.runtime.newFloat(result);
102
- }
103
-
104
- /**
105
- *
106
- * @param context ThreadContext
107
- * @param recv IRubyObject
108
- * @param other IRubyObject degrees
109
- * @return cos IRubyObject
110
- */
111
- @JRubyMethod(name = "cos", module = true)
112
- public static IRubyObject cos(ThreadContext context, IRubyObject recv, IRubyObject other) {
113
- int thet = (int) ((RubyInteger)other).getLongValue();
114
- while (thet < 0) {
115
- thet += FULL; // Needed because negative modulus plays badly in java
78
+
79
+ /**
80
+ *
81
+ * @param context ThreadContext
82
+ * @param recv IRubyObject
83
+ * @param other IRubyObject degrees
84
+ * @return sin IRubyObject
85
+ */
86
+ @JRubyMethod(name = "sin", module = true)
87
+
88
+ public static IRubyObject sin(ThreadContext context, IRubyObject recv, IRubyObject other) {
89
+ int thet = (int) ((RubyInteger) other).getLongValue();
90
+ while (thet < 0) {
91
+ thet += FULL; // Needed because negative modulus plays badly in java
92
+ }
93
+ int theta = thet % FULL;
94
+ int y = theta % NINETY;
95
+ double result = (theta < NINETY) ? SIN_DEG_LUT[y] : (theta < 180)
96
+ ? SIN_DEG_LUT[NINETY - y] : (theta < 270)
97
+ ? -SIN_DEG_LUT[y] : -SIN_DEG_LUT[NINETY - y];
98
+ return context.runtime.newFloat(result);
99
+ }
100
+
101
+ /**
102
+ *
103
+ * @param context ThreadContext
104
+ * @param recv IRubyObject
105
+ * @param other IRubyObject degrees
106
+ * @return cos IRubyObject
107
+ */
108
+ @JRubyMethod(name = "cos", module = true)
109
+ public static IRubyObject cos(ThreadContext context, IRubyObject recv, IRubyObject other) {
110
+ int thet = (int) ((RubyInteger) other).getLongValue();
111
+ while (thet < 0) {
112
+ thet += FULL; // Needed because negative modulus plays badly in java
113
+ }
114
+ int theta = thet % FULL;
115
+ int y = theta % NINETY;
116
+ double result = (theta < NINETY) ? SIN_DEG_LUT[NINETY - y] : (theta < 180)
117
+ ? -SIN_DEG_LUT[y] : (theta < 270)
118
+ ? -SIN_DEG_LUT[NINETY - y] : SIN_DEG_LUT[y];
119
+ return context.runtime.newFloat(result);
116
120
  }
117
- int theta = thet % FULL;
118
- int y = theta % NINETY;
119
- double result = (theta < NINETY) ? SIN_DEG_LUT[NINETY - y] : (theta < 180)
120
- ? -SIN_DEG_LUT[y] : (theta < 270)
121
- ? -SIN_DEG_LUT[NINETY - y] : SIN_DEG_LUT[y];
122
- return context.runtime.newFloat(result);
123
- }
124
121
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2016-18 Martin Prout
2
+ * Copyright (c) 2016-19 Martin Prout
3
3
  *
4
4
  * This library is free software; you can redistribute it and/or
5
5
  * modify it under the terms of the GNU Lesser General Public
@@ -23,19 +23,13 @@ import java.io.File;
23
23
 
24
24
  /**
25
25
  * This interface makes it easier/possible to use the reflection methods
26
- * selectInput
27
- * def setup
28
- * java_signature 'void selectInput(String, String)'
29
- * selectInput('Select a file to process:', 'fileSelected')
30
- * end
26
+ * selectInput def setup java_signature 'void selectInput(String, String)'
27
+ * selectInput('Select a file to process:', 'fileSelected') end
28
+ *
29
+ * def file_selected(selection) if selection.nil? puts 'Window was closed or the
30
+ * user hit cancel.' else puts format('User selected %s',
31
+ * selection.get_absolute_path) end end
31
32
  *
32
- * def file_selected(selection)
33
- * if selection.nil?
34
- * puts 'Window was closed or the user hit cancel.'
35
- * else
36
- * puts format('User selected %s', selection.get_absolute_path)
37
- * end
38
- * end
39
33
  * @author Martin Prout
40
34
  */
41
35
  public interface Chooser {