Index: trunk/src/com/kitfox/svg/LinearGradient.java
===================================================================
--- trunk/src/com/kitfox/svg/LinearGradient.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/LinearGradient.java	(revision 10787)
@@ -38,4 +38,6 @@
 import com.kitfox.svg.xml.StyleAttribute;
 import java.awt.Color;
+import java.awt.LinearGradientPaint;
+import java.awt.MultipleGradientPaint;
 import java.awt.Paint;
 import java.awt.geom.AffineTransform;
@@ -97,16 +99,16 @@
     public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
     {
-        com.kitfox.svg.batik.MultipleGradientPaint.CycleMethodEnum method;
+        MultipleGradientPaint.CycleMethod method;
         switch (spreadMethod)
         {
             default:
             case SM_PAD:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.NO_CYCLE;
+                method = MultipleGradientPaint.CycleMethod.NO_CYCLE;
                 break;
             case SM_REPEAT:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.REPEAT;
+                method = MultipleGradientPaint.CycleMethod.REPEAT;
                 break;
             case SM_REFLECT:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.REFLECT;
+                method = MultipleGradientPaint.CycleMethod.REFLECT;
                 break;
         }
@@ -121,5 +123,5 @@
         } else if (gradientUnits == GU_USER_SPACE_ON_USE)
         {
-            paint = new com.kitfox.svg.batik.LinearGradientPaint(
+            paint = new LinearGradientPaint(
                 pt1,
                 pt2,
@@ -127,5 +129,5 @@
                 getStopColors(),
                 method,
-                com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
+                MultipleGradientPaint.ColorSpaceType.SRGB,
                 gradientTransform == null
                 ? new AffineTransform()
@@ -146,5 +148,5 @@
             }
 
-            paint = new com.kitfox.svg.batik.LinearGradientPaint(
+            paint = new LinearGradientPaint(
                 pt1,
                 pt2,
@@ -152,5 +154,5 @@
                 getStopColors(),
                 method,
-                com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
+                MultipleGradientPaint.ColorSpaceType.SRGB,
                 viewXform);
         }
Index: trunk/src/com/kitfox/svg/Path.java
===================================================================
--- trunk/src/com/kitfox/svg/Path.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/Path.java	(revision 10787)
@@ -42,5 +42,4 @@
 import java.awt.geom.Rectangle2D;
 
-//import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
 /**
  * @author Mark McKay
Index: trunk/src/com/kitfox/svg/RadialGradient.java
===================================================================
--- trunk/src/com/kitfox/svg/RadialGradient.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/RadialGradient.java	(revision 10787)
@@ -4,14 +4,14 @@
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or 
+ * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  * conditions are met:
  *
- *   - Redistributions of source code must retain the above 
+ *   - Redistributions of source code must retain the above
  *     copyright notice, this list of conditions and the following
  *     disclaimer.
  *   - Redistributions in binary form must reproduce the above
  *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials 
+ *     disclaimer in the documentation and/or other materials
  *     provided with the distribution.
  *
@@ -27,6 +27,6 @@
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE. 
- * 
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
  * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
  * projects can be found at http://www.kitfox.com
@@ -36,10 +36,13 @@
 package com.kitfox.svg;
 
-import com.kitfox.svg.xml.StyleAttribute;
-import java.awt.Color;
+import java.awt.MultipleGradientPaint;
 import java.awt.Paint;
+import java.awt.RadialGradientPaint;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.util.Arrays;
+
+import com.kitfox.svg.xml.StyleAttribute;
 
 /**
@@ -53,6 +56,7 @@
     float cx = 0.5f;
     float cy = 0.5f;
-    float fx = 0.5f;
-    float fy = 0.5f;
+    boolean hasFocus = false;
+    float fx = 0f;
+    float fy = 0f;
     float r = 0.5f;
 
@@ -64,4 +68,5 @@
     }
 
+    @Override
     public String getTagName()
     {
@@ -69,4 +74,5 @@
     }
 
+    @Override
     protected void build() throws SVGException
     {
@@ -85,7 +91,9 @@
         }
 
+        hasFocus = false;
         if (getPres(sty.setName("fx")))
         {
             fx = sty.getFloatValueWithUnits();
+            hasFocus = true;
         }
 
@@ -93,4 +101,5 @@
         {
             fy = sty.getFloatValueWithUnits();
+            hasFocus = true;
         }
 
@@ -101,18 +110,19 @@
     }
 
+    @Override
     public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
     {
-        com.kitfox.svg.batik.MultipleGradientPaint.CycleMethodEnum method;
+        MultipleGradientPaint.CycleMethod method;
         switch (spreadMethod)
         {
             default:
             case SM_PAD:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.NO_CYCLE;
+                method = MultipleGradientPaint.CycleMethod.NO_CYCLE;
                 break;
             case SM_REPEAT:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.REPEAT;
+                method = MultipleGradientPaint.CycleMethod.REPEAT;
                 break;
             case SM_REFLECT:
-                method = com.kitfox.svg.batik.MultipleGradientPaint.REFLECT;
+                method = MultipleGradientPaint.CycleMethod.REFLECT;
                 break;
         }
@@ -120,8 +130,8 @@
         Paint paint;
         Point2D.Float pt1 = new Point2D.Float(cx, cy);
-        Point2D.Float pt2 = new Point2D.Float(fx, fy);
+        Point2D.Float pt2 = hasFocus ? new Point2D.Float(fx, fy) : pt1;
         if (gradientUnits == GU_USER_SPACE_ON_USE)
         {
-            paint = new com.kitfox.svg.batik.RadialGradientPaint(
+            paint = new RadialGradientPaint(
                 pt1,
                 r,
@@ -130,5 +140,5 @@
                 getStopColors(),
                 method,
-                com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
+                MultipleGradientPaint.ColorSpaceType.SRGB,
                 gradientTransform);
         } else
@@ -140,5 +150,5 @@
             viewXform.concatenate(gradientTransform);
 
-            paint = new com.kitfox.svg.batik.RadialGradientPaint(
+            paint = new RadialGradientPaint(
                 pt1,
                 r,
@@ -147,5 +157,5 @@
                 getStopColors(),
                 method,
-                com.kitfox.svg.batik.MultipleGradientPaint.SRGB,
+                MultipleGradientPaint.ColorSpaceType.SRGB,
                 viewXform);
         }
@@ -161,4 +171,5 @@
      * update
      */
+    @Override
     public boolean updateTime(double curTime) throws SVGException
     {
Index: trunk/src/com/kitfox/svg/SVGRoot.java
===================================================================
--- trunk/src/com/kitfox/svg/SVGRoot.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/SVGRoot.java	(revision 10787)
@@ -263,4 +263,39 @@
         prepareViewport();
 
+        Rectangle targetViewport = g.getClipBounds();
+
+        Rectangle deviceViewport = diagram.getDeviceViewport();
+        if (width != null && height != null)
+        {
+            float xx, yy, ww, hh;
+            
+            xx = (x == null) ? 0 : StyleAttribute.convertUnitsToPixels(x.getUnits(), x.getValue());
+            if (width.getUnits() == NumberWithUnits.UT_PERCENT)
+            {
+                ww = width.getValue() * deviceViewport.width;
+            }
+            else
+            {
+                ww = StyleAttribute.convertUnitsToPixels(width.getUnits(), width.getValue());
+            }
+            
+            yy = (y == null) ? 0 : StyleAttribute.convertUnitsToPixels(y.getUnits(), y.getValue());
+            if (height.getUnits() == NumberWithUnits.UT_PERCENT)
+            {
+                hh = height.getValue() * deviceViewport.height;
+            }
+            else
+            {
+                hh = StyleAttribute.convertUnitsToPixels(height.getUnits(), height.getValue());
+            }
+            
+            targetViewport = new Rectangle((int)xx, (int)yy, (int)ww, (int)hh);
+        }
+        else
+        {
+            targetViewport = new Rectangle(deviceViewport);
+        }
+        clipRect.setRect(targetViewport);
+
         if (viewBox == null)
         {
@@ -269,11 +304,7 @@
         else
         {
-            Rectangle deviceViewport = g.getClipBounds();
-            //If viewport window is set, we are drawing to entire viewport
-            clipRect.setRect(deviceViewport);
-            
             viewXform.setToIdentity();
-            viewXform.setToTranslation(deviceViewport.x, deviceViewport.y);
-            viewXform.scale(deviceViewport.width, deviceViewport.height);
+            viewXform.setToTranslation(targetViewport.x, targetViewport.y);
+            viewXform.scale(targetViewport.width, targetViewport.height);
             viewXform.scale(1 / viewBox.width, 1 / viewBox.height);
             viewXform.translate(-viewBox.x, -viewBox.y);
Index: trunk/src/com/kitfox/svg/ShapeElement.java
===================================================================
--- trunk/src/com/kitfox/svg/ShapeElement.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/ShapeElement.java	(revision 10787)
@@ -76,4 +76,5 @@
     }
 
+    @Override
     abstract public void render(java.awt.Graphics2D g) throws SVGException;
 
@@ -85,4 +86,5 @@
      */
 
+    @Override
     void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     {
@@ -95,4 +97,5 @@
     }
 
+    @Override
     void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
     {
@@ -161,5 +164,9 @@
                         if (ele != null)
                         {
-                            fillPaint = ((FillElement)ele).getPaint(bounds, xform);
+                            try {
+                                fillPaint = ((FillElement)ele).getPaint(bounds, xform);
+                            } catch (IllegalArgumentException e) {
+                                throw new SVGException(e);
+                            }
                         }
                     }
Index: trunk/src/com/kitfox/svg/Text.java
===================================================================
--- trunk/src/com/kitfox/svg/Text.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/Text.java	(revision 10787)
@@ -37,9 +37,7 @@
 
 import com.kitfox.svg.util.FontSystem;
-import com.kitfox.svg.util.TextBuilder;
 import com.kitfox.svg.xml.StyleAttribute;
 import java.awt.Graphics2D;
 import java.awt.Shape;
-import java.awt.font.FontRenderContext;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.GeneralPath;
@@ -51,5 +49,4 @@
 import java.util.regex.Pattern;
 
-//import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
 /**
  * @author Mark McKay
@@ -265,20 +262,21 @@
     protected void buildText() throws SVGException
     {
-
         //Get font
-        Font font = diagram.getUniverse().getFont(fontFamily);
+        String[] families = fontFamily.split(",");
+        Font font = null;
+        for (int i = 0; i < families.length; ++i)
+        {
+            font = diagram.getUniverse().getFont(fontFamily);
+            if (font != null)
+            {
+                break;
+            }
+        }
+
         if (font == null)
         {
-//            System.err.println("Could not load font");
-
             font = new FontSystem(fontFamily, fontStyle, fontWeight, (int)fontSize);
-//            java.awt.Font sysFont = new java.awt.Font(fontFamily, style | weight, (int)fontSize);
-//            buildSysFont(sysFont);
-//            return;
-        }
-
-//        font = new java.awt.Font(font.getFamily(), style | weight, font.getSize());
-
-//        Area textArea = new Area();
+        }
+
         GeneralPath textPath = new GeneralPath();
         textShape = textPath;
@@ -286,48 +284,4 @@
         float cursorX = x, cursorY = y;
 
-        FontFace fontFace = font.getFontFace();
-        //int unitsPerEm = fontFace.getUnitsPerEm();
-        int ascent = fontFace.getAscent();
-        float fontScale = fontSize / (float) ascent;
-
-//        AffineTransform oldXform = g.getTransform();
-//        TextBuilder builder = new TextBuilder();
-//        
-//        for (Iterator it = content.iterator(); it.hasNext();)
-//        {
-//            Object obj = it.next();
-//
-//            if (obj instanceof String)
-//            {
-//                String text = (String) obj;
-//                if (text != null)
-//                {
-//                    text = text.trim();
-//                }
-//                
-//                for (int i = 0; i < text.length(); i++)
-//                {
-//                    String unicode = text.substring(i, i + 1);
-//                    MissingGlyph glyph = font.getGlyph(unicode);
-//                    
-//                    builder.appendGlyph(glyph);
-//                }
-//            }
-//            else if (obj instanceof Tspan)
-//            {
-//                Tspan tspan = (Tspan)obj;
-//                tspan.buildGlyphs(builder);
-//            }
-//        }
-//
-//        builder.formatGlyphs();
-        
-        
-
-                
-                
-        
-        
-        
         AffineTransform xform = new AffineTransform();
 
@@ -344,12 +298,8 @@
                 }
 
-                strokeWidthScalar = 1f / fontScale;
-
                 for (int i = 0; i < text.length(); i++)
                 {
                     xform.setToIdentity();
                     xform.setToTranslation(cursorX, cursorY);
-                    xform.scale(fontScale, fontScale);
-//                    g.transform(xform);
 
                     String unicode = text.substring(i, i + 1);
@@ -362,9 +312,6 @@
                         textPath.append(path, false);
                     }
-//                    else glyph.render(g);
-
-                    cursorX += fontScale * glyph.getHorizAdvX();
-
-//                    g.setTransform(oldXform);
+
+                    cursorX += glyph.getHorizAdvX();
                 }
 
Index: trunk/src/com/kitfox/svg/Tspan.java
===================================================================
--- trunk/src/com/kitfox/svg/Tspan.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/Tspan.java	(revision 10787)
@@ -231,21 +231,11 @@
         {
             font = new FontSystem(fontFamily, fontStyle, fontWeight, (int)fontSize);
-//            addShapeSysFont(addShape, font, fontFamily, fontSize, letterSpacing, cursor);
-//            return;
-        }
-
-        FontFace fontFace = font.getFontFace();
-        int ascent = fontFace.getAscent();
-        float fontScale = fontSize / (float) ascent;
+        }
 
         AffineTransform xform = new AffineTransform();
-
-        strokeWidthScalar = 1f / fontScale;
 
         float cursorX = (float)cursor.getX();
         float cursorY = (float)cursor.getY();
     
-//        int i = 0;
-
         String drawText = this.text;
         drawText = drawText.trim();
@@ -267,9 +257,7 @@
                 cursorY += dy[i];
             }
-  //          i++;
             
             xform.setToIdentity();
             xform.setToTranslation(cursorX, cursorY);
-            xform.scale(fontScale, fontScale);
             if (rotate != null)
             {
@@ -287,5 +275,5 @@
             }
 
-            cursorX += fontScale * glyph.getHorizAdvX() + letterSpacing;
+            cursorX += glyph.getHorizAdvX() + letterSpacing;
         }
 
Index: trunk/src/com/kitfox/svg/app/beans/SVGIcon.java
===================================================================
--- trunk/src/com/kitfox/svg/app/beans/SVGIcon.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/app/beans/SVGIcon.java	(revision 10787)
@@ -37,10 +37,23 @@
 package com.kitfox.svg.app.beans;
 
-import com.kitfox.svg.*;
-import java.awt.*;
-import java.awt.geom.*;
-import java.beans.*;
-import java.net.*;
-import javax.swing.*;
+import com.kitfox.svg.SVGCache;
+import com.kitfox.svg.SVGDiagram;
+import com.kitfox.svg.SVGException;
+import com.kitfox.svg.SVGUniverse;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.net.URI;
+import javax.swing.ImageIcon;
+
 
 /**
@@ -48,5 +61,5 @@
  * @author kitfox
  */
-public class SVGIcon implements Icon
+public class SVGIcon extends ImageIcon
 {
     public static final long serialVersionUID = 1;
@@ -94,4 +107,11 @@
     }
     
+    public Image getImage()
+    {
+        BufferedImage bi = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB);
+        paintIcon(null, bi.getGraphics(), 0, 0);
+        return bi;
+    }
+
     /**
      * @return height of this icon
Index: trunk/src/com/kitfox/svg/util/FontSystem.java
===================================================================
--- trunk/src/com/kitfox/svg/util/FontSystem.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/util/FontSystem.java	(revision 10787)
@@ -1,6 +1,36 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * SVG Salamander
+ * Copyright (c) 2004, Mark McKay
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or 
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   - Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer.
+ *   - Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials 
+ *     provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * 
+ * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
+ * projects can be found at http://www.kitfox.com
+ *
+ * Created on April 24, 2015
  */
 package com.kitfox.svg.util;
Index: trunk/src/com/kitfox/svg/util/TextBuilder.java
===================================================================
--- trunk/src/com/kitfox/svg/util/TextBuilder.java	(revision 10746)
+++ trunk/src/com/kitfox/svg/util/TextBuilder.java	(revision 10787)
@@ -1,6 +1,36 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * SVG Salamander
+ * Copyright (c) 2004, Mark McKay
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or 
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   - Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer.
+ *   - Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials 
+ *     provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * 
+ * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
+ * projects can be found at http://www.kitfox.com
+ *
+ * Created on April 24, 2015
  */
 package com.kitfox.svg.util;
Index: trunk/src/com/kitfox/svg/xml/Base64InputStream.java
===================================================================
--- trunk/src/com/kitfox/svg/xml/Base64InputStream.java	(revision 10746)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * SVG Salamander
- * Copyright (c) 2004, Mark McKay
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or 
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   - Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the following
- *     disclaimer.
- *   - Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials 
- *     provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE. 
- * 
- * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
- * projects can be found at http://www.kitfox.com
- */
-
-package com.kitfox.svg.xml;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- *
- * @author kitfox
- */
-public class Base64InputStream extends FilterInputStream
-{
-    int buf;  //Cached bytes to read
-    int bufSize;  //Number of bytes waiting to be read from buffer
-    boolean drain = false;  //After set, read no more chunks
-    
-    public Base64InputStream(InputStream in)
-    {
-        super(in);
-    }
-
-    public int read() throws IOException
-    {
-        if (drain && bufSize == 0)
-        {
-            return -1;
-        }
-        
-        if (bufSize == 0)
-        {
-            //Read next chunk into 4 byte buffer
-            int chunk = in.read();
-            if (chunk == -1)
-            {
-                drain = true;
-                return -1;
-            }
-            
-            //get remaining 3 bytes
-            for (int i = 0; i < 3; ++i)
-            {
-                int value = in.read();
-                if (value == -1)
-                {
-                    throw new IOException("Early termination of base64 stream");
-                }
-                chunk = (chunk << 8) | (value & 0xff);
-            }
-
-            //Check for special termination characters
-            if ((chunk & 0xffff) == (((byte)'=' << 8) | (byte)'='))
-            {
-                bufSize = 1;
-                drain = true;
-            }
-            else if ((chunk & 0xff) == (byte)'=')
-            {
-                bufSize = 2;
-                drain = true;
-            }
-            else
-            {
-                bufSize = 3;
-            }
-            
-            //Fill buffer with decoded characters
-            for (int i = 0; i < bufSize + 1; ++i)
-            {
-                buf = (buf << 6) | Base64Util.decodeByte((chunk >> 24) & 0xff);
-                chunk <<= 8;
-            }
-        }
-        
-        //Return nth remaing bte & decrement counter
-        return (buf >> (--bufSize * 8)) & 0xff;
-    } 
-}
Index: trunk/src/com/kitfox/svg/xml/Base64OutputStream.java
===================================================================
--- trunk/src/com/kitfox/svg/xml/Base64OutputStream.java	(revision 10746)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * SVG Salamander
- * Copyright (c) 2004, Mark McKay
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or 
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   - Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the following
- *     disclaimer.
- *   - Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials 
- *     provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE. 
- * 
- * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
- * projects can be found at http://www.kitfox.com
- */
-
-package com.kitfox.svg.xml;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- *
- * @author kitfox
- */
-public class Base64OutputStream extends FilterOutputStream
-{
-    int buf;
-    int numBytes;
-    int numChunks;
-    
-    public Base64OutputStream(OutputStream out)
-    {
-        super(out);
-    }
-    
-    public void flush() throws IOException
-    {
-        out.flush();
-    }
-    
-    public void close() throws IOException
-    {
-        switch (numBytes)
-        {
-            case 1:
-                buf <<= 4;
-                out.write(getBase64Byte(1));
-                out.write(getBase64Byte(0));
-                out.write('=');
-                out.write('=');
-                break;
-            case 2:
-                buf <<= 2;
-                out.write(getBase64Byte(2));
-                out.write(getBase64Byte(1));
-                out.write(getBase64Byte(0));
-                out.write('=');
-                break;
-            case 3:
-                out.write(getBase64Byte(3));
-                out.write(getBase64Byte(2));
-                out.write(getBase64Byte(1));
-                out.write(getBase64Byte(0));
-                break;
-            default:
-                assert false;
-        }
-        
-        out.close();
-    }
-    
-    public void write(int b) throws IOException
-    {
-        buf = (buf << 8) | (0xff & b);
-        numBytes++;
-        
-        if (numBytes == 3)
-        {
-            out.write(getBase64Byte(3));
-            out.write(getBase64Byte(2));
-            out.write(getBase64Byte(1));
-            out.write(getBase64Byte(0));
-            
-            numBytes = 0;
-            numChunks++;
-            if (numChunks == 16)
-            {
-//                out.write('\r');
-//                out.write('\n');
-                numChunks = 0;
-            }
-        }
-    }
-    
-    public byte getBase64Byte(int index)
-    {
-        return Base64Util.encodeByte((buf >> (index * 6)) & 0x3f);
-    }
-}
Index: trunk/src/com/kitfox/svg/xml/Base64Util.java
===================================================================
--- trunk/src/com/kitfox/svg/xml/Base64Util.java	(revision 10746)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * SVG Salamander
- * Copyright (c) 2004, Mark McKay
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or 
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   - Redistributions of source code must retain the above 
- *     copyright notice, this list of conditions and the following
- *     disclaimer.
- *   - Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials 
- *     provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE. 
- * 
- * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
- * projects can be found at http://www.kitfox.com
- */
-
-package com.kitfox.svg.xml;
-
-/**
- *
- * @author kitfox
- */
-public class Base64Util 
-{
-    static final byte[] valueToBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes();
-    static final byte[] base64ToValue = new byte[128];
-    static {
-        for (int i = 0; i < valueToBase64.length; ++i)
-        {
-            base64ToValue[valueToBase64[i]] = (byte)i;
-        }
-    }
-    
-    static public byte encodeByte(int value)
-    {
-        return valueToBase64[value];
-    }
-    
-    static public byte decodeByte(int base64Char)
-    {
-        return base64ToValue[base64Char];
-    }
-}
