propane 2.7.2-java → 2.8.0.pre-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -0
  3. data/CHANGELOG.md +1 -1
  4. data/README.md +10 -8
  5. data/Rakefile +1 -1
  6. data/lib/propane/app.rb +3 -3
  7. data/lib/propane/version.rb +1 -1
  8. data/lib/{processing-core.jar → propane-2.8.0.jar} +0 -0
  9. data/library/control_panel/control_panel.rb +3 -2
  10. data/pom.rb +89 -88
  11. data/pom.xml +75 -46
  12. data/propane.gemspec +1 -2
  13. data/src/main/java/japplemenubar/JAppleMenuBar.java +88 -0
  14. data/src/main/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  15. data/src/{monkstone → main/java/monkstone}/ColorUtil.java +0 -0
  16. data/src/{monkstone → main/java/monkstone}/MathToolModule.java +0 -0
  17. data/src/{monkstone → main/java/monkstone}/PropaneLibrary.java +0 -0
  18. data/src/{monkstone → main/java/monkstone}/core/LibraryProxy.java +0 -0
  19. data/src/{monkstone → main/java/monkstone}/fastmath/Deglut.java +0 -0
  20. data/src/{monkstone → main/java/monkstone}/fastmath/package-info.java +0 -0
  21. data/src/{monkstone → main/java/monkstone}/filechooser/Chooser.java +0 -0
  22. data/src/{monkstone → main/java/monkstone}/noise/SimplexNoise.java +0 -0
  23. data/src/{monkstone → main/java/monkstone}/slider/CustomHorizontalSlider.java +0 -0
  24. data/src/{monkstone → main/java/monkstone}/slider/CustomVerticalSlider.java +0 -0
  25. data/src/{monkstone → main/java/monkstone}/slider/SimpleHorizontalSlider.java +0 -0
  26. data/src/{monkstone → main/java/monkstone}/slider/SimpleSlider.java +0 -0
  27. data/src/{monkstone → main/java/monkstone}/slider/SimpleVerticalSlider.java +0 -0
  28. data/src/{monkstone → main/java/monkstone}/slider/Slider.java +0 -0
  29. data/src/{monkstone → main/java/monkstone}/slider/SliderBar.java +0 -0
  30. data/src/{monkstone → main/java/monkstone}/slider/SliderGroup.java +0 -0
  31. data/src/{monkstone → main/java/monkstone}/slider/WheelHandler.java +0 -0
  32. data/src/{monkstone → main/java/monkstone}/vecmath/AppRender.java +0 -0
  33. data/src/{monkstone → main/java/monkstone}/vecmath/JRender.java +0 -0
  34. data/src/{monkstone → main/java/monkstone}/vecmath/ShapeRender.java +0 -0
  35. data/src/{monkstone → main/java/monkstone}/vecmath/package-info.java +0 -0
  36. data/src/{monkstone → main/java/monkstone}/vecmath/vec2/Vec2.java +0 -0
  37. data/src/{monkstone → main/java/monkstone}/vecmath/vec2/package-info.java +0 -0
  38. data/src/{monkstone → main/java/monkstone}/vecmath/vec3/Vec3.java +0 -0
  39. data/src/{monkstone → main/java/monkstone}/vecmath/vec3/package-info.java +0 -0
  40. data/src/{monkstone → main/java/monkstone}/videoevent/VideoInterface.java +0 -0
  41. data/src/{monkstone → main/java/monkstone}/videoevent/package-info.java +0 -0
  42. data/src/main/java/processing/awt/PGraphicsJava2D.java +3029 -0
  43. data/src/main/java/processing/awt/PShapeJava2D.java +377 -0
  44. data/src/main/java/processing/awt/PSurfaceAWT.java +1567 -0
  45. data/src/main/java/processing/core/PApplet.java +15709 -0
  46. data/src/main/java/processing/core/PConstants.java +527 -0
  47. data/src/main/java/processing/core/PFont.java +1098 -0
  48. data/src/main/java/processing/core/PGraphics.java +8467 -0
  49. data/src/main/java/processing/core/PImage.java +3438 -0
  50. data/src/main/java/processing/core/PMatrix.java +208 -0
  51. data/src/main/java/processing/core/PMatrix2D.java +534 -0
  52. data/src/main/java/processing/core/PMatrix3D.java +877 -0
  53. data/src/main/java/processing/core/PShape.java +3445 -0
  54. data/src/main/java/processing/core/PShapeOBJ.java +469 -0
  55. data/src/main/java/processing/core/PShapeSVG.java +1787 -0
  56. data/src/main/java/processing/core/PStyle.java +63 -0
  57. data/src/main/java/processing/core/PSurface.java +161 -0
  58. data/src/main/java/processing/core/PSurfaceNone.java +374 -0
  59. data/src/main/java/processing/core/PVector.java +1063 -0
  60. data/src/main/java/processing/data/FloatDict.java +829 -0
  61. data/src/main/java/processing/data/FloatList.java +912 -0
  62. data/src/main/java/processing/data/IntDict.java +796 -0
  63. data/src/main/java/processing/data/IntList.java +913 -0
  64. data/src/main/java/processing/data/JSONArray.java +1260 -0
  65. data/src/main/java/processing/data/JSONObject.java +2282 -0
  66. data/src/main/java/processing/data/JSONTokener.java +435 -0
  67. data/src/main/java/processing/data/Sort.java +46 -0
  68. data/src/main/java/processing/data/StringDict.java +601 -0
  69. data/src/main/java/processing/data/StringList.java +775 -0
  70. data/src/main/java/processing/data/Table.java +4923 -0
  71. data/src/main/java/processing/data/TableRow.java +198 -0
  72. data/src/main/java/processing/data/XML.java +1149 -0
  73. data/src/main/java/processing/event/Event.java +125 -0
  74. data/src/main/java/processing/event/KeyEvent.java +70 -0
  75. data/src/main/java/processing/event/MouseEvent.java +149 -0
  76. data/src/main/java/processing/event/TouchEvent.java +57 -0
  77. data/src/main/java/processing/opengl/FontTexture.java +379 -0
  78. data/src/main/java/processing/opengl/FrameBuffer.java +503 -0
  79. data/src/main/java/processing/opengl/LinePath.java +623 -0
  80. data/src/main/java/processing/opengl/LineStroker.java +685 -0
  81. data/src/main/java/processing/opengl/PGL.java +3366 -0
  82. data/src/main/java/processing/opengl/PGraphics2D.java +615 -0
  83. data/src/main/java/processing/opengl/PGraphics3D.java +281 -0
  84. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13634 -0
  85. data/src/main/java/processing/opengl/PJOGL.java +1966 -0
  86. data/src/main/java/processing/opengl/PShader.java +1478 -0
  87. data/src/main/java/processing/opengl/PShapeOpenGL.java +5234 -0
  88. data/src/main/java/processing/opengl/PSurfaceJOGL.java +1315 -0
  89. data/src/main/java/processing/opengl/Texture.java +1670 -0
  90. data/src/main/java/processing/opengl/VertexBuffer.java +88 -0
  91. data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
  92. data/src/main/java/processing/opengl/cursors/cross.png +0 -0
  93. data/src/main/java/processing/opengl/cursors/hand.png +0 -0
  94. data/src/main/java/processing/opengl/cursors/license.txt +27 -0
  95. data/src/main/java/processing/opengl/cursors/move.png +0 -0
  96. data/src/main/java/processing/opengl/cursors/text.png +0 -0
  97. data/src/main/java/processing/opengl/cursors/wait.png +0 -0
  98. data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +32 -0
  99. data/src/main/java/processing/opengl/shaders/ColorVert.glsl +34 -0
  100. data/src/main/java/processing/opengl/shaders/LightFrag.glsl +33 -0
  101. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +154 -0
  102. data/src/main/java/processing/opengl/shaders/LightVert.glsl +151 -0
  103. data/src/main/java/processing/opengl/shaders/LineFrag.glsl +32 -0
  104. data/src/main/java/processing/opengl/shaders/LineVert.glsl +100 -0
  105. data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +40 -0
  106. data/src/main/java/processing/opengl/shaders/PointFrag.glsl +32 -0
  107. data/src/main/java/processing/opengl/shaders/PointVert.glsl +56 -0
  108. data/src/main/java/processing/opengl/shaders/TexFrag.glsl +37 -0
  109. data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +37 -0
  110. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +160 -0
  111. data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +157 -0
  112. data/src/main/java/processing/opengl/shaders/TexVert.glsl +38 -0
  113. data/src/main/resources/icon/icon-1024.png +0 -0
  114. data/src/main/resources/icon/icon-128.png +0 -0
  115. data/src/main/resources/icon/icon-16.png +0 -0
  116. data/src/main/resources/icon/icon-256.png +0 -0
  117. data/src/main/resources/icon/icon-32.png +0 -0
  118. data/src/main/resources/icon/icon-48.png +0 -0
  119. data/src/main/resources/icon/icon-512.png +0 -0
  120. data/src/main/resources/icon/icon-64.png +0 -0
  121. data/src/main/resources/license.txt +508 -0
  122. data/vendors/Rakefile +5 -20
  123. metadata +115 -33
  124. data/lib/propane.jar +0 -0
