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.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -0
- data/CHANGELOG.md +1 -5
- data/README.md +23 -12
- data/Rakefile +23 -12
- data/lib/propane/helpers/version_error.rb +6 -0
- data/lib/propane/runner.rb +12 -0
- data/lib/propane/version.rb +1 -1
- data/library/slider/slider.rb +1 -1
- data/mvnw +234 -0
- data/mvnw.cmd +145 -0
- data/pom.xml +28 -27
- data/propane.gemspec +2 -2
- data/src/main/java/japplemenubar/JAppleMenuBar.java +41 -47
- data/src/main/java/monkstone/ColorUtil.java +1 -1
- data/src/main/java/monkstone/MathToolModule.java +12 -11
- data/src/main/java/monkstone/PropaneLibrary.java +9 -10
- data/src/main/java/monkstone/core/LibraryProxy.java +124 -113
- data/src/main/java/monkstone/fastmath/Deglut.java +86 -89
- data/src/main/java/monkstone/filechooser/Chooser.java +7 -13
- data/src/main/java/monkstone/noise/SimplexNoise.java +0 -1
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +4 -4
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +9 -9
- data/src/main/java/monkstone/slider/SimpleSlider.java +0 -9
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +11 -13
- data/src/main/java/monkstone/slider/Slider.java +1 -1
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/slider/WheelHandler.java +8 -9
- data/src/main/java/monkstone/vecmath/AppRender.java +2 -2
- data/src/main/java/monkstone/vecmath/ShapeRender.java +2 -2
- data/src/main/java/monkstone/vecmath/package-info.java +2 -2
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +2 -2
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
- data/src/main/java/monkstone/videoevent/VideoInterface.java +11 -5
- data/src/main/java/monkstone/videoevent/package-info.java +2 -2
- data/src/main/java/processing/awt/PGraphicsJava2D.java +1742 -2243
- data/src/main/java/processing/awt/PShapeJava2D.java +268 -270
- data/src/main/java/processing/awt/PSurfaceAWT.java +821 -920
- data/src/main/java/processing/core/DesktopHandler.java +94 -0
- data/src/main/java/processing/core/PApplet.java +14170 -14082
- data/src/main/java/processing/core/PConstants.java +447 -473
- data/src/main/java/processing/core/PFont.java +867 -873
- data/src/main/java/processing/core/PGraphics.java +7193 -7428
- data/src/main/java/processing/core/PImage.java +3051 -3117
- data/src/main/java/processing/core/PMatrix.java +159 -172
- data/src/main/java/processing/core/PMatrix2D.java +403 -444
- data/src/main/java/processing/core/PMatrix3D.java +735 -749
- data/src/main/java/processing/core/PShape.java +2651 -2793
- data/src/main/java/processing/core/PShapeOBJ.java +415 -422
- data/src/main/java/processing/core/PShapeSVG.java +1466 -1475
- data/src/main/java/processing/core/PStyle.java +37 -40
- data/src/main/java/processing/core/PSurface.java +98 -103
- data/src/main/java/processing/core/PSurfaceNone.java +208 -236
- data/src/main/java/processing/core/PVector.java +961 -990
- data/src/main/java/processing/data/DoubleDict.java +709 -753
- data/src/main/java/processing/data/DoubleList.java +695 -748
- data/src/main/java/processing/data/FloatDict.java +702 -746
- data/src/main/java/processing/data/FloatList.java +697 -751
- data/src/main/java/processing/data/IntDict.java +673 -718
- data/src/main/java/processing/data/IntList.java +633 -699
- data/src/main/java/processing/data/JSONArray.java +873 -931
- data/src/main/java/processing/data/JSONObject.java +1165 -1262
- data/src/main/java/processing/data/JSONTokener.java +341 -351
- data/src/main/java/processing/data/LongDict.java +662 -707
- data/src/main/java/processing/data/LongList.java +634 -700
- data/src/main/java/processing/data/Sort.java +41 -37
- data/src/main/java/processing/data/StringDict.java +486 -522
- data/src/main/java/processing/data/StringList.java +580 -624
- data/src/main/java/processing/data/Table.java +3508 -3686
- data/src/main/java/processing/data/TableRow.java +183 -182
- data/src/main/java/processing/data/XML.java +883 -957
- data/src/main/java/processing/event/Event.java +66 -87
- data/src/main/java/processing/event/KeyEvent.java +41 -48
- data/src/main/java/processing/event/MouseEvent.java +93 -103
- data/src/main/java/processing/event/TouchEvent.java +6 -10
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +5 -69
- data/src/main/java/processing/javafx/PSurfaceFX.java +2 -7
- data/src/main/java/processing/opengl/FontTexture.java +270 -290
- data/src/main/java/processing/opengl/FrameBuffer.java +363 -375
- data/src/main/java/processing/opengl/LinePath.java +500 -543
- data/src/main/java/processing/opengl/LineStroker.java +582 -593
- data/src/main/java/processing/opengl/PGL.java +2881 -2904
- data/src/main/java/processing/opengl/PGraphics2D.java +315 -408
- data/src/main/java/processing/opengl/PGraphics3D.java +72 -107
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +12043 -12230
- data/src/main/java/processing/opengl/PJOGL.java +1681 -1745
- data/src/main/java/processing/opengl/PShader.java +1257 -1260
- data/src/main/java/processing/opengl/PShapeOpenGL.java +4599 -4662
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +1030 -1047
- data/src/main/java/processing/opengl/Texture.java +1397 -1462
- data/src/main/java/processing/opengl/VertexBuffer.java +55 -57
- data/src/main/resources/icon/icon-1024.png +0 -0
- data/src/main/resources/icon/icon-128.png +0 -0
- data/src/main/resources/icon/icon-16.png +0 -0
- data/src/main/resources/icon/icon-256.png +0 -0
- data/src/main/resources/icon/icon-32.png +0 -0
- data/src/main/resources/icon/icon-48.png +0 -0
- data/src/main/resources/icon/icon-512.png +0 -0
- data/src/main/resources/icon/icon-64.png +0 -0
- data/vendors/Rakefile +1 -1
- metadata +12 -8
- 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
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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-
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
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-
|
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
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
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 {
|