diff options
Diffstat (limited to 'src/org/apache/fop/svg')
-rw-r--r-- | src/org/apache/fop/svg/PDFGraphics2D.java | 6 | ||||
-rw-r--r-- | src/org/apache/fop/svg/SVGElement.java | 37 | ||||
-rw-r--r-- | src/org/apache/fop/svg/SVGElementMapping.java | 73 | ||||
-rw-r--r-- | src/org/apache/fop/svg/SVGObj.java | 39 |
4 files changed, 31 insertions, 124 deletions
diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java index a48c4e7d6..296ef8768 100644 --- a/src/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -1250,6 +1250,12 @@ System.out.println("getting getNormalizingTransform"); return new PDFGraphicsDevice(this); } +/* +// for jdk1.4 +public java.awt.image.VolatileImage createCompatibleVolatileImage(int width, int height) { +return null; +} +*/ } /** diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java index 3d098e32c..4c49334ef 100644 --- a/src/org/apache/fop/svg/SVGElement.java +++ b/src/org/apache/fop/svg/SVGElement.java @@ -21,6 +21,7 @@ import org.apache.batik.dom.util.XMLSupport; import org.w3c.dom.*; import org.w3c.dom.svg.*; import org.w3c.dom.svg.SVGLength; +import org.xml.sax.Attributes; import org.apache.batik.bridge.*; import org.apache.batik.swing.svg.*; import org.apache.batik.swing.gvt.*; @@ -43,34 +44,6 @@ import java.awt.geom.AffineTransform; */ public class SVGElement extends SVGObj { - /** - * inner class for making SVG objects. - */ - public static class Maker extends FObj.Maker { - - /** - * make an SVG object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the SVG object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new SVGElement(parent, propertyList); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for SVG objects - */ - public static FObj.Maker maker() { - return new SVGElement.Maker(); - } - FontState fs; /** @@ -79,8 +52,12 @@ public class SVGElement extends SVGObj { * @param parent the parent formatting object * @param propertyList the explicit properties of this object */ - public SVGElement(FObj parent, PropertyList propertyList) { - super(parent, propertyList, "svg"); + public SVGElement(FObj parent) { + super(parent); + } + + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); init(); } diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java index dc7df3dfb..cea2ea287 100644 --- a/src/org/apache/fop/svg/SVGElementMapping.java +++ b/src/org/apache/fop/svg/SVGElementMapping.java @@ -10,8 +10,7 @@ package org.apache.fop.svg; import java.util.Enumeration; import java.util.HashMap; -import org.apache.fop.fo.DirectPropertyListBuilder; -import org.apache.fop.fo.TreeBuilder; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeBuilder; import org.apache.fop.fo.ElementMapping; import org.apache.fop.apps.Driver; @@ -23,7 +22,7 @@ public class SVGElementMapping implements ElementMapping { private static HashMap foObjs = null; - public synchronized void addToBuilder(TreeBuilder builder) { + public synchronized void addToBuilder(FOTreeBuilder builder) { try { if (foObjs == null) { // this sets the parser that will be used @@ -33,68 +32,26 @@ public class SVGElementMapping implements ElementMapping { Driver.getParserClassName()); foObjs = new HashMap(); - foObjs.put("svg", SVGElement.maker()); - foObjs.put("rect", SVGObj.maker("rect")); - foObjs.put("line", SVGObj.maker("line")); - foObjs.put("text", SVGObj.maker("text")); - - foObjs.put("desc", SVGObj.maker("desc")); - foObjs.put("title", SVGObj.maker("title")); - foObjs.put("circle", SVGObj.maker("circle")); - foObjs.put("ellipse", SVGObj.maker("ellipse")); - foObjs.put("g", SVGObj.maker("g")); - foObjs.put("polyline", SVGObj.maker("polyline")); - foObjs.put("polygon", SVGObj.maker("polygon")); - foObjs.put("defs", SVGObj.maker("defs")); - foObjs.put("path", SVGObj.maker("path")); - foObjs.put("use", SVGObj.maker("use")); - foObjs.put("tspan", SVGObj.maker("tspan")); - foObjs.put("tref", SVGObj.maker("tref")); - foObjs.put("image", SVGObj.maker("image")); - foObjs.put("style", SVGObj.maker("style")); - - foObjs.put("textPath", SVGObj.maker("textPath")); - foObjs.put("clipPath", SVGObj.maker("clipPath")); - foObjs.put("mask", SVGObj.maker("mask")); - foObjs.put("linearGradient", SVGObj.maker("linearGradient")); - foObjs.put("radialGradient", SVGObj.maker("radialGradient")); - foObjs.put("stop", SVGObj.maker("stop")); - foObjs.put("a", SVGObj.maker("a")); - foObjs.put("switch", SVGObj.maker("switch")); - foObjs.put("symbol", SVGObj.maker("symbol")); - - foObjs.put("pattern", SVGObj.maker("pattern")); - - foObjs.put("marker", SVGObj.maker("marker")); - foObjs.put("animate", SVGObj.maker("animate")); - foObjs.put("altGlyph", SVGObj.maker("altGlyph")); - foObjs.put("font", SVGObj.maker("font")); - foObjs.put("glyph", SVGObj.maker("glyph")); - foObjs.put("missing-glyph", SVGObj.maker("missing-glyph")); - foObjs.put("hkern", SVGObj.maker("hkern")); - foObjs.put("vkern", SVGObj.maker("vkern")); - foObjs.put("set", SVGObj.maker("set")); - foObjs.put("animateMotion", SVGObj.maker("animateMotion")); - foObjs.put("animateColor", SVGObj.maker("animateColor")); - foObjs.put("animateTransform", SVGObj.maker("animateTransform")); - foObjs.put("cursor", SVGObj.maker("cursor")); - foObjs.put("filter", SVGObj.maker("filter")); - - foObjs.put("feFlood", SVGObj.maker("feFlood")); - foObjs.put("feGaussianBlur", SVGObj.maker("feGaussianBlur")); - foObjs.put("feOffset", SVGObj.maker("feOffset")); - foObjs.put("feMerge", SVGObj.maker("feMerge")); - foObjs.put("feMergeNode", SVGObj.maker("feMergeNode")); + foObjs.put("svg", new SE()); + foObjs.put("<default>", new SVGMaker()); } String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; builder.addMapping(svgNS, foObjs); - - builder.addPropertyListBuilder(svgNS, - new DirectPropertyListBuilder()); } catch (Throwable t) { // if the classes are not available } } + class SVGMaker extends ElementMapping.Maker { + public FObj make(FObj parent) { + return new SVGObj(parent); + } + } + + class SE extends ElementMapping.Maker { + public FObj make(FObj parent) { + return new SVGElement(parent); + } + } } diff --git a/src/org/apache/fop/svg/SVGObj.java b/src/org/apache/fop/svg/SVGObj.java index 78a84bdda..f3f72b12a 100644 --- a/src/org/apache/fop/svg/SVGObj.java +++ b/src/org/apache/fop/svg/SVGObj.java @@ -16,51 +16,18 @@ import org.w3c.dom.Element; public class SVGObj extends XMLObj { /** - * inner class for making svg objects. - */ - public static class Maker extends FObj.Maker { - String tag; - - Maker(String str) { - tag = str; - } - - /** - * make an svg object. - * - * @param parent the parent formatting object - * @param propertyList the explicit properties of this object - * - * @return the svg object - */ - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new SVGObj(parent, propertyList, tag); - } - } - - /** - * returns the maker for this object. - * - * @return the maker for an svg object - */ - public static FObj.Maker maker(String str) { - return new SVGObj.Maker(str); - } - - /** * constructs an svg object (called by Maker). * * @param parent the parent formatting object * @param propertyList the explicit properties of this object */ - protected SVGObj(FObj parent, PropertyList propertyList, String tag) { - super(parent, propertyList, tag); - this.name = "svg:" + tag; + public SVGObj(FObj parent) { + super(parent); } public String getNameSpace() { return "http://www.w3.org/2000/svg"; } + } |