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.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +1 -1
- data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
- data/.mvn/wrapper/maven-wrapper.properties +2 -2
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -1
- data/README.md +7 -22
- data/Rakefile +3 -2
- data/lib/propane.rb +2 -1
- data/lib/propane/app.rb +4 -0
- data/lib/propane/helper_methods.rb +0 -1
- data/lib/propane/runner.rb +12 -12
- data/lib/propane/version.rb +1 -1
- data/library/pdf/pdf.rb +7 -0
- data/library/svg/svg.rb +7 -0
- data/pom.rb +65 -43
- data/pom.xml +44 -5
- data/propane.gemspec +9 -4
- data/src/main/java/japplemenubar/JAppleMenuBar.java +3 -3
- data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
- data/src/main/java/monkstone/noise/FastTerrain.java +874 -0
- data/src/main/java/monkstone/noise/Noise.java +90 -0
- data/src/main/java/monkstone/noise/NoiseGenerator.java +75 -0
- data/src/main/java/monkstone/noise/NoiseMode.java +28 -0
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +881 -0
- data/src/main/java/monkstone/noise/OpenSimplex2S.java +1106 -0
- data/src/main/java/monkstone/noise/SmoothTerrain.java +1099 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +8 -17
- data/src/main/java/processing/awt/PImageAWT.java +123 -6
- data/src/main/java/processing/awt/PShapeJava2D.java +1 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +9 -7
- data/src/main/java/processing/awt/ShimAWT.java +2 -1
- data/src/main/java/processing/core/PApplet.java +13297 -14838
- data/src/main/java/processing/core/PConstants.java +5 -5
- data/src/main/java/processing/core/PFont.java +5 -17
- data/src/main/java/processing/core/PGraphics.java +346 -351
- data/src/main/java/processing/core/PImage.java +1440 -1537
- data/src/main/java/processing/core/PMatrix2D.java +24 -7
- data/src/main/java/processing/core/PMatrix3D.java +12 -5
- data/src/main/java/processing/core/PShape.java +155 -173
- data/src/main/java/processing/core/PShapeOBJ.java +2 -0
- data/src/main/java/processing/core/PShapeSVG.java +632 -611
- data/src/main/java/processing/core/PSurface.java +15 -10
- data/src/main/java/processing/core/PSurfaceNone.java +8 -4
- data/src/main/java/processing/core/PVector.java +35 -28
- data/src/main/java/processing/data/Table.java +20 -20
- data/src/main/java/processing/data/XML.java +1 -1
- data/src/main/java/processing/event/Event.java +1 -1
- data/src/main/java/processing/event/MouseEvent.java +7 -6
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +20 -345
- data/src/main/java/processing/javafx/PSurfaceFX.java +127 -125
- data/src/main/java/processing/opengl/FrameBuffer.java +2 -4
- data/src/main/java/processing/opengl/LinePath.java +4 -0
- data/src/main/java/processing/opengl/LineStroker.java +2 -6
- data/src/main/java/processing/opengl/PGL.java +72 -45
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +106 -60
- data/src/main/java/processing/opengl/PJOGL.java +15 -3
- data/src/main/java/processing/opengl/PShader.java +26 -47
- data/src/main/java/processing/opengl/PShapeOpenGL.java +1041 -1001
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +211 -208
- data/src/main/java/processing/opengl/Texture.java +7 -4
- data/src/main/java/processing/opengl/VertexBuffer.java +2 -2
- data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
- data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
- data/test/deglut_spec_test.rb +2 -2
- data/vendors/Rakefile +22 -33
- metadata +53 -21
- data/library/simplex_noise/simplex_noise.rb +0 -5
- 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 <
|
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
|
-
|
543
|
+
private static float max(float a, float b) {
|
527
544
|
return (a > b) ? a : b;
|
528
545
|
}
|
529
546
|
|
530
|
-
|
547
|
+
private static float abs(float a) {
|
531
548
|
return (a < 0) ? -a : a;
|
532
549
|
}
|
533
550
|
|
534
|
-
|
551
|
+
private static float sin(float angle) {
|
535
552
|
return (float)Math.sin(angle);
|
536
553
|
}
|
537
554
|
|
538
|
-
|
555
|
+
private static float cos(float angle) {
|
539
556
|
return (float)Math.cos(angle);
|
540
557
|
}
|
541
558
|
|
542
|
-
|
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
|
-
|
875
|
+
private static float max(float a, float b) {
|
869
876
|
return (a > b) ? a : b;
|
870
877
|
}
|
871
878
|
|
872
|
-
|
879
|
+
private static float abs(float a) {
|
873
880
|
return (a < 0) ? -a : a;
|
874
881
|
}
|
875
882
|
|
876
|
-
|
883
|
+
private static float sin(float angle) {
|
877
884
|
return (float) Math.sin(angle);
|
878
885
|
}
|
879
886
|
|
880
|
-
|
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
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
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
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
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
|
-
|
1628
|
-
|
1629
|
-
|
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
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
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
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
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
|
-
|
1684
|
-
|
1685
|
-
case 5:
|
1670
|
+
params[2], params[3]);
|
1671
|
+
} else if (params.length == 5) {
|
1686
1672
|
g.rect(params[0], params[1],
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
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
|
-
|
1693
|
-
|
1694
|
-
|
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
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
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
|
-
|
1719
|
-
|
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
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
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
|
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
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
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
|
-
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
|
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
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
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
|