diff --git a/candy/src/processing/candy/SVG.java b/candy/src/processing/candy/SVG.java
index d1bbe284b..cb41dd127 100755
--- a/candy/src/processing/candy/SVG.java
+++ b/candy/src/processing/candy/SVG.java
@@ -1,91 +1,134 @@
-package processing.svg.reader;
-
-//import java.awt.Color;
-//import java.awt.GradientPaint;
-import java.awt.Paint;
-import java.awt.PaintContext;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ColorModel;
-import java.awt.image.Raster;
-import java.awt.image.WritableRaster;
-import java.util.Hashtable;
-
-import processing.core.PApplet;
-import processing.core.PConstants;
-import processing.core.PGraphicsJava2D;
-import processing.xml.XMLElement;
-
-//CANDY
-//Processing SVG import for the common man
-//author: Flux
-//with contributions by: Christian Riekoff
-//email: flux.blackcat@gmail.com
-//http://www.ghost-hack.com
-//Built for Processing 118
-
-//Using Christian Riekoff's handy proXML parser
-//http://www.texone.org/proxml
-//Hawt.
-
-//Last 100% working for Processing 0118
-//Please send bugs and annoyances to above email
-//Refer to readme.txt that was part of this package for legal jargon
-
/*
-TODO
-X actual linear gradients working properly
-X add a table for all objects with their names, so they can be grabbed individually
-_ add accessor to get items from the table
-_ see if items can be named in illusfarter using the svg palette
-X compound shapes (fonts) won't wind properly, so fill will be messed up
-X added hack to allow for broken shapes
-X rename draw() and its buddy
-X a moveto *inside* a shape will be treated as a lineto
-X had to fix this
-X implement polyline
-_ try enabling blending modes
-_ test what happens when transparency is used with gradient fill
-_ some means of centering the entire drawing (is this included already?)
-_ or setting to one of the corners
-_ does the svg spec just do this?
-_ look into transformation issues... guessing this is probably wrong
-_ this may be what's throwing off the radial radius transform
-_ implement A and a
-_ check for any other pieces of missing path api
-_ multiple sets of coordinates after a command not supported
-_ i.e. M with several coords means moveto followed by many linetos
-_ also curveto with multiple sets of points is ignored
+ Candy 2 - SVG Importer for Processing - http://processing.org
+
+ Copyright (c) 2006 Michael Chang (Flux)
+ http://www.ghost-hack.com/
+
+ Revised and expanded by Ben Fry for inclusion as a core library
+ Copyright (c) 2006- Ben Fry and Casey Reas
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
*/
+package processing.candy;
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+import java.util.Hashtable;
+
+import processing.core.*;
+import processing.xml.*;
+
+
+/**
+ * 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 Scalar Vector Graphics, a portable graphics
+ * format. It is a vector format so it allows for infinite resolution
+ * and relatively minute file sizes. Most modern media software
+ * can view SVG files, including Firefox, Adobe products, etc.
+ * You can use something like Illustrator to edit SVG files.
+ *
+ * This library was specifically tested under SVG files created from
+ * Adobe Illustrator. I can't guarantee that it'll work for any
+ * SVG's created from anything else. In the future I will also
+ * test with open source graphics editing software so we'll reach
+ * maximal compatibility. In the mean time, you're on your own.
+ *
+ * An SVG created under Illustrator must be created in the
+ * following manner:
+ * File → Save for Web (or control-alt-shift-s on a PC)
+ * Under settings, make sure the CSS properties is set to
+ * "Presentation Attributes". 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.
+ *
+ *
+ *
+ * A minimal example program using Candy:
+ * (assuming a working moo.svg is in your data folder)
+ *
+ *
+ * import processing.candy.*;
+ * import processing.xml.*;
+ *
+ * SVG moo;
+ * void setup(){
+ * size(400,400);
+ * moo = new SVG("moo.svg",this);
+ * }
+ * void draw(){
+ * moo.draw();
+ * }
+ *
+ *
+ * Note that processing.xml is imported as well. This is not needed
+ * when running the app directly from Processing, as Candy will know
+ * where it is. However when you export as an applet you will
+ * also need to export processing.xml along with it to have working Candy.
+ *
+ *
+ *
+ * Revisions for "Candy 2" November 2006 by fry
+ *
+ *
Switch to the new processing.xml library
+ *
Several bug fixes for parsing of shape data
+ *
Support for linear and radial gradients
+ *
Support for additional types of shapes
+ *
Added compound shapes (shapes with interior points)
+ *
Added methods to get shapes from an internal table
+ *
+ *
+ * Revision 10/31/06 by flux
+ *
+ *
Now properly supports Processing-0118
+ *
Fixed a bunch of things for Casey's students and general buggity.
+ *
Will now properly draw #FFFFFFFF colors (were being represented as -1)
+ *
SVGs without tags are now properly caught and loaded
+ *
Added a method customStyle() for overriding SVG colors/styles
+ *
Added a method SVGStyle() to go back to using SVG colors/styles
+ *
+ *
+ * Some SVG objects and features may not yet be supported.
+ * Here is a partial list of non-included features
+ *
+ *
Rounded rectangles
+ *
Drop shadow objects
+ *
Typography
+ *
Layers added for Candy 2
+ *
Patterns
+ *
Embedded images
+ *
+ *
+ * If you experience any other wierdness or bugs, please file them to
+ * flux.blackcat@gmail.com with subject: Delicious Candy
+ */
public class SVG {
- public String filename;
-
- //protected static PApplet parent;
- //private static XMLInOut xmlio;
protected PApplet parent;
public float width;
- public float height;
- //private float svgWidth = 0;
- //private float svgHeight = 0;
+ public float height;
- //private Vector draw = new Vector();
+ protected Hashtable table = new Hashtable();
+ protected XMLElement svg;
+ protected BaseObject root;
- private Hashtable idTable = new Hashtable();
- private XMLElement svg;
- private Group root;
-
- //For some reason Processing was using -1 for #FFFFFFFF
- //thus we will use our own null value
- //private static int transValue = -255;
-
- private boolean styleOverride = false;
+ protected boolean styleOverride = false;
+
/**
* Initializes a new SVG Object with the given filename.
@@ -94,7 +137,7 @@ public class SVG {
*/
public SVG(String filename, PApplet parent){
this.parent = parent;
- this.filename = filename;
+ //this.filename = filename;
// this will grab the root document, starting