propane 3.5.0-java → 3.9.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG.md +7 -1
  7. data/README.md +7 -22
  8. data/Rakefile +3 -2
  9. data/lib/propane.rb +2 -1
  10. data/lib/propane/app.rb +4 -0
  11. data/lib/propane/helper_methods.rb +0 -1
  12. data/lib/propane/runner.rb +12 -12
  13. data/lib/propane/version.rb +1 -1
  14. data/library/pdf/pdf.rb +7 -0
  15. data/library/svg/svg.rb +7 -0
  16. data/pom.rb +65 -43
  17. data/pom.xml +44 -5
  18. data/propane.gemspec +9 -4
  19. data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
  20. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  21. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  22. data/src/main/java/monkstone/noise/FastTerrain.java +874 -0
  23. data/src/main/java/monkstone/noise/Noise.java +90 -0
  24. data/src/main/java/monkstone/noise/NoiseGenerator.java +75 -0
  25. data/src/main/java/monkstone/noise/NoiseMode.java +28 -0
  26. data/src/main/java/monkstone/noise/OpenSimplex2F.java +881 -0
  27. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1106 -0
  28. data/src/main/java/monkstone/noise/SmoothTerrain.java +1099 -0
  29. data/src/main/java/processing/awt/PGraphicsJava2D.java +8 -17
  30. data/src/main/java/processing/awt/PImageAWT.java +123 -6
  31. data/src/main/java/processing/awt/PShapeJava2D.java +1 -0
  32. data/src/main/java/processing/awt/PSurfaceAWT.java +9 -7
  33. data/src/main/java/processing/awt/ShimAWT.java +2 -1
  34. data/src/main/java/processing/core/PApplet.java +13297 -14838
  35. data/src/main/java/processing/core/PConstants.java +5 -5
  36. data/src/main/java/processing/core/PFont.java +5 -17
  37. data/src/main/java/processing/core/PGraphics.java +346 -351
  38. data/src/main/java/processing/core/PImage.java +1440 -1537
  39. data/src/main/java/processing/core/PMatrix2D.java +24 -7
  40. data/src/main/java/processing/core/PMatrix3D.java +12 -5
  41. data/src/main/java/processing/core/PShape.java +155 -173
  42. data/src/main/java/processing/core/PShapeOBJ.java +2 -0
  43. data/src/main/java/processing/core/PShapeSVG.java +632 -611
  44. data/src/main/java/processing/core/PSurface.java +15 -10
  45. data/src/main/java/processing/core/PSurfaceNone.java +8 -4
  46. data/src/main/java/processing/core/PVector.java +35 -28
  47. data/src/main/java/processing/data/Table.java +20 -20
  48. data/src/main/java/processing/data/XML.java +1 -1
  49. data/src/main/java/processing/event/Event.java +1 -1
  50. data/src/main/java/processing/event/MouseEvent.java +7 -6
  51. data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
  52. data/src/main/java/processing/javafx/PSurfaceFX.java +127 -125
  53. data/src/main/java/processing/opengl/FrameBuffer.java +2 -4
  54. data/src/main/java/processing/opengl/LinePath.java +4 -0
  55. data/src/main/java/processing/opengl/LineStroker.java +2 -6
  56. data/src/main/java/processing/opengl/PGL.java +72 -45
  57. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +106 -60
  58. data/src/main/java/processing/opengl/PJOGL.java +15 -3
  59. data/src/main/java/processing/opengl/PShader.java +26 -47
  60. data/src/main/java/processing/opengl/PShapeOpenGL.java +1041 -1001
  61. data/src/main/java/processing/opengl/PSurfaceJOGL.java +211 -208
  62. data/src/main/java/processing/opengl/Texture.java +7 -4
  63. data/src/main/java/processing/opengl/VertexBuffer.java +2 -2
  64. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  65. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  66. data/test/deglut_spec_test.rb +2 -2
  67. data/vendors/Rakefile +22 -33
  68. metadata +53 -21
  69. data/library/simplex_noise/simplex_noise.rb +0 -5
  70. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -436
@@ -62,6 +62,7 @@ public class PMatrix2D implements PMatrix {
62
62
  }
63
63
 
64
64
 