@@ -0,0 +1,377 @@
1
+ /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
+
3
+ /*
4
+ Part of the Processing project - http://processing.org
5
+
6
+ Copyright (c) 2015 The Processing Foundation
7
+
8
+ This library is free software; you can redistribute it and/or
9
+ modify it under the terms of the GNU Lesser General Public
10
+ License version 2.1 as published by the Free Software Foundation.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General
18
+ Public License along with this library; if not, write to the
19
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
+ Boston, MA 02111-1307 USA
21
+ */
22
+
23
+ package processing.awt;
24
+
25
+ import java.awt.Paint;
26
+ import java.awt.PaintContext;
27
+ import java.awt.Rectangle;
28
+ import java.awt.RenderingHints;
29
+ import java.awt.geom.AffineTransform;
30
+ import java.awt.geom.Point2D;
31
+ import java.awt.geom.Rectangle2D;
32
+ import java.awt.image.ColorModel;
33
+ import java.awt.image.Raster;
34
+ import java.awt.image.WritableRaster;
35
+
36
+ import processing.core.PApplet;
37
+ import processing.core.PGraphics;
38
+ import processing.core.PShapeSVG;
39
+ import processing.data.*;
40
+
41
+
42
+ /**
43
+ * Implements features for PShape that are specific to AWT and Java2D.
44
+ * At the moment, this is gradients and java.awt.Paint handling.
45
+ */
46
+ public class PShapeJava2D extends PShapeSVG {
47
+ Paint strokeGradientPaint;
48
+ Paint fillGradientPaint;
49
+
50
+
51
+ public PShapeJava2D(XML svg) {
52
+ super(svg);
53
+ }
54
+
55
+
56
+ public PShapeJava2D(PShapeSVG parent, XML properties, boolean parseKids) {
57
+ super(parent, properties, parseKids);
58
+ }
59
+
60
+
61
+ @Override
62
+ protected void setParent(PShapeSVG parent) {
63
+ super.setParent(parent);
64
+
65
+ if (parent instanceof PShapeJava2D) {
66
+ PShapeJava2D pj = (PShapeJava2D) parent;
67
+ fillGradientPaint = pj.fillGradientPaint;
68
+ strokeGradientPaint = pj.strokeGradientPaint;
69
+
70
+ } else { // parent is null or not Java2D
71
+ fillGradientPaint = null;
72
+ strokeGradientPaint = null;
73
+ }
74
+ }
75
+
76
+
77
+ /** Factory method for subclasses. */
78
+ @Override
79
+ protected PShapeSVG createShape(PShapeSVG parent, XML properties, boolean parseKids) {
80
+ return new PShapeJava2D(parent, properties, parseKids);
81
+ }
82
+
83
+
84
+ /*
85
+ @Override
86
+ public void setColor(String colorText, boolean isFill) {
87
+ super.setColor(colorText, isFill);
88
+
89
+ if (fillGradient != null) {
90
+ fillGradientPaint = calcGradientPaint(fillGradient);
91
+ }
92
+ if (strokeGradient != null) {
93
+ strokeGradientPaint = calcGradientPaint(strokeGradient);
94
+ }
95
+ }
96
+ */
97
+
98
+
99
+ static class LinearGradientPaint implements Paint {
100
+ float x1, y1, x2, y2;
101
+ float[] offset;
102
+ int[] color;
103
+ int count;
104
+ float opacity;
105
+
106
+ public LinearGradientPaint(float x1, float y1, float x2, float y2,
107
+ float[] offset, int[] color, int count,
108
+ float opacity) {
109
+ this.x1 = x1;
110
+ this.y1 = y1;
111
+ this.x2 = x2;
112
+ this.y2 = y2;
113
+ this.offset = offset;
114
+ this.color = color;
115
+ this.count = count;
116
+ this.opacity = opacity;
117
+ }
118
+
119
+ public PaintContext createContext(ColorModel cm,
120
+ Rectangle deviceBounds, Rectangle2D userBounds,
121
+ AffineTransform xform, RenderingHints hints) {
122
+ Point2D t1 = xform.transform(new Point2D.Float(x1, y1), null);
123
+ Point2D t2 = xform.transform(new Point2D.Float(x2, y2), null);
124
+ return new LinearGradientContext((float) t1.getX(), (float) t1.getY(),
125
+ (float) t2.getX(), (float) t2.getY());
126
+ }
127
+
128
+ public int getTransparency() {
129
+ return TRANSLUCENT; // why not.. rather than checking each color
130
+ }
131
+
132
+ public class LinearGradientContext implements PaintContext {
133
+ int ACCURACY = 2;
134
+ float tx1, ty1, tx2, ty2;
135
+
136
+ public LinearGradientContext(float tx1, float ty1, float tx2, float ty2) {
137
+ this.tx1 = tx1;
138
+ this.ty1 = ty1;
139
+ this.tx2 = tx2;
140
+ this.ty2 = ty2;
141
+ }
142
+
143
+ public void dispose() { }
144
+
145
+ public ColorModel getColorModel() { return ColorModel.getRGBdefault(); }
146
+
147
+ public Raster getRaster(int x, int y, int w, int h) {
148
+ WritableRaster raster =
149
+ getColorModel().createCompatibleWritableRaster(w, h);
150
+
151
+ int[] data = new int[w * h * 4];
152
+
153
+ // make normalized version of base vector
154
+ float nx = tx2 - tx1;
155
+ float ny = ty2 - ty1;
156
+ float len = (float) Math.sqrt(nx*nx + ny*ny);
157
+ if (len != 0) {
158
+ nx /= len;
159
+ ny /= len;
160
+ }
161
+
162
+ int span = (int) PApplet.dist(tx1, ty1, tx2, ty2) * ACCURACY;
163
+ if (span <= 0) {
164
+ //System.err.println("span is too small");
165
+ // annoying edge case where the gradient isn't legit
166
+ int index = 0;
167
+ for (int j = 0; j < h; j++) {
168
+ for (int i = 0; i < w; i++) {
169
+ data[index++] = 0;
170
+ data[index++] = 0;
171
+ data[index++] = 0;
172
+ data[index++] = 255;
173
+ }
174
+ }
175
+
176
+ } else {
177
+ int[][] interp = new int[span][4];
178
+ int prev = 0;
179
+ for (int i = 1; i < count; i++) {
180
+ int c0 = color[i-1];
181
+ int c1 = color[i];
182
+ int last = (int) (offset[i] * (span-1));
183
+ //System.out.println("last is " + last);
184
+ for (int j = prev; j <= last; j++) {
185
+ float btwn = PApplet.norm(j, prev, last);
186
+ interp[j][0] = (int) PApplet.lerp((c0 >> 16) & 0xff, (c1 >> 16) & 0xff, btwn);
187
+ interp[j][1] = (int) PApplet.lerp((c0 >> 8) & 0xff, (c1 >> 8) & 0xff, btwn);
188
+ interp[j][2] = (int) PApplet.lerp(c0 & 0xff, c1 & 0xff, btwn);
189
+ interp[j][3] = (int) (PApplet.lerp((c0 >> 24) & 0xff, (c1 >> 24) & 0xff, btwn) * opacity);
190
+ //System.out.println(j + " " + interp[j][0] + " " + interp[j][1] + " " + interp[j][2]);
191
+ }
192
+ prev = last;
193
+ }
194
+
195
+ int index = 0;
196
+ for (int j = 0; j < h; j++) {
197
+ for (int i = 0; i < w; i++) {
198
+ //float distance = 0; //PApplet.dist(cx, cy, x + i, y + j);
199
+ //int which = PApplet.min((int) (distance * ACCURACY), interp.length-1);
200
+ float px = (x + i) - tx1;
201
+ float py = (y + j) - ty1;
202
+ // distance up the line is the dot product of the normalized
203
+ // vector of the gradient start/stop by the point being tested
204
+ int which = (int) ((px*nx + py*ny) * ACCURACY);
205
+ if (which < 0) which = 0;
206
+ if (which > interp.length-1) which = interp.length-1;
207
+ //if (which > 138) System.out.println("grabbing " + which);
208
+
209
+ data[index++] = interp[which][0];
210
+ data[index++] = interp[which][1];
211
+ data[index++] = interp[which][2];
212
+ data[index++] = interp[which][3];
213
+ }
214
+ }
215
+ }
216
+ raster.setPixels(0, 0, w, h, data);
217
+
218
+ return raster;
219
+ }
220
+ }
221
+ }
222
+
223
+
224
+ static class RadialGradientPaint implements Paint {
225
+ float cx, cy, radius;
226
+ float[] offset;
227
+ int[] color;
228
+ int count;
229
+ float opacity;
230
+
231
+ public RadialGradientPaint(float cx, float cy, float radius,
232
+ float[] offset, int[] color, int count,
233
+ float opacity) {
234
+ this.cx = cx;
235
+ this.cy = cy;
236
+ this.radius = radius;
237
+ this.offset = offset;
238
+ this.color = color;
239
+ this.count = count;
240
+ this.opacity = opacity;
241
+ }
242
+
243
+ public PaintContext createContext(ColorModel cm,
244
+ Rectangle deviceBounds, Rectangle2D userBounds,
245
+ AffineTransform xform, RenderingHints hints) {
246
+ return new RadialGradientContext();
247
+ }
248
+
249
+ public int getTransparency() {
250
+ return TRANSLUCENT;
251
+ }
252
+
253
+ public class RadialGradientContext implements PaintContext {
254
+ int ACCURACY = 5;
255
+
256
+ public void dispose() {}
257
+
258
+ public ColorModel getColorModel() { return ColorModel.getRGBdefault(); }
259
+
260
+ public Raster getRaster(int x, int y, int w, int h) {
261
+ WritableRaster raster =
262
+ getColorModel().createCompatibleWritableRaster(w, h);
263
+
264
+ int span = (int) radius * ACCURACY;
265
+ int[][] interp = new int[span][4];
266
+ int prev = 0;
267
+ for (int i = 1; i < count; i++) {
268
+ int c0 = color[i-1];
269
+ int c1 = color[i];
270
+ int last = (int) (offset[i] * (span - 1));
271
+ for (int j = prev; j <= last; j++) {
272
+ float btwn = PApplet.norm(j, prev, last);
273
+ interp[j][0] = (int) PApplet.lerp((c0 >> 16) & 0xff, (c1 >> 16) & 0xff, btwn);
274
+ interp[j][1] = (int) PApplet.lerp((c0 >> 8) & 0xff, (c1 >> 8) & 0xff, btwn);
275
+ interp[j][2] = (int) PApplet.lerp(c0 & 0xff, c1 & 0xff, btwn);
276
+ interp[j][3] = (int) (PApplet.lerp((c0 >> 24) & 0xff, (c1 >> 24) & 0xff, btwn) * opacity);
277
+ }
278
+ prev = last;
279
+ }
280
+
281
+ int[] data = new int[w * h * 4];
282
+ int index = 0;
283
+ for (int j = 0; j < h; j++) {
284
+ for (int i = 0; i < w; i++) {
285
+ float distance = PApplet.dist(cx, cy, x + i, y + j);
286
+ int which = PApplet.min((int) (distance * ACCURACY), interp.length-1);
287
+
288
+ data[index++] = interp[which][0];
289
+ data[index++] = interp[which][1];
290
+ data[index++] = interp[which][2];
291
+ data[index++] = interp[which][3];
292
+ }
293
+ }
294
+ raster.setPixels(0, 0, w, h, data);
295
+
296
+ return raster;
297
+ }
298
+ }
299
+ }
300
+
301
+
302
+ protected Paint calcGradientPaint(Gradient gradient) {
303
+ if (gradient instanceof LinearGradient) {
304
+ // System.out.println("creating linear gradient");
305
+ LinearGradient grad = (LinearGradient) gradient;
306
+ return new LinearGradientPaint(grad.x1, grad.y1, grad.x2, grad.y2,
307
+ grad.offset, grad.color, grad.count,
308
+ opacity);
309
+
310
+ } else if (gradient instanceof RadialGradient) {
311
+ // System.out.println("creating radial gradient");
312
+ RadialGradient grad = (RadialGradient) gradient;
313
+ return new RadialGradientPaint(grad.cx, grad.cy, grad.r,
314
+ grad.offset, grad.color, grad.count,
315
+ opacity);
316
+ }
317
+ return null;
318
+ }
319
+
320
+
321
+ // protected Paint calcGradientPaint(Gradient gradient,
322
+ // float x1, float y1, float x2, float y2) {
323
+ // if (gradient instanceof LinearGradient) {
324
+ // LinearGradient grad = (LinearGradient) gradient;
325
+ // return new LinearGradientPaint(x1, y1, x2, y2,
326
+ // grad.offset, grad.color, grad.count,
327
+ // opacity);
328
+ // }
329
+ // throw new RuntimeException("Not a linear gradient.");
330
+ // }
331
+
332
+
333
+ // protected Paint calcGradientPaint(Gradient gradient,
334
+ // float cx, float cy, float r) {
335
+ // if (gradient instanceof RadialGradient) {
336
+ // RadialGradient grad = (RadialGradient) gradient;
337
+ // return new RadialGradientPaint(cx, cy, r,
338
+ // grad.offset, grad.color, grad.count,
339
+ // opacity);
340
+ // }
341
+ // throw new RuntimeException("Not a radial gradient.");
342
+ // }
343
+
344
+
345
+ // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
346
+
347
+
348
+ @Override
349
+ protected void styles(PGraphics g) {
350
+ super.styles(g);
351
+
352
+ //if (g instanceof PGraphicsJava2D) {
353
+ PGraphicsJava2D p2d = (PGraphicsJava2D) g;
354
+
355
+ if (strokeGradient != null) {
356
+ p2d.strokeGradient = true;
357
+ if (strokeGradientPaint == null) {
358
+ strokeGradientPaint = calcGradientPaint(strokeGradient);
359
+ }
360
+ p2d.strokeGradientObject = strokeGradientPaint;
361
+ } else {
362
+ // need to shut off, in case parent object has a gradient applied
363
+ //p2d.strokeGradient = false;
364
+ }
365
+ if (fillGradient != null) {
366
+ p2d.fillGradient = true;
367
+ if (fillGradientPaint == null) {
368
+ fillGradientPaint = calcGradientPaint(fillGradient);
369
+ }
370
+ p2d.fillGradientObject = fillGradientPaint;
371
+ } else {
372
+ // need to shut off, in case parent object has a gradient applied
373
+ //p2d.fillGradient = false;
374
+ }
375
+ //}
376
+ }
377
+ }