aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Coffman <gears@apache.org>2001-05-11 20:25:52 +0000
committerSteve Coffman <gears@apache.org>2001-05-11 20:25:52 +0000
commit5b68906b40ded9fd2c1d6ce0ce1e8406dcf118d0 (patch)
treec53af5e3e38702421446ceed7b52c66bb977f991
parent822b7f4866fd2ea3c9a5e3d853403c4bc93940d2 (diff)
downloadxmlgraphics-fop-5b68906b40ded9fd2c1d6ce0ce1e8406dcf118d0.tar.gz
xmlgraphics-fop-5b68906b40ded9fd2c1d6ce0ce1e8406dcf118d0.zip
PR:
Obtained from: Keiron Liddle Submitted by: Steve Coffman Reviewed by: Steve Coffman This updates Keiron's branch that uses Batik for SVG. Adds a few files missing. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_17_0_batikSVG@194240 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xbuild.sh6
-rwxr-xr-xdocs/examples/svg/makedoc.sh2
-rwxr-xr-xfop.sh2
-rw-r--r--lib/batik.jarbin1778269 -> 1998563 bytes
-rw-r--r--src/codegen/svgelements.xml848
-rw-r--r--src/org/apache/fop/apps/AWTStarter.java2
-rw-r--r--src/org/apache/fop/apps/CommandLineStarter.java2
-rw-r--r--src/org/apache/fop/datatypes/KeepValue.java5
-rw-r--r--src/org/apache/fop/pdf/PDFDocument.java2
-rw-r--r--src/org/apache/fop/render/awt/AWTRenderer.java17
-rw-r--r--src/org/apache/fop/render/pdf/PDFRenderer.java19
-rw-r--r--src/org/apache/fop/svg/PDFDocumentGraphics2D.java120
-rw-r--r--src/org/apache/fop/svg/PDFGraphics2D.java238
-rw-r--r--src/org/apache/fop/svg/PDFTranscoder.java655
-rw-r--r--src/org/apache/fop/svg/SVG.java6
-rw-r--r--src/org/apache/fop/svg/SVGElementMapping.java6
-rw-r--r--src/org/apache/fop/svg/SVGObj.java20
17 files changed, 1840 insertions, 110 deletions
diff --git a/build.sh b/build.sh
index 3f6df1c06..26cb67755 100755
--- a/build.sh
+++ b/build.sh
@@ -12,9 +12,9 @@ if [ "$JAVA_HOME" = "" ] ; then
echo "location of the Java Virtual Machine you want to use."
exit 1
fi
-
-LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:./lib/ant.jar:./lib/buildtools.jar:./lib/batik.jar
-ANT_HOME=./lib
+LIBDIR=lib
+LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/batik.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.2.3.jar:$LIBDIR/xalan-2.0.0.jar:$LIBDIR/xalanj1compat.jar:$LIBDIR/bsf.jar:$LIBDIR/jimi-1.0.jar
+ANT_HOME=$LIBDIR
echo Building with classpath $CLASSPATH:$LOCALCLASSPATH
echo
diff --git a/docs/examples/svg/makedoc.sh b/docs/examples/svg/makedoc.sh
index d7b1d51d3..8ec376513 100755
--- a/docs/examples/svg/makedoc.sh
+++ b/docs/examples/svg/makedoc.sh
@@ -13,7 +13,7 @@ if [ "$JAVA_HOME" = "" ] ; then
exit 1
fi
-LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:../../../lib/ant.jar:../../../lib/w3c.jar:../../../lib/buildtools.jar:../../../build/fop.jar:../../../lib/batik.jar
+LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:../../../lib/ant.jar:../../../lib/xerces-1.2.3.jar:../../../lib/buildtools.jar:../../../build/fop.jar:../../../lib/batik.jar:../../../lib/xalan-2.0.0.jar
ANT_HOME=../../../lib
echo Building with classpath $CLASSPATH:$LOCALCLASSPATH
diff --git a/fop.sh b/fop.sh
index d91034f75..1bc911954 100755
--- a/fop.sh
+++ b/fop.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-java -cp fop.jar:lib/w3c.jar:lib/xalan-2.0.0.jar:lib/xerces-1.2.3.jar:lib/jimi-1.0.jar org.apache.fop.apps.Fop "$@"
+java -cp build/fop.jar:lib/w3c.jar:lib/xalan-2.0.0.jar:lib/xerces-1.2.3.jar:lib/jimi-1.0.jar org.apache.fop.apps.Fop "$@"
diff --git a/lib/batik.jar b/lib/batik.jar
index d05c85bbd..5c1486efe 100644
--- a/lib/batik.jar
+++ b/lib/batik.jar
Binary files differ
diff --git a/src/codegen/svgelements.xml b/src/codegen/svgelements.xml
index d27d11fa2..ddc384112 100644
--- a/src/codegen/svgelements.xml
+++ b/src/codegen/svgelements.xml
@@ -1,4 +1,13 @@
<?xml version="1.0" ?>
+<!--
+
+This file provides all the information for the svg elements and
+attributes. The information corresponds to the svg dtd.
+
+This information is used to create the code for the svg elements
+and the property mappings.
+
+-->
<elements prefix="svg" ns="http://www.w3.org/2000/svg">
<commonAttributes ref="stdAttrs">
<attribute>id</attribute>
@@ -13,6 +22,40 @@
<attribute>requiredExtensions</attribute>
<attribute>systemLanguage</attribute>
</commonAttributes>
+ <commonAttributes ref="xlinkRefAttrs">
+ <attribute>xmlns:xlink</attribute>
+ <attribute>xlink:type</attribute>
+ <attribute>xlink:role</attribute>
+ <attribute>xlink:arcrole</attribute>
+ <attribute>xlink:title</attribute>
+ <attribute>xlink:show</attribute>
+ <attribute>xlink:actuate</attribute>
+ </commonAttributes>
+ <commonAttributes ref="graphicsElementEvents">
+ <attribute>onfocusin</attribute>
+ <attribute>onfocusout</attribute>
+ <attribute>onactivate</attribute>
+ <attribute>onclick</attribute>
+ <attribute>onmousedown</attribute>
+ <attribute>onmouseup</attribute>
+ <attribute>onmouseover</attribute>
+ <attribute>onmousemove</attribute>
+ <attribute>onmouseout</attribute>
+ <attribute>onload</attribute>
+ </commonAttributes>
+ <commonAttributes ref="documentEvents">
+ <attribute>onunload</attribute>
+ <attribute>onabort</attribute>
+ <attribute>onerror</attribute>
+ <attribute>onresize</attribute>
+ <attribute>onscroll</attribute>
+ <attribute>onzoom</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animationEvents">
+ <attribute>onbegin</attribute>
+ <attribute>onend</attribute>
+ <attribute>onrepeat</attribute>
+ </commonAttributes>
<commonAttributes ref="PresentationAttributes-All">
<includeAttributes ref="PresentationAttributes-Containers"/>
<includeAttributes ref="PresentationAttributes-feFlood"/>
@@ -109,16 +152,76 @@
<attribute>clip</attribute>
<attribute>overflow</attribute>
</commonAttributes>
+ <commonAttributes ref="filter_primitive_attributes">
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>width</attribute>
+ <attribute>height</attribute>
+ <attribute>result</attribute>
+ </commonAttributes>
+ <commonAttributes ref="filter_primitive_attributes_with_in">
+ <includeAttributes ref="filter_primitive_attributes"/>
+ <attribute>in</attribute>
+ </commonAttributes>
+ <commonAttributes ref="component_transfer_function_attributes">
+ <attribute>type</attribute>
+ <attribute>tableValues</attribute>
+ <attribute>slope</attribute>
+ <attribute>intercept</attribute>
+ <attribute>amplitude</attribute>
+ <attribute>exponent</attribute>
+ <attribute>offset</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animElementAttrs">
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animAttributeAttrs">
+ <attribute>attributeName</attribute>
+ <attribute>attributeType</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animTargetAttrs">
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>attributeName</attribute>
+ <attribute>attributeType</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animTimingAttrs">
+ <attribute>begin</attribute>
+ <attribute>dur</attribute>
+ <attribute>end</attribute>
+ <attribute>min</attribute>
+ <attribute>max</attribute>
+ <attribute>restart</attribute>
+ <attribute>repeatCount</attribute>
+ <attribute>repeatDur</attribute>
+ <attribute>fill</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animValueAttrs">
+ <attribute>calcMode</attribute>
+ <attribute>values</attribute>
+ <attribute>keyTimes</attribute>
+ <attribute>keySplines</attribute>
+ <attribute>from</attribute>
+ <attribute>to</attribute>
+ <attribute>by</attribute>
+ </commonAttributes>
+ <commonAttributes ref="animAdditionAttrs">
+ <attribute>additive</attribute>
+ <attribute>accumulate</attribute>
+ </commonAttributes>
<element>
<tagname>a</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>xlnk:href</attribute>
+ <attribute>xmlns:xlink</attribute>
+ <attribute>xlink:type</attribute>
<attribute>xlink:role</attribute>
<attribute>xlink:arcrole</attribute>
<attribute>xlink:title</attribute>
<attribute>xlink:show</attribute>
<attribute>xlink:actuate</attribute>
+ <attribute>xlink:href</attribute>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
<attribute>externalResourcesRequired</attribute>
@@ -126,7 +229,7 @@
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-All"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>target</attribute>
</attributes>
</element>
@@ -136,13 +239,13 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>cx</attribute>
<attribute>cy</attribute>
<attribute>r</attribute>
@@ -152,56 +255,168 @@
<tagname>altGlyph</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>glyphRef</attribute>
+ <attribute>format</attribute>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-FontSpecification"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
+ <includeAttributes ref="PresentationAttributes-TextContentElements"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>dx</attribute>
+ <attribute>dy</attribute>
+ <attribute>rotate</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>altGlyphDef</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>altGlyphItem</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>animate</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="animationEvents"/>
+ <includeAttributes ref="animElementAttrs"/>
+ <includeAttributes ref="animAttributeAttrs"/>
+ <includeAttributes ref="animTimingAttrs"/>
+ <includeAttributes ref="animValueAttrs"/>
+ <includeAttributes ref="animAdditionAttrs"/>
</attributes>
</element>
<element>
<tagname>animateColor</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="animationEvents"/>
+ <includeAttributes ref="animElementAttrs"/>
+ <includeAttributes ref="animAttributeAttrs"/>
+ <includeAttributes ref="animTimingAttrs"/>
+ <includeAttributes ref="animValueAttrs"/>
+ <includeAttributes ref="animAdditionAttrs"/>
</attributes>
</element>
<element>
<tagname>animateMotion</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="animationEvents"/>
+ <includeAttributes ref="animElementAttrs"/>
+ <includeAttributes ref="animTimingAttrs"/>
+ <attribute>calcMode</attribute>
+ <attribute>values</attribute>
+ <attribute>keyTimes</attribute>
+ <attribute>keySplines</attribute>
+ <attribute>from</attribute>
+ <attribute>to</attribute>
+ <attribute>by</attribute>
+ <includeAttributes ref="animAdditionAttrs"/>
+ <attribute>path</attribute>
+ <attribute>keyPoints</attribute>
+ <attribute>rotate</attribute>
+ <attribute>origin</attribute>
</attributes>
</element>
<element>
<tagname>animateTransform</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="animationEvents"/>
+ <includeAttributes ref="animElementAttrs"/>
+ <includeAttributes ref="animAttributeAttrs"/>
+ <includeAttributes ref="animTimingAttrs"/>
+ <includeAttributes ref="animValueAttrs"/>
+ <includeAttributes ref="animAdditionAttrs"/>
+ <attribute>type</attribute>
</attributes>
</element>
<element>
<tagname>clipPath</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-FontSpecification"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
+ <includeAttributes ref="PresentationAttributes-TextContentElements"/>
+ <includeAttributes ref="PresentationAttributes-TextElements"/>
+ <attribute>transform</attribute>
<attribute>clipPathUnits</attribute>
</attributes>
</element>
<element>
+ <tagname>color-profile</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>local</attribute>
+ <attribute>name</attribute>
+ <attribute>rendering-intent</attribute>
+ </attributes>
+ </element>
+ <element>
<tagname>cursor</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
</attributes>
</element>
<element>
<tagname>defs</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <attribute>transform</attribute>
</attributes>
</element>
<element addText="true">
<tagname>desc</tagname>
<attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="StructuredText"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
</attributes>
</element>
<element>
@@ -210,13 +425,13 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>cx</attribute>
<attribute>cy</attribute>
<attribute>rx</attribute>
@@ -224,23 +439,382 @@
</attributes>
</element>
<element>
+ <tagname>feBlend</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>in2</attribute>
+ <attribute>mode</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feColorMatrix</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>type</attribute>
+ <attribute>values</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feComponentTransfer</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feComposite</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>in2</attribute>
+ <attribute>operator</attribute>
+ <attribute>k1</attribute>
+ <attribute>k2</attribute>
+ <attribute>k3</attribute>
+ <attribute>k4</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feConvolveMatrix</tagname>
+ <attributes>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>order</attribute>
+ <attribute>kernelMatrix</attribute>
+ <attribute>divisor</attribute>
+ <attribute>bias</attribute>
+ <attribute>targetX</attribute>
+ <attribute>targetY</attribute>
+ <attribute>edgeMode</attribute>
+ <attribute>kernelUnitLength</attribute>
+ <attribute>preserveAlpha</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feDistantLight</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>azimuth</attribute>
+ <attribute>elevation</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feDiffuseLighting</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-LightingEffects"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>surfaceScale</attribute>
+ <attribute>diffuseConstant</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feDisplacementMap</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>in2</attribute>
+ <attribute>scale</attribute>
+ <attribute>xChannelSelector</attribute>
+ <attribute>yChannelSelector</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feFlood</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-feFlood"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feFuncR</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="component_transfer_function_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feFuncG</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="component_transfer_function_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feFuncB</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="component_transfer_function_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feFuncA</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="component_transfer_function_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feGaussianBlur</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>stdDeviation</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feOffset</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>fePointLight</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>z</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feImage</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>transform</attribute>
+ <includeAttributes ref="filter_primitive_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feMerge</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feMergeNode</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>in</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feMorphology</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>operator</attribute>
+ <attribute>radius</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feOffset</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>dx</attribute>
+ <attribute>dy</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feSpecularLighting</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-LightingEffects"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ <attribute>surfaceScale</attribute>
+ <attribute>specularConstant</attribute>
+ <attribute>specularExponent</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feSpotLight</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>z</attribute>
+ <attribute>pointsAtX</attribute>
+ <attribute>pointsAtY</attribute>
+ <attribute>pointsAtZ</attribute>
+ <attribute>specularExponent</attribute>
+ <attribute>limitingConeAngle</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feTile</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes_with_in"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>feTurbulence</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="filter_primitive_attributes"/>
+ <attribute>baseFrequency</attribute>
+ <attribute>numOctaves</attribute>
+ <attribute>seed</attribute>
+ <attribute>stitchTiles</attribute>
+ <attribute>type</attribute>
+ </attributes>
+ </element>
+ <element>
<tagname>filter</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>filterUnits</attribute>
+ <attribute>primitiveUnits</attribute>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>width</attribute>
+ <attribute>height</attribute>
+ <attribute>filterRes</attribute>
</attributes>
</element>
<element>
<tagname>font</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>horiz-origin-x</attribute>
+ <attribute>horiz-origin-y</attribute>
+ <attribute>horiz-adv-x</attribute>
+ <attribute>vert-origin-x</attribute>
+ <attribute>vert-origin-y</attribute>
+ <attribute>vert-adv-y</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>font-face</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>font-family</attribute>
+ <attribute>font-style</attribute>
+ <attribute>font-variant</attribute>
+ <attribute>font-weight</attribute>
+ <attribute>font-stretch</attribute>
+ <attribute>font-size</attribute>
+ <attribute>unicode-range</attribute>
+ <attribute>units-per-em</attribute>
+ <attribute>panose-1</attribute>
+ <attribute>stemv</attribute>
+ <attribute>stemh</attribute>
+ <attribute>slope</attribute>
+ <attribute>cap-height</attribute>
+ <attribute>x-height</attribute>
+ <attribute>accent-height</attribute>
+ <attribute>ascent</attribute>
+ <attribute>descent</attribute>
+ <attribute>widths</attribute>
+ <attribute>bbox</attribute>
+ <attribute>ideographic</attribute>
+ <attribute>alphabetic</attribute>
+ <attribute>mathematical</attribute>
+ <attribute>hanging</attribute>
+ <attribute>v-ideographic</attribute>
+ <attribute>v-alphabetic</attribute>
+ <attribute>v-mathematical</attribute>
+ <attribute>v-hanging</attribute>
+ <attribute>underline-position</attribute>
+ <attribute>underline-thickness</attribute>
+ <attribute>strikethrough-position</attribute>
+ <attribute>strikethrough-thickness</attribute>
+ <attribute>overline-position</attribute>
+ <attribute>overline-thickness</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>font-face-src</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>font-face-uri</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>font-face-format</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>string</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>font-face-name</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>name</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>foreignObject</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>transform</attribute>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>width</attribute>
+ <attribute>height</attribute>
+ <includeAttributes ref="StructuredText"/>
+ </attributes>
+ </element>
+ <element>
+ <tagname>definition-src</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
</attributes>
</element>
<element>
<tagname>g</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
<includeAttributes ref="PresentationAttributes-All"/>
- <attribute>id</attribute>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<attribute>class</attribute>
@@ -250,22 +824,65 @@
<tagname>glyph</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>unicode</attribute>
+ <attribute>glyph-name</attribute>
+ <attribute>d</attribute>
+ <attribute>orientation</attribute>
+ <attribute>arabic-form</attribute>
+ <attribute>lang</attribute>
+ <attribute>horiz-adv-x</attribute>
+ <attribute>vert-origin-x</attribute>
+ <attribute>vert-origin-y</attribute>
+ <attribute>vert-adv-y</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>glyphRef</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-FontSpecification"/>
+ <attribute>glyphRef</attribute>
+ <attribute>format</attribute>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>dx</attribute>
+ <attribute>dy</attribute>
</attributes>
</element>
<element>
<tagname>hkern</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>u1</attribute>
+ <attribute>g1</attribute>
+ <attribute>u2</attribute>
+ <attribute>g2</attribute>
+ <attribute>k</attribute>
</attributes>
</element>
<element>
<tagname>image</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
+ <includeAttributes ref="PresentationAttributes-Images"/>
+ <includeAttributes ref="PresentationAttributes-Viewports"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
- <attribute>class</attribute>
+ <attribute>preserveAspectRatio</attribute>
<attribute>xlink:href</attribute>
<attribute>x</attribute>
<attribute>y</attribute>
@@ -279,14 +896,14 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-Markers"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>x1</attribute>
<attribute>x2</attribute>
<attribute>y1</attribute>
@@ -297,65 +914,128 @@
<tagname>linearGradient</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
- <attribute>transform</attribute>
+ <includeAttributes ref="PresentationAttributes-Gradients"/>
+ <attribute>gradientUnits</attribute>
+ <attribute>gradientTransform</attribute>
<attribute>class</attribute>
- <attribute>xlink:href</attribute>
<attribute>x1</attribute>
<attribute>y1</attribute>
<attribute>x2</attribute>
<attribute>y2</attribute>
- <attribute>gradientTransform</attribute>
<attribute>spreadMethod</attribute>
- <attribute>gradientUnits</attribute>
</attributes>
</element>
<element>
<tagname>marker</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>viewBox</attribute>
+ <attribute>preserveAspectRatio</attribute>
+ <attribute>refX</attribute>
+ <attribute>refY</attribute>
+ <attribute>markerUnits</attribute>
+ <attribute>markerWidth</attribute>
+ <attribute>markerHeight</attribute>
+ <attribute>orient</attribute>
</attributes>
</element>
<element>
<tagname>mask</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>transform</attribute>
+ <attribute>maskUnits</attribute>
+ <attribute>maskContentUnits</attribute>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>width</attribute>
+ <attribute>height</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>metadata</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
</attributes>
</element>
<element>
<tagname>missing-glyph</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>d</attribute>
+ <attribute>horiz-adv-x</attribute>
+ <attribute>vert-origin-x</attribute>
+ <attribute>vert-origin-y</attribute>
+ <attribute>vert-adv-y</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>mpath</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>externalResourcesRequired</attribute>
</attributes>
</element>
<element>
<tagname>path</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-FillStroke"/>
+ <includeAttributes ref="PresentationAttributes-Graphics"/>
+ <includeAttributes ref="PresentationAttributes-Markers"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<attribute>class</attribute>
<attribute>d</attribute>
+ <attribute>pathLength</attribute>
</attributes>
</element>
<element>
<tagname>pattern</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
- <attribute>style</attribute>
- <attribute>transform</attribute>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
+ <attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <attribute>viewBox</attribute>
+ <attribute>preserveAspectRatio</attribute>
<attribute>xlink:href</attribute>
<attribute>width</attribute>
<attribute>height</attribute>
<attribute>x</attribute>
<attribute>y</attribute>
<attribute>patternUnits</attribute>
+ <attribute>patternContentUnits</attribute>
+ <attribute>patternTransform</attribute>
</attributes>
</element>
<element>
@@ -371,7 +1051,7 @@
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-Markers"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>points</attribute>
</attributes>
</element>
@@ -388,7 +1068,7 @@
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-Markers"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>points</attribute>
</attributes>
</element>
@@ -396,10 +1076,11 @@
<tagname>radialGradient</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
<attribute>style</attribute>
- <attribute>transform</attribute>
<attribute>class</attribute>
+ <includeAttributes ref="PresentationAttributes-Gradients"/>
<attribute>gradientTransform</attribute>
<attribute>xlink:href</attribute>
<attribute>cx</attribute>
@@ -408,6 +1089,7 @@
<attribute>fx</attribute>
<attribute>fy</attribute>
<attribute>gradientUnits</attribute>
+ <attribute>spreadMethod</attribute>
</attributes>
</element>
<element>
@@ -416,13 +1098,13 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>x</attribute>
<attribute>y</attribute>
<attribute>width</attribute>
@@ -435,14 +1117,32 @@
<tagname>set</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="animationEvents"/>
+ <includeAttributes ref="animElementAttrs"/>
+ <includeAttributes ref="animAttributeAttrs"/>
+ <includeAttributes ref="animTimingAttrs"/>
+ <attribute>to</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>script</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <attribute>xlink:href</attribute>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>type</attribute>
</attributes>
</element>
<element>
<tagname>stop</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
+ <includeAttributes ref="PresentationAttributes-Gradients"/>
<attribute>offset</attribute>
</attributes>
</element>
@@ -450,25 +1150,61 @@
<tagname>style</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>xml:space</attribute>
+ <attribute>type</attribute>
+ <attribute>media</attribute>
+ <attribute>title</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>svg</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <includeAttributes ref="documentEvents"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <attribute>viewBox</attribute>
+ <attribute>preserveAspectRatio</attribute>
+ <attribute>zoomAndPan</attribute>
+ <attribute>x</attribute>
+ <attribute>y</attribute>
+ <attribute>width</attribute>
+ <attribute>height</attribute>
+ <attribute>contentScriptType</attribute>
+ <attribute>contentStyleType</attribute>
</attributes>
</element>
<element>
<tagname>switch</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
- <attribute>requiredFeatures</attribute>
- <attribute>requiredExtensions</attribute>
- <attribute>systemLanguage</attribute>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-all"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
+ <attribute>transform</attribute>
</attributes>
</element>
<element>
<tagname>symbol</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>class</attribute>
<attribute>style</attribute>
<attribute>viewBox</attribute>
+ <attribute>preserveAspectRatio</attribute>
</attributes>
</element>
<element>
@@ -479,14 +1215,14 @@
<attribute>xlink:href</attribute>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-FontSpecification"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-TextContentElements"/>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>x</attribute>
<attribute>y</attribute>
<attribute>dx</attribute>
@@ -502,14 +1238,14 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-FontSpecification"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-TextContentElements"/>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>x</attribute>
<attribute>y</attribute>
<attribute>dx</attribute>
@@ -525,7 +1261,7 @@
<includeAttributes ref="stdAttrs"/>
<includeAttributes ref="testAttrs"/>
<includeAttributes ref="langSpaceAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
@@ -534,7 +1270,7 @@
<includeAttributes ref="PresentationAttributes-TextContentElements"/>
<includeAttributes ref="PresentationAttributes-TextElements"/>
<attribute>transform</attribute>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>x</attribute>
<attribute>y</attribute>
<attribute>textLength</attribute>
@@ -549,14 +1285,14 @@
<attribute>xlink:href</attribute>
<includeAttributes ref="langSpaceAttrs"/>
<includeAttributes ref="testAttrs"/>
- <attribute>externalResourceRequired</attribute>
+ <attribute>externalResourcesRequired</attribute>
<attribute>class</attribute>
<attribute>style</attribute>
<includeAttributes ref="PresentationAttributes-FillStroke"/>
<includeAttributes ref="PresentationAttributes-FontSpecification"/>
<includeAttributes ref="PresentationAttributes-Graphics"/>
<includeAttributes ref="PresentationAttributes-TextContentElements"/>
- <includeAttributes ref="graphicsElementsEvents"/>
+ <includeAttributes ref="graphicsElementEvents"/>
<attribute>startOffset</attribute>
<attribute>textLength</attribute>
<attribute>lengthAdjust</attribute>
@@ -568,13 +1304,23 @@
<tagname>title</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="StructuredText"/>
+ <attribute>class</attribute>
+ <attribute>style</attribute>
</attributes>
</element>
<element>
<tagname>use</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
- <attribute>id</attribute>
+ <includeAttributes ref="xlinkRefAttrs"/>
+ <includeAttributes ref="testAttrs"/>
+ <includeAttributes ref="langSpaceAttrs"/>
+ <includeAttributes ref="PresentationAttributes-All"/>
+ <includeAttributes ref="graphicsElementEvents"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>class</attribute>
<attribute>style</attribute>
<attribute>transform</attribute>
<attribute>xlink:href</attribute>
@@ -588,6 +1334,22 @@
<tagname>vkern</tagname>
<attributes>
<includeAttributes ref="stdAttrs"/>
+ <attribute>u1</attribute>
+ <attribute>g1</attribute>
+ <attribute>u2</attribute>
+ <attribute>g2</attribute>
+ <attribute>k</attribute>
+ </attributes>
+ </element>
+ <element>
+ <tagname>view</tagname>
+ <attributes>
+ <includeAttributes ref="stdAttrs"/>
+ <attribute>externalResourcesRequired</attribute>
+ <attribute>viewBox</attribute>
+ <attribute>preserveAspectRatio</attribute>
+ <attribute>zoomAndPan</attribute>
+ <attribute>viewTarget</attribute>
</attributes>
</element>
</elements>
diff --git a/src/org/apache/fop/apps/AWTStarter.java b/src/org/apache/fop/apps/AWTStarter.java
index 061c391ba..c0eb930f6 100644
--- a/src/org/apache/fop/apps/AWTStarter.java
+++ b/src/org/apache/fop/apps/AWTStarter.java
@@ -84,7 +84,7 @@ public class AWTStarter extends CommandLineStarter {
frame = createPreviewDialog(renderer, resource);
renderer.setProgressListener(frame);
renderer.setComponent(frame);
- MessageHandler.setOutputMethod(MessageHandler.EVENT);
+ MessageHandler.setOutputMethod(MessageHandler.NONE);
MessageHandler.addListener(frame);
}
diff --git a/src/org/apache/fop/apps/CommandLineStarter.java b/src/org/apache/fop/apps/CommandLineStarter.java
index fe8cddec6..b39a741c3 100644
--- a/src/org/apache/fop/apps/CommandLineStarter.java
+++ b/src/org/apache/fop/apps/CommandLineStarter.java
@@ -60,7 +60,7 @@ public class CommandLineStarter extends Starter {
if (errorDump) {
e.printStackTrace();
}
- System.exit(1);
+ System.exit(0);
}
}
diff --git a/src/org/apache/fop/datatypes/KeepValue.java b/src/org/apache/fop/datatypes/KeepValue.java
index 3f1e06d7d..e8bb43452 100644
--- a/src/org/apache/fop/datatypes/KeepValue.java
+++ b/src/org/apache/fop/datatypes/KeepValue.java
@@ -75,4 +75,9 @@ public class KeepValue {
{
return type;
}
+
+ public String toString()
+ {
+ return type;
+ }
}
diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java
index 7d2c7ec2e..b07216642 100644
--- a/src/org/apache/fop/pdf/PDFDocument.java
+++ b/src/org/apache/fop/pdf/PDFDocument.java
@@ -915,11 +915,13 @@ public class PDFDocument {
contents,
pagewidth, pageheight);
+ if(currentPage != null) {
Enumeration enum=currentPage.getIDList().elements();
while ( enum.hasMoreElements() ) {
String id=enum.nextElement().toString();
idReferences.setInternalGoToPageReference(id,page.referencePDF());
}
+ }
/* add it to the list of objects */
this.objects.addElement(page);
diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java
index aec6c7cff..0905eae98 100644
--- a/src/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/org/apache/fop/render/awt/AWTRenderer.java
@@ -27,6 +27,7 @@ import org.apache.batik.swing.gvt.*;
import org.apache.batik.gvt.*;
import org.apache.batik.gvt.renderer.*;
import org.apache.batik.gvt.filter.*;
+import org.apache.batik.gvt.event.*;
import java.awt.*;
import java.awt.Image;
@@ -690,6 +691,7 @@ public class AWTRenderer implements Renderer, Printable, Pageable {
BridgeContext ctx = new BridgeContext(userAgent, rc);
GraphicsNode root;
graphics.translate(x / 1000f, pageHeight - y / 1000f);
+ graphics.setRenderingHints(rc.getRenderingHints());
try {
root = builder.build(ctx, doc);
root.paint(graphics, rc);
@@ -927,5 +929,20 @@ public class AWTRenderer implements Renderer, Printable, Pageable {
{
return new Dimension(100, 100);
}
+
+ public EventDispatcher getEventDispatcher()
+ {
+ return null;
+ }
+
+ public boolean supportExtension(String str)
+ {
+ return false;
+ }
+
+ public boolean hasFeature(String str)
+ {
+ return false;
+ }
}
}
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java
index d034cc075..62f04f5a8 100644
--- a/src/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/org/apache/fop/render/pdf/PDFRenderer.java
@@ -75,6 +75,7 @@ import org.apache.batik.swing.gvt.*;
import org.apache.batik.gvt.*;
import org.apache.batik.gvt.renderer.*;
import org.apache.batik.gvt.filter.*;
+import org.apache.batik.gvt.event.*;
import org.w3c.dom.*;
import org.w3c.dom.svg.*;
@@ -574,6 +575,7 @@ public class PDFRenderer implements Renderer {
case Overflow.HIDDEN:
break;
}
+
area.getObject().render(this);
currentStream.add("Q\n");
currentStream.add("BT\n");
@@ -628,10 +630,12 @@ public class PDFRenderer implements Renderer {
GraphicsNodeRenderContext rc = getRenderContext();
BridgeContext ctx = new BridgeContext(userAgent, rc);
GraphicsNode root;
+ //System.out.println("creating PDFGraphics2D");
PDFGraphics2D graphics = new PDFGraphics2D(true, area.getFontState(), pdfDoc,
currentFontName, currentFontSize, currentXPosition,
currentYPosition);
graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
+ graphics.setRenderingHints(rc.getRenderingHints());
try {
root = builder.build(ctx, doc);
root.paint(graphics, rc);
@@ -1277,5 +1281,20 @@ public class PDFRenderer implements Renderer {
{
return new Dimension(100, 100);
}
+
+ public EventDispatcher getEventDispatcher()
+ {
+ return null;
+ }
+
+ public boolean supportExtension(String str)
+ {
+ return false;
+ }
+
+ public boolean hasFeature(String str)
+ {
+ return false;
+ }
}
}
diff --git a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
new file mode 100644
index 000000000..37bc930fd
--- /dev/null
+++ b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+package org.apache.fop.svg;
+
+import org.apache.fop.pdf.*;
+import org.apache.fop.layout.*;
+import org.apache.fop.fonts.*;
+import org.apache.fop.render.pdf.*;
+import org.apache.fop.image.*;
+import org.apache.fop.datatypes.ColorSpace;
+
+import org.apache.batik.ext.awt.g2d.*;
+
+import java.text.AttributedCharacterIterator;
+import java.awt.*;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.image.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+import java.awt.image.renderable.*;
+import java.io.*;
+
+import java.util.Map;
+
+/**
+ * This concrete implementation of <tt>AbstractGraphics2D</tt> is a
+ * simple help to programmers to get started with their own
+ * implementation of <tt>Graphics2D</tt>.
+ * <tt>DefaultGraphics2D</tt> implements all the abstract methods
+ * is <tt>AbstractGraphics2D</tt> and makes it easy to start
+ * implementing a <tt>Graphic2D</tt> piece-meal.
+ *
+ * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
+ * @version $Id$
+ * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
+ */
+public class PDFDocumentGraphics2D extends PDFGraphics2D {
+ OutputStream stream;
+
+ PDFStream pdfStream;
+ int width;
+ int height;
+
+ /**
+ * Create a new PDFGraphics2D with the given pdf document info.
+ * This is used to create a Graphics object for use inside an already
+ * existing document.
+ * Maybe this could be handled as a subclass (PDFDocumentGraphics2d)
+ */
+ public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream, int width, int height)
+ {
+ super(textAsShapes);
+ standalone = true;
+ this.stream = stream;
+ this.pdfDoc = new PDFDocument();
+ this.pdfDoc.setProducer("FOP SVG Renderer");
+ pdfStream = this.pdfDoc.makeStream();
+ this.width = width;
+ this.height = height;
+
+ currentFontName = "";
+ currentFontSize = 0;
+ currentYPosition = 0;
+ currentXPosition = 0;
+// fontState = fs;
+
+ currentStream.write("1 0 0 -1 0 " + height + " cm\n");
+
+ // end part
+ /*
+ FontSetup.addToResources(this.pdfDoc, fontInfo);
+ */
+
+ }
+
+ public void finish() throws IOException
+ {
+ pdfStream.add(getString());
+ PDFResources pdfResources = this.pdfDoc.getResources();
+ PDFPage currentPage = this.pdfDoc.makePage(pdfResources, pdfStream,
+ width,
+ height, null);
+ this.pdfDoc.output(stream);
+
+ }
+
+ public String getString() {
+ return currentStream.toString();
+ }
+
+ public void setGraphicContext(GraphicContext c)
+ {
+ gc = c;
+ }
+
+ /**
+ * This constructor supports the create method
+ */
+ public PDFDocumentGraphics2D(PDFDocumentGraphics2D g){
+ super(g);
+ }
+
+ /**
+ * Creates a new <code>Graphics</code> object that is
+ * a copy of this <code>Graphics</code> object.
+ * @return a new graphics context that is a copy of
+ * this graphics context.
+ */
+ public Graphics create(){
+ return new PDFDocumentGraphics2D(this);
+ }
+
+}
diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java
index a376dbee0..e13a3f897 100644
--- a/src/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/org/apache/fop/svg/PDFGraphics2D.java
@@ -12,6 +12,8 @@ import org.apache.fop.pdf.*;
import org.apache.fop.layout.*;
import org.apache.fop.fonts.*;
import org.apache.fop.render.pdf.*;
+import org.apache.fop.image.*;
+import org.apache.fop.datatypes.ColorSpace;
import org.apache.batik.ext.awt.g2d.*;
@@ -40,18 +42,20 @@ import java.util.Map;
* @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
*/
public class PDFGraphics2D extends AbstractGraphics2D {
+ protected PDFDocument pdfDoc;
+
+ protected FontState fontState;
+
boolean standalone = false;
/** the PDF Document being created */
- protected PDFDocument pdfDoc;
+ //protected PDFDocument pdfDoc;
- protected FontState fontState;
+ //protected FontState fontState;
/** the current stream to add PDF commands to */
StringWriter currentStream = new StringWriter();
- PDFStream pdfStream;
-
/** the current (internal) font name */
protected String currentFontName;
@@ -65,9 +69,9 @@ public class PDFGraphics2D extends AbstractGraphics2D {
protected int currentXPosition = 0;
/** the current colour for use in svg */
- private PDFColor currentColour = new PDFColor(0, 0, 0);
+ PDFColor currentColour = new PDFColor(0, 0, 0);
- private FontInfo fontInfo;
+ FontInfo fontInfo;
/**
* Create a new PDFGraphics2D with the given pdf document info.
@@ -85,38 +89,10 @@ public class PDFGraphics2D extends AbstractGraphics2D {
fontState = fs;
}
- /**
- * Create a new PDFGraphics2D with the given pdf document info.
- * This is used to create a Graphics object for use inside an already
- * existing document.
- * Maybe this could be handled as a subclass (PDFDocumentGraphics2d)
- */
- public PDFGraphics2D(boolean textAsShapes, OutputStream stream)
+ public PDFGraphics2D(boolean textAsShapes)
{
super(textAsShapes);
- standalone = true;
- this.pdfDoc = new PDFDocument();
- this.pdfDoc.setProducer("FOP SVG Renderer");
- pdfStream = this.pdfDoc.makeStream();
-
- currentFontName = "";
- currentFontSize = 0;
- currentYPosition = 0;
- currentXPosition = 0;
-// fontState = fs;
-
- // end part
- /*
- FontSetup.addToResources(this.pdfDoc, fontInfo);
- pdfStream.write(getString())
- this.pdfResources = this.pdfDoc.getResources();
- currentPage = this.pdfDoc.makePage(this.pdfResources, currentStream,
- page.getWidth() / 1000,
- page.getHeight() / 1000, page);
- this.pdfDoc.output(stream);
- */
-
- }
+ }
public String getString() {
return currentStream.toString();
@@ -144,13 +120,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
return new PDFGraphics2D(this);
}
- public void setColor(Color c){
- super.setColor(c);
- currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
- currentStream.write(currentColour.getColorSpaceOut(false));
- currentStream.write(currentColour.getColorSpaceOut(true));
- }
-
/**
* Draws as much of the specified image as is currently available.
* The image is drawn with its top-left corner at
@@ -176,20 +145,161 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
*/
public boolean drawImage(Image img, int x, int y, ImageObserver observer){
- System.err.println("drawImage");
-/* int width = img.getWidth(observer);
- int height = img.getHeight(observer);
- FopImage fopimg = new FopImage() {
- };
+ System.err.println("drawImage:x, y");
+
+ final int width = img.getWidth(observer);
+ final int height = img.getHeight(observer);
+ if(width == -1 || height == -1) {
+ return false;
+ }
+
+ Dimension size = new Dimension(width, height);
+ BufferedImage buf = buildBufferedImage(size);
+
+ java.awt.Graphics2D g = buf.createGraphics();
+ g.setComposite(AlphaComposite.SrcOver);
+ g.setBackground(new Color(1, 1, 1, 0));
+ g.setPaint(new Color(1, 1, 1, 0));
+ g.fillRect(0, 0, width, height);
+ g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight()));
+
+ if(!g.drawImage(img, 0, 0, observer)) {
+ return false;
+ }
+ g.dispose();
+
+ final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3];
+
+ Raster raster = buf.getData();
+ DataBuffer bd = raster.getDataBuffer();
+
+ int count = 0;
+ switch(bd.getDataType()) {
+ case DataBuffer.TYPE_INT:
+ int[][] idata = ((DataBufferInt)bd).getBankData();
+ for(int i = 0; i < idata.length; i++) {
+ for(int j = 0; j < idata[i].length; j++) {
+ //System.out.println("data:" + ((idata[i][j] >> 24) & 0xFF));
+ if(((idata[i][j] >> 24) & 0xFF) != 255) {
+System.out.println("data:" + ((idata[i][j] >> 24) & 0xFF));
+ result[count++] = (byte)0xFF;
+ result[count++] = (byte)0xFF;
+ result[count++] = (byte)0xFF;
+ } else {
+ result[count++] = (byte)((idata[i][j] >> 16) & 0xFF);
+ result[count++] = (byte)((idata[i][j] >> 8) & 0xFF);
+ result[count++] = (byte)((idata[i][j]) & 0xFF);
+ }
+ }
+ }
+ break;
+ default:
+ // error
+ break;
+ }
+
+ try {
+ FopImage fopimg = new TempImage(width, height, result);
int xObjectNum = this.pdfDoc.addImage(fopimg);
- currentStream.add("q\n" + (((float) w) / 1000f) +
- " 0 0 " + (((float) h) / 1000f) + " " +
+ /*currentStream.write("q\n" + (((float) width)) +
+ " 0 0 " + (((float) height)) + " " +
x + " " +
- ((float)(y - h)) + " cm\n" + "/Im" +
+ ((float)(y - height)) + " cm\n" + "/Im" +
xObjectNum + " Do\nQ\n");*/
+ AffineTransform at = getTransform();
+ double[] matrix = new double[6];
+ at.getMatrix(matrix);
+ currentStream.write("q\n" + matrix[0] +
+ " " + matrix[1] + " " + matrix[2] + " " + matrix[3] + " " +
+ matrix[4] + " " +
+ matrix[5] + " cm\n");
+ currentStream.write("" + width +
+ " 0 0 " + (-height) + " " +
+ x + " " +
+ (y + height) + " cm\n" + "/Im" +
+ xObjectNum + " Do\nQ\n");
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
return true;
}
+ public BufferedImage buildBufferedImage(Dimension size) {
+ return new BufferedImage(size.width, size.height,
+ BufferedImage.TYPE_INT_ARGB);
+ }
+
+ class TempImage implements FopImage {
+ int m_height;
+ int m_width;
+ int m_bitsPerPixel;
+ ColorSpace m_colorSpace;
+ int m_bitmapSiye;
+ byte[] m_bitmaps;
+ PDFColor transparent = new PDFColor(255, 255, 255);
+
+ TempImage(int width, int height, byte[] result) throws FopImageException
+ {
+ this.m_height = height;
+ this.m_width = width;
+ this.m_bitsPerPixel = 8;
+ this.m_colorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
+ //this.m_isTransparent = false;
+ //this.m_bitmapsSize = this.m_width * this.m_height * 3;
+ this.m_bitmaps = result;
+ }
+
+ public String getURL() {return "" + m_bitmaps;}
+
+ // image size
+ public int getWidth() throws FopImageException
+ {
+ return m_width;
+ }
+
+ public int getHeight() throws FopImageException
+ {return m_height;}
+
+ // DeviceGray, DeviceRGB, or DeviceCMYK
+ public ColorSpace getColorSpace() throws FopImageException
+ {return m_colorSpace;}
+
+ // bits per pixel
+ public int getBitsPerPixel() throws FopImageException
+ {return m_bitsPerPixel;}
+
+ // For transparent images
+ public boolean isTransparent() throws FopImageException
+ {return transparent != null;}
+ public PDFColor getTransparentColor() throws FopImageException
+ {return transparent;}
+
+ // get the image bytes, and bytes properties
+
+ // get uncompressed image bytes
+ public byte[] getBitmaps() throws FopImageException
+ {return m_bitmaps;}
+// width * (bitsPerPixel / 8) * height, no ?
+ public int getBitmapsSize() throws FopImageException
+ {return m_width * m_height * 3;}
+
+ // get compressed image bytes
+ // I don't know if we really need it, nor if it
+ // should be changed...
+ public byte[] getRessourceBytes() throws FopImageException
+ {return null;}
+ public int getRessourceBytesSize() throws FopImageException
+ {return 0;}
+ // return null if no corresponding PDFFilter
+ public PDFFilter getPDFFilter() throws FopImageException
+ {return null;}
+
+ // release memory
+ public void close() {}
+
+ }
+
+
/**
* Draws as much of the specified image as has already been scaled
* to fit inside the specified rectangle.
@@ -278,10 +388,17 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setComposite
*/
public void draw(Shape s){
- System.out.println("draw(Shape)");
+ //System.out.println("draw(Shape)");
+ Color c = getColor();
+ currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
+ currentStream.write(currentColour.getColorSpaceOut(true));
+ c = getBackground();
+ PDFColor col = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
+ currentStream.write(col.getColorSpaceOut(false));
+
PDFNumber pdfNumber = new PDFNumber();
- PathIterator iter = s.getPathIterator(new AffineTransform());
+ PathIterator iter = s.getPathIterator(getTransform());
while(!iter.isDone()) {
double vals[] = new double[6];
int type = iter.currentSegment(vals);
@@ -427,8 +544,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
System.err.println("drawString(AttributedCharacterIterator)");
}
-
-
/**
* Fills the interior of a <code>Shape</code> using the settings of the
* <code>Graphics2D</code> context. The rendering attributes applied
@@ -444,10 +559,17 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see #setClip
*/
public void fill(Shape s){
- System.err.println("fill");
+ //System.err.println("fill");
+ Color c = getColor();
+ currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
+ currentStream.write(currentColour.getColorSpaceOut(true));
+ c = getBackground();
+ PDFColor col = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
+ currentStream.write(col.getColorSpaceOut(false));
+
PDFNumber pdfNumber = new PDFNumber();
- PathIterator iter = s.getPathIterator(new AffineTransform());
+ PathIterator iter = s.getPathIterator(getTransform());
while(!iter.isDone()) {
double vals[] = new double[6];
int type = iter.currentSegment(vals);
@@ -503,7 +625,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*/
public GraphicsConfiguration getDeviceConfiguration(){
System.out.println("getDeviceConviguration");
- return null;
+ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
/**
diff --git a/src/org/apache/fop/svg/PDFTranscoder.java b/src/org/apache/fop/svg/PDFTranscoder.java
new file mode 100644
index 000000000..3bb8d226c
--- /dev/null
+++ b/src/org/apache/fop/svg/PDFTranscoder.java
@@ -0,0 +1,655 @@
+/*****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ *****************************************************************************/
+
+package org.apache.fop.svg;
+
+import java.awt.AlphaComposite;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.geom.*;
+import java.awt.font.*;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.batik.transcoder.*;
+
+import org.apache.batik.bridge.BridgeContext;
+import org.apache.batik.bridge.BridgeException;
+import org.apache.batik.bridge.GVTBuilder;
+import org.apache.batik.bridge.UserAgent;
+import org.apache.batik.bridge.ViewBox;
+
+import org.apache.batik.dom.svg.DefaultSVGContext;
+import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.dom.svg.SVGOMDocument;
+import org.apache.batik.dom.util.DocumentFactory;
+
+import org.apache.batik.ext.awt.image.GraphicsUtil;
+
+import org.apache.batik.gvt.GraphicsNode;
+import org.apache.batik.gvt.GraphicsNodeRenderContext;
+import org.apache.batik.gvt.event.EventDispatcher;
+import org.apache.batik.gvt.renderer.ImageRenderer;
+import org.apache.batik.gvt.renderer.ImageRendererFactory;
+
+import org.apache.batik.transcoder.TranscoderException;
+import org.apache.batik.transcoder.TranscoderOutput;
+import org.apache.batik.transcoder.TranscodingHints;
+import org.apache.batik.transcoder.XMLAbstractTranscoder;
+import org.apache.batik.transcoder.image.resources.Messages;
+
+import org.apache.batik.transcoder.keys.BooleanKey;
+import org.apache.batik.transcoder.keys.FloatKey;
+import org.apache.batik.transcoder.keys.LengthKey;
+import org.apache.batik.transcoder.keys.PaintKey;
+import org.apache.batik.transcoder.keys.PaintKey;
+import org.apache.batik.transcoder.keys.Rectangle2DKey;
+import org.apache.batik.transcoder.keys.StringKey;
+import org.apache.batik.transcoder.*;
+
+import org.apache.batik.util.SVGConstants;
+
+import org.apache.batik.bridge.*;
+import org.apache.batik.swing.svg.*;
+import org.apache.batik.swing.gvt.*;
+import org.apache.batik.gvt.*;
+import org.apache.batik.gvt.renderer.*;
+import org.apache.batik.gvt.filter.*;
+import org.apache.batik.gvt.event.*;
+
+import org.w3c.dom.*;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.css.*;
+import org.w3c.dom.svg.SVGLength;
+
+import org.apache.fop.svg.*;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.svg.SVGAElement;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGSVGElement;
+
+// <!> FIXME : Those import clauses will change with new design
+import org.apache.batik.gvt.renderer.StaticRendererFactory;
+
+/**
+ * This class enables to transcode an input to an image of any format.
+ *
+ * <p>Two transcoding hints (<tt>KEY_WIDTH</tt> and
+ * <tt>KEY_HEIGHT</tt>) can be used to respectively specify the image
+ * width and the image height. If only one of these keys is specified,
+ * the transcoder preserves the aspect ratio of the original image.
+ *
+ * <p>The <tt>KEY_BACKGROUND_COLOR</tt> defines the background color
+ * to use for opaque image formats, or the background color that may
+ * be used for image formats that support alpha channel.
+ *
+ * <p>The <tt>KEY_AOI</tt> represents the area of interest to paint
+ * in device space.
+ *
+ * <p>Three additional transcoding hints that act on the SVG
+ * processor can be specified:
+ *
+ * <p><tt>KEY_LANGUAGE</tt> to set the default language to use (may be
+ * used by a &lt;switch> SVG element for example),
+ * <tt>KEY_USER_STYLESHEET_URI</tt> to fix the URI of a user
+ * stylesheet, and <tt>KEY_PIXEL_TO_MM</tt> to specify the pixel to
+ * millimeter conversion factor.
+ *
+ * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
+ * @version $Id$
+ */
+public class PDFTranscoder extends XMLAbstractTranscoder {
+
+ /** The user agent dedicated to an <tt>ImageTranscoder</tt>. */
+ protected UserAgent userAgent = new ImageTranscoderUserAgent();
+
+ /**
+ * Constructs a new <tt>ImageTranscoder</tt>.
+ */
+ public PDFTranscoder() {
+ hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI,
+ SVGConstants.SVG_NAMESPACE_URI);
+ hints.put(KEY_DOCUMENT_ELEMENT,
+ SVGConstants.SVG_SVG_TAG);
+ hints.put(KEY_DOM_IMPLEMENTATION,
+ SVGDOMImplementation.getDOMImplementation());
+ }
+
+ /**
+ * Transcodes the specified Document as an image in the specified output.
+ *
+ * @param document the document to transcode
+ * @param uri the uri of the document or null if any
+ * @param output the ouput where to transcode
+ * @exception TranscoderException if an error occured while transcoding
+ */
+ protected void transcode(Document document,
+ String uri,
+ TranscoderOutput output)
+ throws TranscoderException {
+
+ if (!(document instanceof SVGOMDocument)) {
+ throw new TranscoderException(
+ Messages.formatMessage("notsvg", null));
+ }
+ SVGDocument svgDoc = (SVGDocument)document;
+ SVGSVGElement root = svgDoc.getRootElement();
+ // initialize the SVG document with the appropriate context
+ String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
+ DefaultSVGContext svgCtx = new DefaultSVGContext();
+ svgCtx.setPixelToMM(userAgent.getPixelToMM());
+ ((SVGOMDocument)document).setSVGContext(svgCtx);
+
+ // build the GVT tree
+ GVTBuilder builder = new GVTBuilder();
+ ImageRendererFactory rendFactory = new StaticRendererFactory();
+ GraphicsNodeRenderContext rc = getRenderContext();
+ BridgeContext ctx = new BridgeContext(userAgent, rc);
+ GraphicsNode gvtRoot;
+ try {
+ gvtRoot = builder.build(ctx, svgDoc);
+ } catch (BridgeException ex) {
+ throw new TranscoderException(ex);
+ }
+ // get the 'width' and 'height' attributes of the SVG document
+ float docWidth = (float)ctx.getDocumentSize().getWidth();
+ float docHeight = (float)ctx.getDocumentSize().getHeight();
+ ctx = null;
+ builder = null;
+
+ // compute the image's width and height according the hints
+ float imgWidth = -1;
+ if (hints.containsKey(KEY_WIDTH)) {
+ imgWidth = ((Float)hints.get(KEY_WIDTH)).floatValue();
+ }
+ float imgHeight = -1;
+ if (hints.containsKey(KEY_HEIGHT)) {
+ imgHeight = ((Float)hints.get(KEY_HEIGHT)).floatValue();
+ }
+ float width, height;
+ if (imgWidth > 0 && imgHeight > 0) {
+ width = imgWidth;
+ height = imgHeight;
+ } else if (imgHeight > 0) {
+ width = (docWidth * imgHeight) / docHeight;
+ height = imgHeight;
+ } else if (imgWidth > 0) {
+ width = imgWidth;
+ height = (docHeight * imgWidth) / docWidth;
+ } else {
+ width = docWidth;
+ height = docHeight;
+ }
+ // compute the preserveAspectRatio matrix
+ AffineTransform Px;
+ String ref = null;
+ try {
+ ref = new URL(uri).getRef();
+ } catch (MalformedURLException ex) {
+ // nothing to do, catched previously
+ }
+
+ try {
+ Px = ViewBox.getViewTransform(ref, root, width, height);
+ } catch (BridgeException ex) {
+ throw new TranscoderException(ex);
+ }
+
+ if (Px.isIdentity() && (width != docWidth || height != docHeight)) {
+ // The document has no viewBox, we need to resize it by hand.
+ // we want to keep the document size ratio
+ float d = Math.max(docWidth, docHeight);
+ float dd = Math.max(width, height);
+ float scale = dd/d;
+ Px = AffineTransform.getScaleInstance(scale, scale);
+ }
+ // take the AOI into account if any
+ if (hints.containsKey(KEY_AOI)) {
+ Rectangle2D aoi = (Rectangle2D)hints.get(KEY_AOI);
+ // transform the AOI into the image's coordinate system
+ aoi = Px.createTransformedShape(aoi).getBounds2D();
+ AffineTransform Mx = new AffineTransform();
+ double sx = width / aoi.getWidth();
+ double sy = height / aoi.getHeight();
+ Mx.scale(sx, sy);
+ double tx = -aoi.getX();
+ double ty = -aoi.getY();
+ Mx.translate(tx, ty);
+ // take the AOI transformation matrix into account
+ // we apply first the preserveAspectRatio matrix
+ Px.preConcatenate(Mx);
+ }
+ // prepare the image to be painted
+ int w = (int)width;
+ int h = (int)height;
+
+ PDFDocumentGraphics2D graphics = new PDFDocumentGraphics2D(true, output.getOutputStream(), w, h);
+ // GraphicsNodeRenderContext rc = getRenderContext();
+ graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
+ graphics.setRenderingHints(rc.getRenderingHints());
+
+ gvtRoot.paint(graphics, rc);
+
+ try {
+ graphics.finish();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ throw new TranscoderException(ex);
+ }
+ /*
+ // paint the SVG document using the bridge package
+ // create the appropriate renderer
+ ImageRenderer renderer = rendFactory.createImageRenderer();
+ renderer.updateOffScreen(w, h);
+ renderer.setTransform(Px);
+ renderer.setTree(gvtRoot);
+ gvtRoot = null; // We're done with it...
+
+ try {
+ // now we are sure that the aoi is the image size
+ Shape raoi = new Rectangle2D.Float(0, 0, width, height);
+ // Warning: the renderer's AOI must be in user space
+ renderer.repaint(Px.createInverse().createTransformedShape(raoi));
+ BufferedImage rend = renderer.getOffScreen();
+ renderer = null; // We're done with it...
+
+ // BufferedImage dest = createImage(w, h);
+
+ //Graphics2D g2d = GraphicsUtil.createGraphics(dest);
+
+ //g2d.drawRenderedImage(rend, new AffineTransform());
+ } catch (Exception ex) {
+ throw new TranscoderException(ex);
+ }
+ */
+ }
+
+ public GraphicsNodeRenderContext getRenderContext() {
+ GraphicsNodeRenderContext nodeRenderContext = null;
+ if (nodeRenderContext == null) {
+ RenderingHints hints = new RenderingHints(null);
+ hints.put(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ hints.put(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+
+ FontRenderContext fontRenderContext =
+ new FontRenderContext(new AffineTransform(), true, true);
+
+ TextPainter textPainter = new StrokingTextPainter();
+
+ GraphicsNodeRableFactory gnrFactory =
+ new ConcreteGraphicsNodeRableFactory();
+
+ nodeRenderContext =
+ new GraphicsNodeRenderContext(new AffineTransform(),
+ null,
+ hints,
+ fontRenderContext,
+ textPainter,
+ gnrFactory);
+ nodeRenderContext.setTextPainter(textPainter);
+ }
+
+ return nodeRenderContext;
+ }
+
+ /**
+ * Creates a <tt>DocumentFactory</tt> that is used to create an SVG DOM
+ * tree. The specified DOM Implementation is ignored and the Batik
+ * SVG DOM Implementation is automatically used.
+ *
+ * @param domImpl the DOM Implementation (not used)
+ * @param parserClassname the XML parser classname
+ */
+ protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
+ String parserClassname) {
+ return new SAXSVGDocumentFactory(parserClassname);
+ }
+
+ // --------------------------------------------------------------------
+ // UserAgent implementation
+ // --------------------------------------------------------------------
+
+ /**
+ * A user agent implementation for <tt>ImageTranscoder</tt>.
+ */
+ protected class ImageTranscoderUserAgent implements UserAgent {
+
+ /**
+ * Returns the default size of this user agent (400x400).
+ */
+ public Dimension2D getViewportSize() {
+ return new Dimension(400, 400);
+ }
+
+ /**
+ * Displays the specified error message using the <tt>ErrorHandler</tt>.
+ */
+ public void displayError(String message) {
+ try {
+ getErrorHandler().error(new TranscoderException(message));
+ } catch (TranscoderException ex) {
+ throw new RuntimeException();
+ }
+ }
+
+ /**
+ * Displays the specified error using the <tt>ErrorHandler</tt>.
+ */
+ public void displayError(Exception e) {
+ try {
+ getErrorHandler().error(new TranscoderException(e));
+ } catch (TranscoderException ex) {
+ throw new RuntimeException();
+ }
+ }
+
+ /**
+ * Displays the specified message using the <tt>ErrorHandler</tt>.
+ */
+ public void displayMessage(String message) {
+ try {
+ getErrorHandler().warning(new TranscoderException(message));
+ } catch (TranscoderException ex) {
+ throw new RuntimeException();
+ }
+ }
+
+ /**
+ * Returns the pixel to millimeter conversion factor specified in the
+ * <tt>TranscodingHints</tt> or 0.3528 if any.
+ */
+ public float getPixelToMM() {
+ if (getTranscodingHints().containsKey(KEY_PIXEL_TO_MM)) {
+ return ((Float)getTranscodingHints().get(KEY_PIXEL_TO_MM)).floatValue();
+ } else {
+ // return 0.3528f; // 72 dpi
+ return 0.26458333333333333333333333333333f; // 96dpi
+ }
+ }
+
+ /**
+ * Returns the user language specified in the
+ * <tt>TranscodingHints</tt> or "en" (english) if any.
+ */
+ public String getLanguages() {
+ if (getTranscodingHints().containsKey(KEY_LANGUAGE)) {
+ return (String)getTranscodingHints().get(KEY_LANGUAGE);
+ } else {
+ return "en";
+ }
+ }
+
+ /**
+ * Returns the user stylesheet specified in the
+ * <tt>TranscodingHints</tt> or null if any.
+ */
+ public String getUserStyleSheetURI() {
+ return (String)getTranscodingHints().get(KEY_USER_STYLESHEET_URI);
+ }
+
+ /**
+ * Returns the XML parser to use from the TranscodingHints.
+ */
+ public String getXMLParserClassName() {
+ return (String)getTranscodingHints().get(KEY_XML_PARSER_CLASSNAME);
+ }
+
+ /**
+ * Unsupported operation.
+ */
+ public EventDispatcher getEventDispatcher() {
+ return null;
+ }
+
+ /**
+ * Unsupported operation.
+ */
+ public void openLink(SVGAElement elt) { }
+
+ /**
+ * Unsupported operation.
+ */
+ public void setSVGCursor(Cursor cursor) { }
+
+ /**
+ * Unsupported operation.
+ */
+ public void runThread(Thread t) { }
+
+ /**
+ * Unsupported operation.
+ */
+ public AffineTransform getTransform() {
+ return null;
+ }
+
+ /**
+ * Unsupported operation.
+ */
+ public Point getClientAreaLocationOnScreen() {
+ return new Point();
+ }
+
+ /**
+ * Tells whether the given feature is supported by this
+ * user agent.
+ */
+ public boolean hasFeature(String s) {
+ return FEATURES.contains(s);
+ }
+
+ /**
+ * Tells whether the given extension is supported by this
+ * user agent.
+ */
+ public boolean supportExtension(String s) {
+ return false;
+ }
+ }
+
+ protected final static Set FEATURES = new HashSet();
+ static {
+ FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_FEATURE);
+ FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_LANG_FEATURE);
+ FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_STATIC_FEATURE);
+ }
+
+ // --------------------------------------------------------------------
+ // Keys definition
+ // --------------------------------------------------------------------
+
+ /**
+ * The image width key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_WIDTH</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Float</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">The width of the top most svg element</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the width of the image to create.</TD></TR>
+ * </TABLE> */
+ public static final TranscodingHints.Key KEY_WIDTH
+ = new LengthKey();
+
+ /**
+ * The image height key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_HEIGHT</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Float</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">The height of the top most svg element</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the height of the image to create.</TD></TR>
+ * </TABLE> */
+ public static final TranscodingHints.Key KEY_HEIGHT
+ = new LengthKey();
+
+ /**
+ * The area of interest key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_AOI</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Rectangle2D</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">The document's size</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the area of interest to render. The
+ * rectangle coordinates must be specified in pixels and in the
+ * document coordinates system.</TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_AOI
+ = new Rectangle2DKey();
+
+ /**
+ * The language key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_LANGUAGE</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">String</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">"en"</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the preferred language of the document.
+ * </TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_LANGUAGE
+ = new StringKey();
+
+ /**
+ * The user stylesheet URI key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_USER_STYLESHEET_URI</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">String</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">null</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the user style sheet.</TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_USER_STYLESHEET_URI
+ = new StringKey();
+
+ /**
+ * The pixel to millimeter conversion factor key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_PIXEL_TO_MM</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Float</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">0.33</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the pixel to millimeter conversion factor.
+ * </TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_PIXEL_TO_MM
+ = new FloatKey();
+
+ /**
+ * The image background paint key.
+ * <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Key: </TH>
+ * <TD VALIGN="TOP">KEY_BACKGROUND_COLOR</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Value: </TH>
+ * <TD VALIGN="TOP">Paint</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Default: </TH>
+ * <TD VALIGN="TOP">null</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Required: </TH>
+ * <TD VALIGN="TOP">No</TD></TR>
+ * <TR>
+ * <TH VALIGN="TOP" ALIGN="RIGHT"><P ALIGN="RIGHT">Description: </TH>
+ * <TD VALIGN="TOP">Specify the background color to use.
+ * The color is required by opaque image formats and is used by
+ * image formats that support alpha channel.</TD></TR>
+ * </TABLE>
+ */
+ public static final TranscodingHints.Key KEY_BACKGROUND_COLOR
+ = new PaintKey();
+
+}
diff --git a/src/org/apache/fop/svg/SVG.java b/src/org/apache/fop/svg/SVG.java
index 92e7cffad..3b9b18c02 100644
--- a/src/org/apache/fop/svg/SVG.java
+++ b/src/org/apache/fop/svg/SVG.java
@@ -64,6 +64,8 @@ import org.w3c.dom.*;
import org.w3c.dom.svg.*;
import org.w3c.dom.svg.SVGLength;
+import java.io.File;
+
/**
* class representing svg:svg pseudo flow object.
*/
@@ -329,6 +331,10 @@ public class SVG extends SVGObj implements GraphicsCreator {
/* create an SVG area */
/* if width and height are zero, may want to get the bounds of the content. */
SVGOMDocument doc = new SVGOMDocument(null, SVGDOMImplementation.getDOMImplementation());
+ try {
+ doc.setURLObject(new File(".").toURL());
+ } catch(Exception e) {
+ }
DefaultSVGContext dc = new DefaultSVGContext() {
public float getPixelToMM() {
diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java
index bb217acf5..cb7305750 100644
--- a/src/org/apache/fop/svg/SVGElementMapping.java
+++ b/src/org/apache/fop/svg/SVGElementMapping.java
@@ -106,5 +106,11 @@ public class SVGElementMapping implements ElementMapping {
builder.addMapping(uri, "animateTransform", AnimateTransform.maker());
builder.addMapping(uri, "cursor", Cursor.maker());
builder.addMapping(uri, "filter", Filter.maker());
+
+ builder.addMapping(uri, "feFlood", FeFlood.maker());
+ builder.addMapping(uri, "feGaussianBlur", FeGaussianBlur.maker());
+ builder.addMapping(uri, "feOffset", FeOffset.maker());
+ builder.addMapping(uri, "feMerge", FeMerge.maker());
+ builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
}
}
diff --git a/src/org/apache/fop/svg/SVGObj.java b/src/org/apache/fop/svg/SVGObj.java
index cd81d7bb3..c5d53ad6f 100644
--- a/src/org/apache/fop/svg/SVGObj.java
+++ b/src/org/apache/fop/svg/SVGObj.java
@@ -62,6 +62,8 @@ import org.apache.batik.dom.svg.*;
import org.w3c.dom.svg.*;
import org.w3c.dom.*;
+import java.util.*;
+
/**
* Since SVG objects are not layed out then this class checks
* that this element is not being layed out inside some incorrect
@@ -80,14 +82,28 @@ public abstract class SVGObj extends FObj implements GraphicsCreator {
super(parent, propertyList);
}
+ protected static Hashtable ns = new Hashtable();
+
public void addGraphic(Document doc, Element parent) {
Element element = doc.createElementNS("http://www.w3.org/2000/svg", tagName);
// Element element = doc.createElement(tagName);
for(int count = 0; count < props.length; count++) {
if(this.properties.get(props[count]) != null) {
String rf = this.properties.get(props[count]).getString();
- if(rf != null)
- element.setAttribute(props[count], rf);
+ if(rf != null) {
+ if(props[count].indexOf(":") == -1) {
+ element.setAttribute(props[count], rf);
+ } else {
+ String pref = props[count].substring(0, props[count].indexOf(":"));
+System.out.println(pref);
+ if(pref.equals("xmlns")) {
+ ns.put(props[count].substring(props[count].indexOf(":") + 1), rf);
+System.out.println(ns);
+ }
+ ns.put("xlink", "http://www.w3.org/1999/xlink");
+ element.setAttributeNS((String)ns.get(pref), props[count], rf);
+ }
+ }
}
}
parent.appendChild(element);