65
+ @Override
65
66
  public void reset() {
66
67
  set(1, 0, 0,
67
68
  0, 1, 0);
@@ -71,6 +72,7 @@ public class PMatrix2D implements PMatrix {
71
72
  /**
72
73
  * Returns a copy of this PMatrix.
73
74
  */
75
+ @Override
74
76
  public PMatrix2D get() {
75
77
  PMatrix2D outgoing = new PMatrix2D();
76
78
  outgoing.set(this);
@@ -83,6 +85,7 @@ public class PMatrix2D implements PMatrix {
83
85
  * If target is null (or not the correct size), a new array will be created.
84
86
  * Returned in the order {@code {m00, m01, m02, m10, m11, m12}}.
85
87
  */
88
+ @Override
86
89
  public float[] get(float[] target) {
87
90
  if ((target == null) || (target.length != 6)) {
88
91
  target = new float[6];
@@ -101,7 +104,7 @@ public class PMatrix2D implements PMatrix {
101
104
 
102
105
  /**
103
106
  * If matrix is a PMatrix2D, sets this matrix to be a copy of it.
104
- * @throws IllegalArgumentException If <code>matrix</code> is not 2D.
107
+ * @throws IllegalArgumentException If <tt>matrix</tt> is not 2D.
105
108
  */
106
109
  public void set(PMatrix matrix) {
107
110
  if (matrix instanceof PMatrix2D) {
@@ -121,6 +124,7 @@ public class PMatrix2D implements PMatrix {
121
124
  }
122
125
 
123
126
 
127
+ @Override
124
128
  public void set(float[] source) {
125
129
  m00 = source[0];
126
130
  m01 = source[1];
@@ -135,6 +139,7 @@ public class PMatrix2D implements PMatrix {
135
139
  /**
136
140
  * Sets the matrix content.
137
141
  */
142
+ @Override
138
143
  public void set(float m00, float m01, float m02,
139
144
  float m10, float m11, float m12) {
140
145
  this.m00 = m00; this.m01 = m01; this.m02 = m02;
@@ -153,6 +158,7 @@ public class PMatrix2D implements PMatrix {
153
158
  }
154
159
 
155
160
 
161
+ @Override
156
162
  public void translate(float tx, float ty) {
157
163
  m02 = tx*m00 + ty*m01 + m02;
158
164
  m12 = tx*m10 + ty*m11 + m12;
@@ -163,12 +169,14 @@ public class PMatrix2D implements PMatrix {
163
169
  * Unavailable in 2D.
164
170
  * @throws IllegalArgumentException
165
171
  */
172
+ @Override
166
173
  public void translate(float x, float y, float z) {
167
174
  throw new IllegalArgumentException("Cannot use translate(x, y, z) on a PMatrix2D.");
168
175
  }
169
176
 
170
177
 
171
178
  // Implementation roughly based on AffineTransform.
179
+ @Override
172
180
  public void rotate(float angle) {
173
181
  float s = sin(angle);
174
182
  float c = cos(angle);
@@ -188,6 +196,7 @@ public class PMatrix2D implements PMatrix {
188
196
  * Unavailable in 2D.
189
197
  * @throws IllegalArgumentException
190
198
  */
199
+ @Override
191
200
  public void rotateX(float angle) {
192
201
  throw new IllegalArgumentException("Cannot use rotateX() on a PMatrix2D.");
193
202
  }
@@ -195,7 +204,6 @@ public class PMatrix2D implements PMatrix {
195
204
 
196
205
  /**
197
206
  * Unavailable in 2D.
198
- * @param angle
199
207
  * @throws IllegalArgumentException
200
208
  */
201
209
  @Override
@@ -265,6 +273,7 @@ public class PMatrix2D implements PMatrix {
265
273
  }
266
274
 
267
275
 
276
+ @Override
268
277
  public void apply(PMatrix2D source) {
269
278
  apply(source.m00, source.m01, source.m02,
270
279
  source.m10, source.m11, source.m12);
@@ -275,11 +284,13 @@ public class PMatrix2D implements PMatrix {
275
284
  * Unavailable in 2D.
276
285
  * @throws IllegalArgumentException
277
286
  */
287
+ @Override
278
288
  public void apply(PMatrix3D source) {
279
289
  throw new IllegalArgumentException("Cannot use apply(PMatrix3D) on a PMatrix2D.");
280
290
  }
281
291
 
282
292
 
293
+ @Override
283
294
  public void apply(float n00, float n01, float n02,
284
295
  float n10, float n11, float n12) {
285
296
  float t0 = m00;
@@ -311,6 +322,7 @@ public class PMatrix2D implements PMatrix {
311
322
  /**
312
323
  * Apply another matrix to the left of this one.
313
324
  */
325
+ @Override
314
326
  public void preApply(PMatrix source) {
315
327
  if (source instanceof PMatrix2D) {
316
328
  preApply((PMatrix2D) source);
@@ -320,6 +332,7 @@ public class PMatrix2D implements PMatrix {
320
332
  }
321
333
 
322
334
 
335
+ @Override
323
336
  public void preApply(PMatrix2D left) {
324
337
  preApply(left.m00, left.m01, left.m02,
325
338
  left.m10, left.m11, left.m12);
@@ -330,11 +343,13 @@ public class PMatrix2D implements PMatrix {
330
343
  * Unavailable in 2D.
331
344
  * @throws IllegalArgumentException
332
345
  */
346
+ @Override
333
347
  public void preApply(PMatrix3D left) {
334
348
  throw new IllegalArgumentException("Cannot use preApply(PMatrix3D) on a PMatrix2D.");
335
349
  }
336
350
 
337
351
 
352
+ @Override
338
353
  public void preApply(float n00, float n01, float n02,
339
354
  float n10, float n11, float n12) {
340
355
  float t0 = m02;
@@ -434,6 +449,7 @@ public class PMatrix2D implements PMatrix {
434
449
  /**
435
450
  * Unavailable in 2D. Does nothing.
436
451
  */
452
+ @Override
437
453
  public void transpose() {
438
454
  }
439
455
 
@@ -441,6 +457,7 @@ public class PMatrix2D implements PMatrix {
441
457
  /*
442
458
  * Implementation stolen from OpenJDK.
443
459
  */
460
+ @Override
444
461
  public boolean invert() {
445
462
  float determinant = determinant();
446
463
  if (Math.abs(determinant) <= Float.MIN_VALUE) {
@@ -523,23 +540,23 @@ public class PMatrix2D implements PMatrix {
523
540
  //////////////////////////////////////////////////////////////
524
541
 
525
542
 
526
- static private final float max(float a, float b) {
543
+ private static float max(float a, float b) {
527
544
  return (a > b) ? a : b;
528
545
  }
529
546
 
530
- static private final float abs(float a) {
547
+ private static float abs(float a) {
531
548
  return (a < 0) ? -a : a;
532
549
  }
533
550
 
534
- static private final float sin(float angle) {
551
+ private static float sin(float angle) {
535
552
  return (float)Math.sin(angle);
536
553
  }
537
554
 
538
- static private final float cos(float angle) {
555
+ private static float cos(float angle) {
539
556
  return (float)Math.cos(angle);
540
557
  }
541
558
 
542
- static private final float tan(float angle) {
559
+ private static float tan(float angle) {
543
560
  return (float)Math.tan(angle);
544
561
  }
545
562
  }
@@ -93,7 +93,6 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
93
93
  /**
94
94
  * Returns a copy of this PMatrix.
95
95
  */
96
- @Override
97
96
  public PMatrix3D get() {
98
97
  PMatrix3D outgoing = new PMatrix3D();
99
98
  outgoing.set(this);
@@ -150,6 +149,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
150
149
  }
151
150
 
152
151
 
152
+ @Override
153
153
  public void set(float[] source) {
154
154
  if (source.length == 6) {
155
155
  set(source[0], source[1], source[2],
@@ -179,6 +179,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
179
179
  }
180
180
 
181
181
 
182
+ @Override
182
183
  public void set(float m00, float m01, float m02,
183
184
  float m10, float m11, float m12) {
184
185
  set(m00, m01, 0, m02,
@@ -188,6 +189,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
188
189
  }
189
190
 
190
191
 
192
+ @Override
191
193
  public void set(float m00, float m01, float m02, float m03,
192
194
  float m10, float m11, float m12, float m13,
193
195
  float m20, float m21, float m22, float m23,
@@ -199,6 +201,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
199
201
  }
200
202
 
201
203
 
204
+ @Override
202
205
  public void translate(float tx, float ty) {
203
206
  translate(tx, ty, 0);
204
207
  }
@@ -208,6 +211,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
208
211
  // }
209
212
 
210
213
 
214
+ @Override
211
215
  public void translate(float tx, float ty, float tz) {
212
216
  m03 += tx*m00 + ty*m01 + tz*m02;
213
217
  m13 += tx*m10 + ty*m11 + tz*m12;
@@ -216,11 +220,13 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
216
220
  }
217
221
 
218
222
 
223
+ @Override
219
224
  public void rotate(float angle) {
220
225
  rotateZ(angle);
221
226
  }
222
227
 
223
228
 
229
+ @Override
224
230
  public void rotateX(float angle) {
225
231
  float c = cos(angle);
226
232
  float s = sin(angle);
@@ -623,6 +629,7 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
623
629
  /**
624
630
  * Transpose this matrix; rows become columns and columns rows.
625
631
  */
632
+ @Override
626
633
  public void transpose() {
627
634
  float temp;
628
635
  temp = m01; m01 = m10; m10 = temp;
@@ -865,19 +872,19 @@ public final class PMatrix3D implements PMatrix /*, PConstants*/ {
865
872
  //////////////////////////////////////////////////////////////
866
873
 
867
874
 
868
- static private final float max(float a, float b) {
875
+ private static float max(float a, float b) {
869
876
  return (a > b) ? a : b;
870
877
  }
871
878
 
872
- static private final float abs(float a) {
879
+ private static float abs(float a) {
873
880
  return (a < 0) ? -a : a;
874
881
  }
875
882
 
876
- static private final float sin(float angle) {
883
+ private static float sin(float angle) {
877
884
  return (float) Math.sin(angle);
878
885
  }
879
886
 
880
- static private final float cos(float angle) {
887
+ private static float cos(float angle) {
881
888
  return (float) Math.cos(angle);
882
889
  }
883
890
  }
@@ -49,7 +49,7 @@ import java.util.Base64;
49
49
  * and Adobe Illustrator. It is not a full SVG implementation, but offers
50
50
  * some straightforward support for handling vector data.
51
51
  *
52
- *
52
+ * ( end auto-generated )
53
53
  * <h3>Advanced</h3>
54
54
  *
55
55
  * In-progress class to handle shape data, currently to be considered of
@@ -138,7 +138,7 @@ public class PShape implements PConstants {
138
138
  *
139
139
  * The width of the PShape document.
140
140
  *
141
- *
141
+ * ( end auto-generated )
142
142
  * @webref pshape:field
143
143
  * @usage web_application
144
144
  * @brief Shape document width
@@ -150,7 +150,7 @@ public class PShape implements PConstants {
150
150
  *
151
151
  * The height of the PShape document.
152
152
  *
153
- *
153
+ * ( end auto-generated )
154
154
  * @webref pshape:field
155
155
  * @usage web_application
156
156
  * @brief Shape document height
@@ -402,7 +402,7 @@ public class PShape implements PConstants {
402
402
  * created the SVG file. For instance, this parameter is controlled by
403
403
  * showing or hiding the shape in the layers palette in Adobe Illustrator.
404
404
  *
405
- *
405
+ * ( end auto-generated )
406
406
  * @webref pshape:method
407
407
  * @usage web_application
408
408
  * @brief Returns a boolean value "true" if the image is set to be visible, "false" if not
@@ -423,7 +423,7 @@ public class PShape implements PConstants {
423
423
  * created the SVG file. For instance, this parameter is controlled by
424
424
  * showing or hiding the shape in the layers palette in Adobe Illustrator.
425
425
  *
426
- *
426
+ * ( end auto-generated )
427
427
  * @webref pshape:mathod
428
428
  * @usage web_application
429
429
  * @brief Sets the shape to be visible or invisible
@@ -442,7 +442,7 @@ public class PShape implements PConstants {
442
442
  * Styles include attributes such as colors, stroke weight, and stroke
443
443
  * joints.
444
444
  *
445
- *
445
+ * ( end auto-generated )
446
446
  * <h3>Advanced</h3>
447
447
  * Overrides this shape's style information and uses PGraphics styles and
448
448
  * colors. Identical to ignoreStyles(true). Also disables styles for all
@@ -468,7 +468,7 @@ public class PShape implements PConstants {
468
468
  * Styles include attributes such as colors, stroke weight, and stroke
469
469
  * joints.
470
470
  *
471
- *
471
+ * ( end auto-generated )
472
472
  *
473
473
  * @webref pshape:method
474
474
  * @usage web_application
@@ -1448,25 +1448,18 @@ public class PShape implements PConstants {
1448
1448
  // TODO unapproved
1449
1449
  static protected PShape createShape(PApplet parent, PShape src) {
1450
1450
  PShape dest = null;
1451
- switch (src.family) {
1452
- case GROUP:
1453
- dest = parent.createShape(GROUP);
1454
- PShape.copyGroup(parent, src, dest);
1455
- break;
1456
- case PRIMITIVE:
1457
- dest = parent.createShape(src.kind, src.params);
1458
- PShape.copyPrimitive(src, dest);
1459
- break;
1460
- case GEOMETRY:
1461
- dest = parent.createShape(src.kind);
1462
- PShape.copyGeometry(src, dest);
1463
- break;
1464
- case PATH:
1465
- dest = parent.createShape(PATH);
1466
- PShape.copyPath(src, dest);
1467
- break;
1468
- default:
1469
- break;
1451
+ if (src.family == GROUP) {
1452
+ dest = parent.createShape(GROUP);
1453
+ PShape.copyGroup(parent, src, dest);
1454
+ } else if (src.family == PRIMITIVE) {
1455
+ dest = parent.createShape(src.kind, src.params);
1456
+ PShape.copyPrimitive(src, dest);
1457
+ } else if (src.family == GEOMETRY) {
1458
+ dest = parent.createShape(src.kind);
1459
+ PShape.copyGeometry(src, dest);
1460
+ } else if (src.family == PATH) {
1461
+ dest = parent.createShape(PATH);
1462
+ PShape.copyPath(src, dest);
1470
1463
  }
1471
1464
  dest.setName(src.name);
1472
1465
  return dest;
@@ -1614,23 +1607,16 @@ public class PShape implements PConstants {
1614
1607
  * Draws the SVG document.
1615
1608
  */
1616
1609
  protected void drawImpl(PGraphics g) {
1617
- switch (family) {
1618
- case GROUP:
1619
- drawGroup(g);
1620
- break;
1621
- case PRIMITIVE:
1622
- drawPrimitive(g);
1623
- break;
1624
- case GEOMETRY:
1625
- // Not same as path: `kind` matters.
1610
+ if (family == GROUP) {
1611
+ drawGroup(g);
1612
+ } else if (family == PRIMITIVE) {
1613
+ drawPrimitive(g);
1614
+ } else if (family == GEOMETRY) {
1615
+ // Not same as path: `kind` matters.
1626
1616
  // drawPath(g);
1627
- drawGeometry(g);
1628
- break;
1629
- case PATH:
1630
- drawPath(g);
1631
- break;
1632
- default:
1633
- break;
1617
+ drawGeometry(g);
1618
+ } else if (family == PATH) {
1619
+ drawPath(g);
1634
1620
  }
1635
1621
  }
1636
1622
 
@@ -1643,97 +1629,88 @@ public class PShape implements PConstants {
1643
1629
 
1644
1630
 
1645
1631
  protected void drawPrimitive(PGraphics g) {
1646
- switch (kind) {
1647
- case POINT:
1648
- g.point(params[0], params[1]);
1649
- break;
1650
- case LINE:
1651
- if (params.length == 4) { // 2D
1652
- g.line(params[0], params[1],
1653
- params[2], params[3]);
1654
- } else { // 3D
1655
- g.line(params[0], params[1], params[2],
1656
- params[3], params[4], params[5]);
1657
- } break;
1658
- case TRIANGLE:
1659
- g.triangle(params[0], params[1],
1660
- params[2], params[3],
1661
- params[4], params[5]);
1662
- break;
1663
- case QUAD:
1664
- g.quad(params[0], params[1],
1665
- params[2], params[3],
1666
- params[4], params[5],
1667
- params[6], params[7]);
1668
- break;
1669
- case RECT:
1670
- if (imagePath != null){
1632
+ if (kind == POINT) {
1633
+ g.point(params[0], params[1]);
1634
+
1635
+ } else if (kind == LINE) {
1636
+ if (params.length == 4) { // 2D
1637
+ g.line(params[0], params[1],
1638
+ params[2], params[3]);
1639
+ } else { // 3D
1640
+ g.line(params[0], params[1], params[2],
1641
+ params[3], params[4], params[5]);
1642
+ }
1643
+
1644
+ } else if (kind == TRIANGLE) {
1645
+ g.triangle(params[0], params[1],
1646
+ params[2], params[3],
1647
+ params[4], params[5]);
1648
+
1649
+ } else if (kind == QUAD) {
1650
+ g.quad(params[0], params[1],
1651
+ params[2], params[3],
1652
+ params[4], params[5],
1653
+ params[6], params[7]);
1654
+
1655
+ } else if (kind == RECT) {
1656
+
1657
+ if (imagePath != null){
1671
1658
  loadImage(g);
1672
- } if (image != null) {
1673
- int oldMode = g.imageMode;
1674
- g.imageMode(CORNER);
1675
- g.image(image, params[0], params[1], params[2], params[3]);
1676
- g.imageMode(oldMode);
1677
- } else {
1678
- int oldMode = g.rectMode;
1679
- g.rectMode(rectMode);
1680
- switch (params.length) {
1681
- case 4:
1659
+ }
1660
+ if (image != null) {
1661
+ int oldMode = g.imageMode;
1662
+ g.imageMode(CORNER);
1663
+ g.image(image, params[0], params[1], params[2], params[3]);
1664
+ g.imageMode(oldMode);
1665
+ } else {
1666
+ int oldMode = g.rectMode;
1667
+ g.rectMode(rectMode);
1668
+ if (params.length == 4) {
1682
1669
  g.rect(params[0], params[1],
1683
- params[2], params[3]);
1684
- break;
1685
- case 5:
1670
+ params[2], params[3]);
1671
+ } else if (params.length == 5) {
1686
1672
  g.rect(params[0], params[1],
1687
- params[2], params[3],
1688
- params[4]);
1689
- break;
1690
- case 8:
1673
+ params[2], params[3],
1674
+ params[4]);
1675
+ } else if (params.length == 8) {
1691
1676
  g.rect(params[0], params[1],
1692
- params[2], params[3],
1693
- params[4], params[5],
1694
- params[6], params[7]);
1695
- break;
1696
- default:
1697
- break;
1698
- }
1699
- g.rectMode(oldMode);
1700
- } break;
1701
- case ELLIPSE:
1702
- {
1703
- int oldMode = g.ellipseMode;
1704
- g.ellipseMode(ellipseMode);
1705
- g.ellipse(params[0], params[1],
1706
- params[2], params[3]);
1707
- g.ellipseMode(oldMode);
1708
- break;
1677
+ params[2], params[3],
1678
+ params[4], params[5],
1679
+ params[6], params[7]);
1709
1680
  }
1710
- case ARC:
1711
- {
1712
- int oldMode = g.ellipseMode;
1713
- g.ellipseMode(ellipseMode);
1714
- if (params.length == 6) {
1715
- g.arc(params[0], params[1],
1681
+ g.rectMode(oldMode);
1682
+ }
1683
+ } else if (kind == ELLIPSE) {
1684
+ int oldMode = g.ellipseMode;
1685
+ g.ellipseMode(ellipseMode);
1686
+ g.ellipse(params[0], params[1],
1687
+ params[2], params[3]);
1688
+ g.ellipseMode(oldMode);
1689
+
1690
+ } else if (kind == ARC) {
1691
+ int oldMode = g.ellipseMode;
1692
+ g.ellipseMode(ellipseMode);
1693
+ if (params.length == 6) {
1694
+ g.arc(params[0], params[1],
1716
1695
  params[2], params[3],
1717
1696
  params[4], params[5]);
1718
- } else if (params.length == 7) {
1719
- g.arc(params[0], params[1],
1697
+ } else if (params.length == 7) {
1698
+ g.arc(params[0], params[1],
1720
1699
  params[2], params[3],
1721
1700
  params[4], params[5],
1722
1701
  (int) params[6]);
1723
- } g.ellipseMode(oldMode);
1724
- break;
1725
- }
1726
- case BOX:
1727
- if (params.length == 1) {
1728
- g.box(params[0]);
1729
- } else {
1730
- g.box(params[0], params[1], params[2]);
1731
- } break;
1732
- case SPHERE:
1733
- g.sphere(params[0]);
1734
- break;
1735
- default:
1736
- break;
1702
+ }
1703
+ g.ellipseMode(oldMode);
1704
+
1705
+ } else if (kind == BOX) {
1706
+ if (params.length == 1) {
1707
+ g.box(params[0]);
1708
+ } else {
1709
+ g.box(params[0], params[1], params[2]);
1710
+ }
1711
+
1712
+ } else if (kind == SPHERE) {
1713
+ g.sphere(params[0]);
1737
1714
  }
1738
1715
  }
1739
1716
 
@@ -2026,7 +2003,7 @@ public class PShape implements PConstants {
2026
2003
  * shape with the <b>target</b> parameter. The shape is returned as a
2027
2004
  * <b>PShape</b> object, or <b>null</b> is returned if there is an error.
2028
2005
  *
2029
- *
2006
+ * ( end auto-generated )
2030
2007
  * @webref pshape:method
2031
2008
  * @usage web_application
2032
2009
  * @brief Returns a child element of a shape as a PShape object
@@ -2060,6 +2037,8 @@ public class PShape implements PConstants {
2060
2037
  /**
2061
2038
  * Same as getChild(name), except that it first walks all the way up the
2062
2039
  * hierarchy to the eldest grandparent, so that children can be found anywhere.
2040
+ * @param target
2041
+ * @return
2063
2042
  */
2064
2043
  public PShape findChild(String target) {
2065
2044
  if (parent == null) {
@@ -2123,6 +2102,7 @@ public class PShape implements PConstants {
2123
2102
 
2124
2103
  /**
2125
2104
  * Remove the child shape with index idx.
2105
+ * @param idx
2126
2106
  */
2127
2107
  public void removeChild(int idx) {
2128
2108
  if (idx < childCount) {
@@ -2177,7 +2157,8 @@ public class PShape implements PConstants {
2177
2157
  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2178
2158
 
2179
2159
 
2180
- /** The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY. */
2160
+ /** The shape type, one of GROUP, PRIMITIVE, PATH, or GEOMETRY.
2161
+ * @return */
2181
2162
  public int getFamily() {
2182
2163
  return family;
2183
2164
  }
@@ -2505,7 +2486,7 @@ public class PShape implements PConstants {
2505
2486
  * created, only the <b>setFill()</b> method can define a new fill value for
2506
2487
  * the <b>PShape</b>.
2507
2488
  *
2508
- *
2489
+ * ( end auto-generated )
2509
2490
  *
2510
2491
  * @webref
2511
2492
  * @param fill
@@ -2617,7 +2598,7 @@ public class PShape implements PConstants {
2617
2598
  vertices[index][PGraphics.A] = ((tint >> 24) & 0xFF) / 255.0f;
2618
2599
  vertices[index][PGraphics.R] = ((tint >> 16) & 0xFF) / 255.0f;
2619
2600
  vertices[index][PGraphics.G] = ((tint >> 8) & 0xFF) / 255.0f;
2620
- vertices[index][PGraphics.B] = ((tint >> 0) & 0xFF) / 255.0f;
2601
+ vertices[index][PGraphics.B] = ((tint) & 0xFF) / 255.0f;
2621
2602
  }
2622
2603
  }
2623
2604
 
@@ -2661,7 +2642,7 @@ public class PShape implements PConstants {
2661
2642
  * However, after the shape is created, only the <b>setStroke()</b> method
2662
2643
  * can define a new stroke value for the <b>PShape</b>.
2663
2644
  *
2664
- *
2645
+ * ( end auto-generated )
2665
2646
  *
2666
2647
  * @webref
2667
2648
  * @param stroke
@@ -2705,7 +2686,7 @@ public class PShape implements PConstants {
2705
2686
  vertices[index][PGraphics.SA] = ((stroke >> 24) & 0xFF) / 255.0f;
2706
2687
  vertices[index][PGraphics.SR] = ((stroke >> 16) & 0xFF) / 255.0f;
2707
2688
  vertices[index][PGraphics.SG] = ((stroke >> 8) & 0xFF) / 255.0f;
2708
- vertices[index][PGraphics.SB] = ((stroke) & 0xFF) / 255.0f;
2689
+ vertices[index][PGraphics.SB] = ((stroke >> 0) & 0xFF) / 255.0f;
2709
2690
  }
2710
2691
 
2711
2692
 
@@ -2869,7 +2850,7 @@ public class PShape implements PConstants {
2869
2850
 
2870
2851
  vertices[index][PGraphics.SPR] = ((specular >> 16) & 0xFF) / 255.0f;
2871
2852
  vertices[index][PGraphics.SPG] = ((specular >> 8) & 0xFF) / 255.0f;
2872
- vertices[index][PGraphics.SPB] = ((specular) & 0xFF) / 255.0f;
2853
+ vertices[index][PGraphics.SPB] = ((specular >> 0) & 0xFF) / 255.0f;
2873
2854
  }
2874
2855
 
2875
2856
 
@@ -2918,7 +2899,7 @@ public class PShape implements PConstants {
2918
2899
 
2919
2900
  vertices[index][PGraphics.ER] = ((emissive >> 16) & 0xFF) / 255.0f;
2920
2901
  vertices[index][PGraphics.EG] = ((emissive >> 8) & 0xFF) / 255.0f;
2921
- vertices[index][PGraphics.EB] = ((emissive) & 0xFF) / 255.0f;
2902
+ vertices[index][PGraphics.EB] = ((emissive >> 0) & 0xFF) / 255.0f;
2922
2903
  }
2923
2904
 
2924
2905
 
@@ -3005,43 +2986,44 @@ public class PShape implements PConstants {
3005
2986
  * with PATH shapes or GROUP shapes that contain other GROUPs or PATHs.
3006
2987
  */
3007
2988
  public boolean contains(float x, float y) {
3008
- switch (family) {
3009
- case PATH:
3010
- PVector p = new PVector(x, y);
3011
- if (matrix != null) {
3012
- // apply the inverse transformation matrix to the point coordinates
3013
- PMatrix inverseCoords = matrix.get();
3014
- // TODO why is this called twice? [fry 190724]
3015
- // commit was https://github.com/processing/processing/commit/027fc7a4f8e8d0a435366eae754304eea282512a
3016
- inverseCoords.invert(); // maybe cache this?
3017
- inverseCoords.invert(); // maybe cache this?
3018
- inverseCoords.mult(new PVector(x, y), p);
3019
- }
3020
-
3021
- // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
3022
- boolean c = false;
3023
- for (int i = 0, j = vertexCount-1; i < vertexCount; j = i++) {
3024
- if (((vertices[i][Y] > p.y) != (vertices[j][Y] > p.y)) &&
2989
+ if (family == PATH) {
2990
+ PVector p = new PVector(x, y);
2991
+ if (matrix != null) {
2992
+ // apply the inverse transformation matrix to the point coordinates
2993
+ PMatrix inverseCoords = matrix.get();
2994
+ // TODO why is this called twice? [fry 190724]
2995
+ // commit was https://github.com/processing/processing/commit/027fc7a4f8e8d0a435366eae754304eea282512a
2996
+ inverseCoords.invert(); // maybe cache this?
2997
+ inverseCoords.invert(); // maybe cache this?
2998
+ inverseCoords.mult(new PVector(x, y), p);
2999
+ }
3000
+
3001
+ // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
3002
+ boolean c = false;
3003
+ for (int i = 0, j = vertexCount-1; i < vertexCount; j = i++) {
3004
+ if (((vertices[i][Y] > p.y) != (vertices[j][Y] > p.y)) &&
3025
3005
  (p.x <
3026
- (vertices[j][X]-vertices[i][X]) *
3027
- (y-vertices[i][Y]) /
3028
- (vertices[j][1]-vertices[i][Y]) +
3029
- vertices[i][X])) {
3030
- c = !c;
3031
- }
3032
- }
3033
- return c;
3034
- case GROUP:
3035
- // If this is a group, loop through children until we find one that
3036
- // contains the supplied coordinates. If a child does not support
3037
- // contains() throw a warning and continue.
3038
- for (int i = 0; i < childCount; i++) {
3039
- if (children[i].contains(x, y)) return true;
3006
+ (vertices[j][X]-vertices[i][X]) *
3007
+ (y-vertices[i][Y]) /
3008
+ (vertices[j][1]-vertices[i][Y]) +
3009
+ vertices[i][X])) {
3010
+ c = !c;
3040
3011
  }
3041
- return false;
3042
- default:
3043
- // https://github.com/processing/processing/issues/1280
3044
- throw new IllegalArgumentException("The contains() method is only implemented for paths.");
3012
+ }
3013
+ return c;
3014
+
3015
+ } else if (family == GROUP) {
3016
+ // If this is a group, loop through children until we find one that
3017
+ // contains the supplied coordinates. If a child does not support
3018
+ // contains() throw a warning and continue.
3019
+ for (int i = 0; i < childCount; i++) {
3020
+ if (children[i].contains(x, y)) return true;
3021
+ }
3022
+ return false;
3023
+
3024
+ } else {
3025
+ // https://github.com/processing/processing/issues/1280
3026
+ throw new IllegalArgumentException("The contains() method is only implemented for paths.");
3045
3027
  }
3046
3028
  }
3047
3029
 
@@ -3070,7 +3052,7 @@ public class PShape implements PConstants {
3070
3052
  * Using this method with the <b>z</b> parameter requires using the P3D
3071
3053
  * parameter in combination with size.
3072
3054
  *
3073
- *
3055
+ * ( end auto-generated )
3074
3056
  * @webref pshape:method
3075
3057
  * @usage web_application
3076
3058
  * @brief Displaces the shape
@@ -3110,7 +3092,7 @@ public class PShape implements PConstants {
3110
3092
  * This method requires a 3D renderer. You need to use P3D as a third
3111
3093
  * parameter for the <b>size()</b> function as shown in the example above.
3112
3094
  *
3113
- *
3095
+ * ( end auto-generated )
3114
3096
  * @webref pshape:method
3115
3097
  * @usage web_application
3116
3098
  * @brief Rotates the shape around the x-axis
@@ -3143,7 +3125,7 @@ public class PShape implements PConstants {
3143
3125
  * This method requires a 3D renderer. You need to use P3D as a third
3144
3126
  * parameter for the <b>size()</b> function as shown in the example above.
3145
3127
  *
3146
- *
3128
+ * ( end auto-generated )
3147
3129
  *
3148
3130
  * @webref pshape:method
3149
3131
  * @usage web_application
@@ -3178,7 +3160,7 @@ public class PShape implements PConstants {
3178
3160
  * This method requires a 3D renderer. You need to use P3D as a third
3179
3161
  * parameter for the <b>size()</b> function as shown in the example above.
3180
3162
  *
3181
- *
3163
+ * ( end auto-generated )
3182
3164
  * @webref pshape:method
3183
3165
  * @usage web_application
3184
3166
  * @brief Rotates the shape around the z-axis
@@ -3209,7 +3191,7 @@ public class PShape implements PConstants {
3209
3191
  * <b>rotate(PI)</b>. This transformation is applied directly to the shape,
3210
3192
  * it's not refreshed each time <b>draw()</b> is run.
3211
3193
  *
3212
- *
3194
+ * ( end auto-generated )
3213
3195
  * @webref pshape:method
3214
3196
  * @usage web_application
3215
3197
  * @brief Rotates the shape
@@ -3260,7 +3242,7 @@ public class PShape implements PConstants {
3260
3242
  * Using this method with the <b>z</b> parameter requires using the P3D
3261
3243
  * parameter in combination with size.
3262
3244
  *
3263
- *
3245
+ * ( end auto-generated )
3264
3246
  * @webref pshape:method
3265
3247
  * @usage web_application
3266
3248
  * @brief Increases and decreases the size of a shape
@@ -3299,7 +3281,7 @@ public class PShape implements PConstants {
3299
3281
  * Replaces the current matrix of a shape with the identity matrix. The
3300
3282
  * equivalent function in OpenGL is glLoadIdentity().
3301
3283
  *
3302
- *
3284
+ * ( end auto-generated )
3303
3285
  * @webref pshape:method
3304
3286
  * @brief Replaces the current matrix of a shape with the identity matrix
3305
3287
  * @usage web_application