diff --git a/build/macosx/dist.sh b/build/macosx/dist.sh index 388229c5a..756fffe39 100755 --- a/build/macosx/dist.sh +++ b/build/macosx/dist.sh @@ -44,8 +44,6 @@ cp -r ../../serial processing/libraries/ cp -r ../../video processing/libraries/ cp -r ../../pdf processing/libraries/ cp -r ../../dxf processing/libraries/ -cp -r ../../xml processing/libraries/ -cp -r ../../candy processing/libraries/ # get ds_store file (!) cp dist/DS_Store processing/.DS_Store diff --git a/build/macosx/make.sh b/build/macosx/make.sh index 03a2b96af..40ea9fb8d 100755 --- a/build/macosx/make.sh +++ b/build/macosx/make.sh @@ -31,8 +31,6 @@ else cp -r ../../video work/libraries/ cp -r ../../pdf work/libraries/ cp -r ../../dxf work/libraries/ - cp -r ../../xml work/libraries/ - cp -r ../../candy work/libraries/ # to have a copy of this guy around for messing with echo Copying Processing.app... @@ -62,9 +60,9 @@ cd core perl preproc.pl mkdir -p bin -javac -source 1.5 -target 1.5 -d bin src/processing/core/*.java +javac -source 1.5 -target 1.5 -d bin src/processing/core/*.java src/processing/xml/*.java rm -f ../build/macosx/work/lib/core.jar -cd bin && zip -rq ../../build/macosx/work/lib/core.jar processing/core/*.class && cd .. +cd bin && zip -rq ../../build/macosx/work/lib/core.jar processing/core/*.class processing/xml/*.class && cd .. # head back to "processing/app" cd ../app @@ -233,33 +231,5 @@ mkdir -p $LIBRARIES/dxf/library/ cp library/dxf.jar $LIBRARIES/dxf/library/ -# XML LIBRARY -echo Building XML library... -cd ../xml -mkdir -p bin -$JAVAC \ - -classpath "$CLASSPATH" \ - -d bin src/processing/xml/*.java -rm -f library/xml.jar -find bin -name "*~" -exec rm -f {} ';' -cd bin && zip -rq ../library/xml.jar processing/xml/*.class && cd .. -mkdir -p $LIBRARIES/xml/library/ -cp library/xml.jar $LIBRARIES/xml/library/ - - -# CANDY SVG LIBRARY -echo Building Candy SVG library... -cd ../candy -mkdir -p bin -$JAVAC \ - -classpath "../xml/library/xml.jar:$CLASSPATH" \ - -d bin src/processing/candy/*.java -rm -f library/candy.jar -find bin -name "*~" -exec rm -f {} ';' -cd bin && zip -rq ../library/candy.jar processing/candy/*.class && cd .. -mkdir -p $LIBRARIES/candy/library/ -cp library/candy.jar $LIBRARIES/candy/library/ - - echo echo Done. \ No newline at end of file diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 5391cf8f7..7acf760b9 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -3455,6 +3455,23 @@ public class PApplet extends Applet + ////////////////////////////////////////////////////////////// + + // SHAPE I/O + + + /** + * Load a geometry from a file as a PShape. Currently only supports SVG data. + */ + public PShape loadShape(String filename) { + if (filename.toLowerCase().endsWith(".svg")) { + return new PShapeSVG(this, filename); + } + return null; + } + + + ////////////////////////////////////////////////////////////// // FONT I/O @@ -6721,6 +6738,12 @@ public class PApplet extends Applet } + public void vertex(float[] v) { + if (recorder != null) recorder.vertex(v); + g.vertex(v); + } + + public void vertex(float x, float y, float u, float v) { if (recorder != null) recorder.vertex(x, y, u, v); g.vertex(x, y, u, v); diff --git a/core/src/processing/core/PShape.java b/core/src/processing/core/PShape.java index c2ff093d7..9540cf67b 100644 --- a/core/src/processing/core/PShape.java +++ b/core/src/processing/core/PShape.java @@ -25,14 +25,34 @@ package processing.core; import java.util.HashMap; -// take a look at the obj loader to see how this fits with things -// PShape.line() PShape.ellipse()? -// PShape s = beginShape() -// line() -// endShape(s) - -abstract public class PShape implements PConstants { +/** + * In-progress class to handle shape data, currently to be considered of + * alpha or beta quality. Major structural work may be performed on this class + * after the release of Processing 1.0. Such changes may include: + * + *
For the time being, this class and its shape() and loadShape() friends in + * PApplet exist as placeholders for more exciting things to come. If you'd + * like to work with this class, make a subclass (see how PShapeSVG works) + * and you can play with its internal methods all you like.
+ * + *Library developers are encouraged to create PShape objects when loading + * shape data, so that they can eventually hook into the bounty that will be + * the PShape interface, and the ease of loadShape() and shape().
+ */ +public class PShape implements PConstants { protected String name; protected HashMap
* // This code grabs "Layer 3" and the shapes beneath it.
- * SVG layer3 = svg.get("Layer 3");
+ * SVG layer3 = svg.getChild("Layer 3");
*
*/
public PShape getChild(String name) {
PShape found = super.getChild(name);
- if (found != null) return found;
- // otherwise try with underscores instead of spaces
- return super.getChild(name.replace(' ', '_'));
+ if (found == null) {
+ // Otherwise try with underscores instead of spaces
+ // (this is how Illustrator handles spaces in the layer names).
+ found = super.getChild(name.replace(' ', '_'));
+ }
+ // Set bounding box based on the parent bounding box
+ if (found != null) {
+ found.x = this.x;
+ found.y = this.y;
+ found.width = this.width;
+ found.height = this.height;
+ }
+ return found;
}