diff --git a/app/.classpath b/app/.classpath index 0447c776a..393aba951 100644 --- a/app/.classpath +++ b/app/.classpath @@ -2,7 +2,6 @@ - diff --git a/core/src/processing/core/PShapeSVG.java b/core/src/processing/core/PShapeSVG.java index 3baed8267..71b26930a 100644 --- a/core/src/processing/core/PShapeSVG.java +++ b/core/src/processing/core/PShapeSVG.java @@ -1,4 +1,4 @@ -package processing.candy; +package processing.core; import java.awt.Paint; import java.awt.PaintContext; @@ -12,15 +12,10 @@ import java.awt.image.Raster; import java.awt.image.WritableRaster; import java.util.HashMap; -import processing.core.*; import processing.xml.XMLElement; /** - * Candy is a minimal SVG import library for Processing. - * Candy was written by Michael Chang, and later revised and - * expanded for use as a Processing core library by Ben Fry. - *

* SVG stands for Scalable Vector Graphics, a portable graphics format. It is * a vector format so it allows for infinite resolution and relatively small * file sizes. Most modern media software can view SVG files, including Adobe @@ -55,35 +50,37 @@ import processing.xml.XMLElement; *

  • With Illustrator CS2, it is also possible to use "Save As" with "SVG" * as the file setting, but the CSS properties should also be set similarly. * - * Saving it any other way will most likely break Candy. + * Saving it any other way will most likely not work. * *


    * - * A minimal example program using Candy: + * A minimal example program using SVG: * (assuming a working moo.svg is in your data folder) * *

    - * import processing.candy.*;
    - * import processing.xml.*;
    - *
    - * SVG moo;
    + * PShape moo;
    + * 
      * void setup() {
    - *   size(400,400);
    - *   moo = new SVG("moo.svg",this);
    + *   size(400, 400);
    + *   moo = loadShape("moo.svg");
      * }
      * void draw() {
    - *   moo.draw();
    + *   shape(moo);
      * }
      * 
    * - * Note that processing.xml needs to be imported as well. - * This may not be required when running code within the Processing - * environment, but when exported it may cause a NoClassDefError. - * This will be fixed in later releases of Processing - * (Bug 518). + * This code is based on the Candy library written by Michael Chang, which was + * later revised and expanded for use as a Processing core library by Ben Fry. * *


    * + * October 2008 revisions by fry (Processing 0149, pre-1.0) + *

      + *
    • Candy is no longer a separate library, and is instead part of core. + *
    • Loading now works through loadShape() + *
    • Shapes are now drawn using the new PGraphics shape() method. + *
    + * * August 2008 revisions by fry (Processing 0149) *
      *
    • Major changes to rework around PShape. @@ -130,7 +127,7 @@ import processing.xml.XMLElement; * For those interested, the SVG specification can be found * here. */ -public class SVG extends PShape { +public class PShapeSVG extends PShape { XMLElement element; float opacity; @@ -147,7 +144,7 @@ public class SVG extends PShape { /** * Initializes a new SVG Object with the given filename. */ - public SVG(PApplet parent, String filename) { + public PShapeSVG(PApplet parent, String filename) { // this will grab the root document, starting // the xml version and initial comments are ignored this(new XMLElement(parent, filename)); @@ -157,7 +154,7 @@ public class SVG extends PShape { /** * Initializes a new SVG Object from the given XMLElement. */ - public SVG(XMLElement svg) { + public PShapeSVG(XMLElement svg) { this(null, svg); if (!svg.getName().equals("svg")) { @@ -199,7 +196,7 @@ public class SVG extends PShape { } - public SVG(SVG parent, XMLElement properties) { + public PShapeSVG(PShapeSVG parent, XMLElement properties) { //super(GROUP); if (parent == null) { @@ -288,7 +285,7 @@ public class SVG extends PShape { */ protected PShape parseChild(XMLElement elem) { String name = elem.getName(); - SVG shape = new SVG(this, elem); + PShapeSVG shape = new PShapeSVG(this, elem); if (name.equals("g")) { //return new BaseObject(this, elem); @@ -1038,14 +1035,14 @@ public class SVG extends PShape { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - class Gradient extends SVG { + class Gradient extends PShapeSVG { AffineTransform transform; float[] offset; int[] color; int count; - public Gradient(SVG parent, XMLElement properties) { + public Gradient(PShapeSVG parent, XMLElement properties) { super(parent, properties); XMLElement elements[] = properties.getChildren(); @@ -1078,7 +1075,7 @@ public class SVG extends PShape { class LinearGradient extends Gradient { float x1, y1, x2, y2; - public LinearGradient(SVG parent, XMLElement properties) { + public LinearGradient(PShapeSVG parent, XMLElement properties) { super(parent, properties); this.x1 = properties.getFloatAttribute("x1"); @@ -1109,7 +1106,7 @@ public class SVG extends PShape { class RadialGradient extends Gradient { float cx, cy, r; - public RadialGradient(SVG parent, XMLElement properties) { + public RadialGradient(PShapeSVG parent, XMLElement properties) { super(parent, properties); this.cx = properties.getFloatAttribute("cx"); diff --git a/xml/src/processing/xml/CDATAReader.java b/core/src/processing/xml/CDATAReader.java similarity index 100% rename from xml/src/processing/xml/CDATAReader.java rename to core/src/processing/xml/CDATAReader.java diff --git a/xml/src/processing/xml/ContentReader.java b/core/src/processing/xml/ContentReader.java similarity index 100% rename from xml/src/processing/xml/ContentReader.java rename to core/src/processing/xml/ContentReader.java diff --git a/xml/src/processing/xml/PIReader.java b/core/src/processing/xml/PIReader.java similarity index 100% rename from xml/src/processing/xml/PIReader.java rename to core/src/processing/xml/PIReader.java diff --git a/xml/src/processing/xml/StdXMLBuilder.java b/core/src/processing/xml/StdXMLBuilder.java similarity index 100% rename from xml/src/processing/xml/StdXMLBuilder.java rename to core/src/processing/xml/StdXMLBuilder.java diff --git a/xml/src/processing/xml/StdXMLParser.java b/core/src/processing/xml/StdXMLParser.java similarity index 100% rename from xml/src/processing/xml/StdXMLParser.java rename to core/src/processing/xml/StdXMLParser.java diff --git a/xml/src/processing/xml/StdXMLReader.java b/core/src/processing/xml/StdXMLReader.java similarity index 100% rename from xml/src/processing/xml/StdXMLReader.java rename to core/src/processing/xml/StdXMLReader.java diff --git a/xml/src/processing/xml/XMLAttribute.java b/core/src/processing/xml/XMLAttribute.java similarity index 100% rename from xml/src/processing/xml/XMLAttribute.java rename to core/src/processing/xml/XMLAttribute.java diff --git a/xml/src/processing/xml/XMLElement.java b/core/src/processing/xml/XMLElement.java similarity index 100% rename from xml/src/processing/xml/XMLElement.java rename to core/src/processing/xml/XMLElement.java diff --git a/xml/src/processing/xml/XMLEntityResolver.java b/core/src/processing/xml/XMLEntityResolver.java similarity index 100% rename from xml/src/processing/xml/XMLEntityResolver.java rename to core/src/processing/xml/XMLEntityResolver.java diff --git a/xml/src/processing/xml/XMLException.java b/core/src/processing/xml/XMLException.java similarity index 100% rename from xml/src/processing/xml/XMLException.java rename to core/src/processing/xml/XMLException.java diff --git a/xml/src/processing/xml/XMLParseException.java b/core/src/processing/xml/XMLParseException.java similarity index 100% rename from xml/src/processing/xml/XMLParseException.java rename to core/src/processing/xml/XMLParseException.java diff --git a/xml/src/processing/xml/XMLUtil.java b/core/src/processing/xml/XMLUtil.java similarity index 100% rename from xml/src/processing/xml/XMLUtil.java rename to core/src/processing/xml/XMLUtil.java diff --git a/xml/src/processing/xml/XMLValidationException.java b/core/src/processing/xml/XMLValidationException.java similarity index 100% rename from xml/src/processing/xml/XMLValidationException.java rename to core/src/processing/xml/XMLValidationException.java diff --git a/xml/src/processing/xml/XMLValidator.java b/core/src/processing/xml/XMLValidator.java similarity index 100% rename from xml/src/processing/xml/XMLValidator.java rename to core/src/processing/xml/XMLValidator.java diff --git a/xml/src/processing/xml/XMLWriter.java b/core/src/processing/xml/XMLWriter.java similarity index 100% rename from xml/src/processing/xml/XMLWriter.java rename to core/src/processing/xml/XMLWriter.java