Skip to content

Commit fabe525

Browse files
committed
clean up error message, repair dumb mistake (fixes #3417)
1 parent c0fd308 commit fabe525

3 files changed

Lines changed: 26 additions & 22 deletions

File tree

core/src/processing/awt/PShapeJava2D.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public PShapeJava2D(PShapeSVG parent, XML properties, boolean parseKids) {
6060

6161
@Override
6262
protected void setParent(PShapeSVG parent) {
63+
super.setParent(parent);
64+
6365
if (parent instanceof PShapeJava2D) {
6466
PShapeJava2D pj = (PShapeJava2D) parent;
6567
fillGradientPaint = pj.fillGradientPaint;
@@ -79,6 +81,19 @@ protected PShapeSVG createShape(PShapeSVG parent, XML properties, boolean parseK
7981
}
8082

8183

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+
*/
8297

8398

8499
static class LinearGradientPaint implements Paint {
@@ -286,14 +301,14 @@ public Raster getRaster(int x, int y, int w, int h) {
286301

287302
protected Paint calcGradientPaint(Gradient gradient) {
288303
if (gradient instanceof LinearGradient) {
289-
System.out.println("creating linear gradient");
304+
// System.out.println("creating linear gradient");
290305
LinearGradient grad = (LinearGradient) gradient;
291306
return new LinearGradientPaint(grad.x1, grad.y1, grad.x2, grad.y2,
292307
grad.offset, grad.color, grad.count,
293308
opacity);
294309

295310
} else if (gradient instanceof RadialGradient) {
296-
System.out.println("creating radial gradient");
311+
// System.out.println("creating radial gradient");
297312
RadialGradient grad = (RadialGradient) gradient;
298313
return new RadialGradientPaint(grad.cx, grad.cy, grad.r,
299314
grad.offset, grad.color, grad.count,

core/src/processing/core/PShapeSVG.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,20 @@ public class PShapeSVG extends PShape {
109109
String fillName; // id of another object
110110

111111

112-
// /**
113-
// * Initializes a new SVG Object with the given filename.
114-
// */
115-
// public PShapeSVG(PApplet parent, String filename) {
116-
// // this will grab the root document, starting <svg ...>
117-
// // the xml version and initial comments are ignored
118-
// this(parent.loadXML(filename));
119-
// }
120-
121-
122112
/**
123-
* Initializes a new SVG Object from the given XML.
113+
* Initializes a new SVG object from the given XML object.
124114
*/
125115
public PShapeSVG(XML svg) {
126116
this(null, svg, true);
127117

128118
if (!svg.getName().equals("svg")) {
129-
throw new RuntimeException("The root node is not <svg>, it's <" + svg.getName() + ">." +
130-
(svg.getName().toLowerCase().equals("html") ?
131-
" That means it's just a webpage. Did you download it right?" : ""));
119+
if (svg.getName().toLowerCase().equals("html")) {
120+
// Common case is that files aren't downloaded properly
121+
throw new RuntimeException("This appears to be a web page, not an SVG file.");
122+
} else {
123+
throw new RuntimeException("The root node is not <svg>, it's <" + svg.getName() + ">");
124+
}
132125
}
133-
134-
135-
//root = new Group(null, svg);
136-
// parseChildren(svg); // ?
137126
}
138127

139128

core/todo.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ X setLocation(int, int) and setSize(int, int)
4343
X add the "don't use this" warning to the JFrame in PSurfaceAWT
4444
X ArithmeticException: / by zero when using fonts opened with loadFont()
4545
X https://github.com/processing/processing/issues/3413
46+
X SVG briefly broken for Java2D
47+
X https://github.com/processing/processing/issues/3417
4648

4749
threading headaches
4850
X sketch not always showing with empty draw()
@@ -115,8 +117,6 @@ _ update wiki/docs to say "don't override sketchXxxx() methods"
115117

116118

117119
beta
118-
_ gradients currently broken for Java2D
119-
_ https://github.com/processing/processing/issues/3417
120120
_ run only the necessary pieces on the EDT
121121
_ in part because FX doesn't even use the EDT
122122
_ re-check the Linux frame visibility stuff

0 commit comments

Comments
 (0)