propane 3.3.1-java → 3.4.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/MavenWrapperDownloader.java +117 -0
- data/.mvn/wrapper/maven-wrapper.properties +2 -3
- data/.travis.yml +9 -0
- data/CHANGELOG.md +7 -5
- data/README.md +1 -1
- data/Rakefile +8 -21
- data/lib/propane/native_folder.rb +16 -11
- data/lib/propane/version.rb +1 -1
- data/mvnw +127 -51
- data/mvnw.cmd +182 -145
- data/pom.rb +50 -48
- data/pom.xml +15 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +2 -2
- data/src/main/java/processing/awt/PGraphicsJava2D.java +1616 -1609
- data/src/main/java/processing/awt/PShapeJava2D.java +273 -265
- data/src/main/java/processing/awt/PSurfaceAWT.java +830 -817
- data/src/main/java/processing/core/PApplet.java +3990 -3990
- data/src/main/java/processing/core/PGraphics.java +37 -37
- data/src/main/java/processing/core/PImage.java +9 -9
- data/src/main/java/processing/core/PMatrix2D.java +6 -0
- data/src/main/java/processing/core/PShape.java +2 -2
- data/src/main/java/processing/core/PShapeOBJ.java +425 -409
- data/src/main/java/processing/core/PShapeSVG.java +167 -159
- data/src/main/java/processing/core/PSurfaceNone.java +10 -0
- data/src/main/java/processing/core/ThinkDifferent.java +7 -14
- data/src/main/java/processing/event/Event.java +7 -6
- metadata +9 -7
@@ -1076,41 +1076,39 @@ public class PShapeSVG extends PShape {
|
|
1076
1076
|
return null;
|
1077
1077
|
}
|
1078
1078
|
float[] m = PApplet.parseFloat(PApplet.splitTokens(pieces[2], ", "));
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
float
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
return new PMatrix2D(1, 0, 1, 0, PApplet.tan(m[0]), 0);
|
1113
|
-
}
|
1079
|
+
switch (pieces[1]) {
|
1080
|
+
case "matrix":
|
1081
|
+
return new PMatrix2D(m[0], m[2], m[4], m[1], m[3], m[5]);
|
1082
|
+
case "translate":
|
1083
|
+
float tx = m[0];
|
1084
|
+
float ty = (m.length == 2) ? m[1] : m[0];
|
1085
|
+
return new PMatrix2D(1, 0, tx, 0, 1, ty);
|
1086
|
+
case "scale":
|
1087
|
+
float sx = m[0];
|
1088
|
+
float sy = (m.length == 2) ? m[1] : m[0];
|
1089
|
+
return new PMatrix2D(sx, 0, 0, 0, sy, 0);
|
1090
|
+
case "rotate":
|
1091
|
+
float angle = m[0];
|
1092
|
+
if (m.length == 1) {
|
1093
|
+
float c = PApplet.cos(angle);
|
1094
|
+
float s = PApplet.sin(angle);
|
1095
|
+
// SVG version is cos(a) sin(a) -sin(a) cos(a) 0 0
|
1096
|
+
return new PMatrix2D(c, -s, 0, s, c, 0);
|
1097
|
+
|
1098
|
+
} else if (m.length == 3) {
|
1099
|
+
PMatrix2D mat = new PMatrix2D(0, 1, m[1], 1, 0, m[2]);
|
1100
|
+
mat.rotate(m[0]);
|
1101
|
+
mat.translate(-m[1], -m[2]);
|
1102
|
+
return mat;
|
1103
|
+
}
|
1104
|
+
break;
|
1105
|
+
case "skewX":
|
1106
|
+
return new PMatrix2D(1, 0, 1, PApplet.tan(m[0]), 0, 0);
|
1107
|
+
case "skewY":
|
1108
|
+
return new PMatrix2D(1, 0, 1, 0, PApplet.tan(m[0]), 0);
|
1109
|
+
default:
|
1110
|
+
break;
|
1111
|
+
}
|
1114
1112
|
return null;
|
1115
1113
|
}
|
1116
1114
|
|
@@ -1162,41 +1160,41 @@ public class PShapeSVG extends PShape {
|
|
1162
1160
|
String styleText = properties.getString("style");
|
1163
1161
|
String[] styleTokens = PApplet.splitTokens(styleText, ";");
|
1164
1162
|
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1163
|
+
//PApplet.println(styleTokens);
|
1164
|
+
for (var styleToken : styleTokens) {
|
1165
|
+
String[] tokens = PApplet.splitTokens(styleToken, ":");
|
1166
|
+
//PApplet.println(tokens);
|
1167
|
+
tokens[0] = PApplet.trim(tokens[0]);
|
1168
|
+
switch (tokens[0]) {
|
1169
|
+
case "fill":
|
1170
|
+
setColor(tokens[1], true);
|
1171
|
+
break;
|
1172
|
+
case "fill-opacity":
|
1173
|
+
setFillOpacity(tokens[1]);
|
1174
|
+
break;
|
1175
|
+
case "stroke":
|
1176
|
+
setColor(tokens[1], false);
|
1177
|
+
break;
|
1178
|
+
case "stroke-width":
|
1179
|
+
setStrokeWeight(tokens[1]);
|
1180
|
+
break;
|
1181
|
+
case "stroke-linecap":
|
1182
|
+
setStrokeCap(tokens[1]);
|
1183
|
+
break;
|
1184
|
+
case "stroke-linejoin":
|
1185
|
+
setStrokeJoin(tokens[1]);
|
1186
|
+
break;
|
1187
|
+
case "stroke-opacity":
|
1188
|
+
setStrokeOpacity(tokens[1]);
|
1189
|
+
break;
|
1190
|
+
case "opacity":
|
1191
|
+
setOpacity(tokens[1]);
|
1192
|
+
break;
|
1193
|
+
// Other attributes are not yet implemented
|
1194
|
+
default:
|
1195
|
+
break;
|
1196
|
+
}
|
1197
|
+
}
|
1200
1198
|
}
|
1201
1199
|
}
|
1202
1200
|
|
@@ -1216,33 +1214,41 @@ public class PShapeSVG extends PShape {
|
|
1216
1214
|
}
|
1217
1215
|
|
1218
1216
|
void setStrokeJoin(String linejoin) {
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1217
|
+
switch (linejoin) {
|
1218
|
+
// do nothing, will inherit automatically
|
1219
|
+
case "inherit":
|
1220
|
+
break;
|
1221
|
+
case "miter":
|
1222
|
+
strokeJoin = PConstants.MITER;
|
1223
|
+
break;
|
1224
|
+
case "round":
|
1225
|
+
strokeJoin = PConstants.ROUND;
|
1226
|
+
break;
|
1227
|
+
case "bevel":
|
1228
|
+
strokeJoin = PConstants.BEVEL;
|
1229
|
+
break;
|
1230
|
+
default:
|
1231
|
+
break;
|
1232
|
+
}
|
1231
1233
|
}
|
1232
1234
|
|
1233
1235
|
void setStrokeCap(String linecap) {
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1236
|
+
switch (linecap) {
|
1237
|
+
// do nothing, will inherit automatically
|
1238
|
+
case "inherit":
|
1239
|
+
break;
|
1240
|
+
case "butt":
|
1241
|
+
strokeCap = PConstants.SQUARE;
|
1242
|
+
break;
|
1243
|
+
case "round":
|
1244
|
+
strokeCap = PConstants.ROUND;
|
1245
|
+
break;
|
1246
|
+
case "square":
|
1247
|
+
strokeCap = PConstants.PROJECT;
|
1248
|
+
break;
|
1249
|
+
default:
|
1250
|
+
break;
|
1251
|
+
}
|
1246
1252
|
}
|
1247
1253
|
|
1248
1254
|
void setFillOpacity(String opacityText) {
|
@@ -1394,11 +1400,11 @@ public class PShapeSVG extends PShape {
|
|
1394
1400
|
// if (style == null) return table;
|
1395
1401
|
if (style != null) {
|
1396
1402
|
String[] pieces = style.split(";");
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1403
|
+
for (String piece : pieces) {
|
1404
|
+
String[] parts = piece.split(":");
|
1405
|
+
//table.put(parts[0], parts[1]);
|
1406
|
+
table.set(parts[0], parts[1]);
|
1407
|
+
}
|
1402
1408
|
}
|
1403
1409
|
return table;
|
1404
1410
|
}
|
@@ -1482,38 +1488,37 @@ public class PShapeSVG extends PShape {
|
|
1482
1488
|
offset = new float[elements.length];
|
1483
1489
|
color = new int[elements.length];
|
1484
1490
|
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
opacityStr = "1";
|
1509
|
-
}
|
1510
|
-
}
|
1511
|
-
int tupacity = PApplet.constrain(
|
1512
|
-
(int) (PApplet.parseFloat(opacityStr) * 255), 0, 255);
|
1513
|
-
color[count] = (tupacity << 24) | parseSimpleColor(colorStr);
|
1514
|
-
count++;
|
1491
|
+
// <stop offset="0" style="stop-color:#967348"/>
|
1492
|
+
for (XML elem : elements) {
|
1493
|
+
String name = elem.getName();
|
1494
|
+
if (name.equals("stop")) {
|
1495
|
+
String offsetAttr = elem.getString("offset");
|
1496
|
+
offset[count] = parseFloatOrPercent(offsetAttr);
|
1497
|
+
|
1498
|
+
String style = elem.getString("style");
|
1499
|
+
//Map<String, String> styles = parseStyleAttributes(style);
|
1500
|
+
StringDict styles = parseStyleAttributes(style);
|
1501
|
+
|
1502
|
+
String colorStr = styles.get("stop-color");
|
1503
|
+
if (colorStr == null) {
|
1504
|
+
colorStr = elem.getString("stop-color");
|
1505
|
+
if (colorStr == null) {
|
1506
|
+
colorStr = "#000000";
|
1507
|
+
}
|
1508
|
+
}
|
1509
|
+
String opacityStr = styles.get("stop-opacity");
|
1510
|
+
if (opacityStr == null) {
|
1511
|
+
opacityStr = elem.getString("stop-opacity");
|
1512
|
+
if (opacityStr == null) {
|
1513
|
+
opacityStr = "1";
|
1515
1514
|
}
|
1515
|
+
}
|
1516
|
+
int tupacity = PApplet.constrain(
|
1517
|
+
(int) (PApplet.parseFloat(opacityStr) * 255), 0, 255);
|
1518
|
+
color[count] = (tupacity << 24) | parseSimpleColor(colorStr);
|
1519
|
+
count++;
|
1516
1520
|
}
|
1521
|
+
}
|
1517
1522
|
offset = PApplet.subset(offset, 0, count);
|
1518
1523
|
color = PApplet.subset(color, 0, count);
|
1519
1524
|
}
|
@@ -1599,37 +1604,40 @@ public class PShapeSVG extends PShape {
|
|
1599
1604
|
|
1600
1605
|
horizAdvX = properties.getInt("horiz-adv-x", 0);
|
1601
1606
|
|
1602
|
-
namedGlyphs = new HashMap
|
1603
|
-
unicodeGlyphs = new HashMap
|
1607
|
+
namedGlyphs = new HashMap<>();
|
1608
|
+
unicodeGlyphs = new HashMap<>();
|
1604
1609
|
glyphCount = 0;
|
1605
1610
|
glyphs = new FontGlyph[elements.length];
|
1606
1611
|
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
if (fg.unicode != 0) {
|
1619
|
-
unicodeGlyphs.put(Character.valueOf(fg.unicode), fg);
|
1620
|
-
}
|
1612
|
+
for (XML element1 : elements) {
|
1613
|
+
String name = element1.getName();
|
1614
|
+
XML elem = element1;
|
1615
|
+
if (null == name) {
|
1616
|
+
// skip it
|
1617
|
+
} else switch (name) {
|
1618
|
+
case "glyph":
|
1619
|
+
FontGlyph fg = new FontGlyph(this, elem, this);
|
1620
|
+
if (fg.isLegit()) {
|
1621
|
+
if (fg.name != null) {
|
1622
|
+
namedGlyphs.put(fg.name, fg);
|
1621
1623
|
}
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1624
|
+
if (fg.unicode != 0) {
|
1625
|
+
unicodeGlyphs.put(fg.unicode, fg);
|
1626
|
+
}
|
1627
|
+
} glyphs[glyphCount++] = fg;
|
1628
|
+
break;
|
1629
|
+
case "missing-glyph":
|
1630
|
+
// System.out.println("got missing glyph inside <font>");
|
1631
|
+
missingGlyph = new FontGlyph(this, elem, this);
|
1632
|
+
break;
|
1633
|
+
case "font-face":
|
1634
|
+
face = new FontFace(this, elem);
|
1635
|
+
break;
|
1636
|
+
default:
|
1637
|
+
System.err.println("Ignoring " + name + " inside <font>");
|
1638
|
+
break;
|
1639
|
+
}
|
1640
|
+
}
|
1633
1641
|
}
|
1634
1642
|
|
1635
1643
|
protected void drawShape() {
|
@@ -1648,7 +1656,7 @@ public class PShapeSVG extends PShape {
|
|
1648
1656
|
char[] c = str.toCharArray();
|
1649
1657
|
for (int i = 0; i < c.length; i++) {
|
1650
1658
|
// call draw on each char (pulling it w/ the unicode table)
|
1651
|
-
FontGlyph fg = unicodeGlyphs.get(
|
1659
|
+
FontGlyph fg = unicodeGlyphs.get(c[i]);
|
1652
1660
|
if (fg != null) {
|
1653
1661
|
fg.draw(g);
|
1654
1662
|
// add horizAdvX/unitsPerEm to the x coordinate along the way
|
@@ -1665,7 +1673,7 @@ public class PShapeSVG extends PShape {
|
|
1665
1673
|
float s = size / face.unitsPerEm;
|
1666
1674
|
g.translate(x, y);
|
1667
1675
|
g.scale(s, -s);
|
1668
|
-
FontGlyph fg = unicodeGlyphs.get(
|
1676
|
+
FontGlyph fg = unicodeGlyphs.get(c);
|
1669
1677
|
if (fg != null) {
|
1670
1678
|
g.shape(fg);
|
1671
1679
|
}
|
@@ -1677,7 +1685,7 @@ public class PShapeSVG extends PShape {
|
|
1677
1685
|
char[] c = str.toCharArray();
|
1678
1686
|
for (int i = 0; i < c.length; i++) {
|
1679
1687
|
// call draw on each char (pulling it w/ the unicode table)
|
1680
|
-
FontGlyph fg = unicodeGlyphs.get(
|
1688
|
+
FontGlyph fg = unicodeGlyphs.get(c[i]);
|
1681
1689
|
if (fg != null) {
|
1682
1690
|
w += (float) fg.horizAdvX / face.unitsPerEm;
|
1683
1691
|
}
|
@@ -55,6 +55,7 @@ public class PSurfaceNone implements PSurface {
|
|
55
55
|
+ getClass().getSimpleName());
|
56
56
|
}
|
57
57
|
|
58
|
+
@Override
|
58
59
|
public Object getNative() {
|
59
60
|
return null;
|
60
61
|
}
|
@@ -148,15 +149,19 @@ public class PSurfaceNone implements PSurface {
|
|
148
149
|
// public void blit() {
|
149
150
|
// // TODO Auto-generated method stub
|
150
151
|
// }
|
152
|
+
@Override
|
151
153
|
public void setCursor(int kind) {
|
152
154
|
}
|
153
155
|
|
156
|
+
@Override
|
154
157
|
public void setCursor(PImage image, int hotspotX, int hotspotY) {
|
155
158
|
}
|
156
159
|
|
160
|
+
@Override
|
157
161
|
public void showCursor() {
|
158
162
|
}
|
159
163
|
|
164
|
+
@Override
|
160
165
|
public void hideCursor() {
|
161
166
|
}
|
162
167
|
|
@@ -165,6 +170,7 @@ public class PSurfaceNone implements PSurface {
|
|
165
170
|
return new AnimationThread();
|
166
171
|
}
|
167
172
|
|
173
|
+
@Override
|
168
174
|
public void startThread() {
|
169
175
|
if (thread == null) {
|
170
176
|
thread = createThread();
|
@@ -175,6 +181,7 @@ public class PSurfaceNone implements PSurface {
|
|
175
181
|
}
|
176
182
|
}
|
177
183
|
|
184
|
+
@Override
|
178
185
|
public boolean stopThread() {
|
179
186
|
if (thread == null) {
|
180
187
|
return false;
|
@@ -183,11 +190,13 @@ public class PSurfaceNone implements PSurface {
|
|
183
190
|
return true;
|
184
191
|
}
|
185
192
|
|
193
|
+
@Override
|
186
194
|
public boolean isStopped() {
|
187
195
|
return thread == null || !thread.isAlive();
|
188
196
|
}
|
189
197
|
|
190
198
|
// sets a flag to pause the thread when ready
|
199
|
+
@Override
|
191
200
|
public void pauseThread() {
|
192
201
|
PApplet.debug("PApplet.run() paused, calling object wait...");
|
193
202
|
paused = true;
|
@@ -208,6 +217,7 @@ public class PSurfaceNone implements PSurface {
|
|
208
217
|
// PApplet.debug("done with pause");
|
209
218
|
}
|
210
219
|
|
220
|
+
@Override
|
211
221
|
public void resumeThread() {
|
212
222
|
paused = false;
|
213
223
|
synchronized (pauseObject) {
|