fixes for svg from ricardmp (better xform parse, empty paths) bug #982

This commit is contained in:
benfry
2008-11-04 18:49:36 +00:00
parent 5d131d0eba
commit 17a68654f7
3 changed files with 15 additions and 20 deletions
+9 -17
View File
@@ -258,20 +258,6 @@ public class PShape implements PConstants {
protected void pre(PGraphics g) {
if (matrix != null) {
/*
boolean flat = g instanceof PGraphics2D;
g.pushMatrix();
if (flat) {
g.applyMatrix(matrix.m00, matrix.m01, matrix.m03, // PMatrix3D
matrix.m10, matrix.m11, matrix.m13);
} else {
g.applyMatrix(matrix.m00, matrix.m01, matrix.m02, matrix.m03,
matrix.m10, matrix.m11, matrix.m12, matrix.m13,
matrix.m20, matrix.m21, matrix.m22, matrix.m23,
matrix.m30, matrix.m31, matrix.m32, matrix.m33);
}
*/
g.pushMatrix();
g.applyMatrix(matrix);
}
@@ -290,8 +276,8 @@ public class PShape implements PConstants {
ellipseModeSaved = g.ellipseMode;
shapeModeSaved = g.shapeMode;
*/
g.pushStyle();
if (style) {
g.pushStyle();
styles(g);
}
}
@@ -337,11 +323,14 @@ public class PShape implements PConstants {
g.ellipseMode = ellipseModeSaved;
*/
g.popStyle();
if (matrix != null) {
g.popMatrix();
}
if (style) {
g.popStyle();
}
}
@@ -351,7 +340,6 @@ public class PShape implements PConstants {
* shape(s);
*/
public void draw(PGraphics g) {
//System.out.println("drawing " + getClass().getName());
if (visible) {
pre(g);
drawImpl(g);
@@ -514,6 +502,10 @@ public class PShape implements PConstants {
protected void drawPath(PGraphics g) {
// Paths might be empty (go figure)
// http://dev.processing.org/bugs/show_bug.cgi?id=982
if (vertices == null) return;
g.beginShape();
int index = 0;
+1 -2
View File
@@ -758,8 +758,7 @@ public class PShapeSVG extends PShape {
System.err.println("Could not parse transform " + matrixStr);
return null;
}
float[] m = PApplet.parseFloat(PApplet.splitTokens(pieces[2]));
float[] m = PApplet.parseFloat(PApplet.splitTokens(pieces[2], ", "));
if (pieces[1].equals("matrix")) {
return new PMatrix2D(m[0], m[2], m[4], m[1], m[3], m[5]);
+5 -1
View File
@@ -1,5 +1,9 @@
0155 pde
X "Save canceled" message when saving untitled sketches without first renaming
X http://dev.processing.org/bugs/show_bug.cgi?id=987
X when saving a sketch over itself with "Save As", just do "Save" instead
X fix loadShape() transformation parsing and empty paths (thanks ricardmp)
X http://dev.processing.org/bugs/show_bug.cgi?id=982
_ move library examples to the examples menu
_ do this once the library documentation has been fixed up