deweese 2003/06/07 10:19:18 Modified: sources/org/apache/batik/bridge SVGImageElementBridge.java SVGSVGElementBridge.java test-resources/org/apache/batik/test samplesRendering.xml Added: samples/tests/spec/scripting viewBoxOnLoad.svg Log: 1) Fixed bug setting viewBox on outermost SVG element as described in: http://koala.ilog.fr/batik/mlists/batik-users/archives/msg03513.html Also added test for setting inner/outer svg viewbox onload. 2) Added several files to regard's 'samples' tests. Revision Changes Path 1.1 xml-batik/samples/tests/spec/scripting/viewBoxOnLoad.svg Index: viewBoxOnLoad.svg =================================================================== <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd"> <!-- ====================================================================== --> <!-- 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. --> <!-- ====================================================================== --> <!-- ====================================================================== --> <!-- Modification of viewbox on outermost svg onLoad --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: viewBoxOnLoad.svg,v 1.1 2003/06/07 17:19:18 deweese Exp $ --> <!-- ====================================================================== --> <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> <svg id="body" width="450" height="500" viewBox="0 0 450 500" onload="setViewBoxTo(evt,'50 25 150 166.7')"> <title>'viewBox' modification in 'onload'</title> <script type="text/ecmascript"> function setViewBoxTo(evt, val){ var svg = evt.getTarget(); svg.setAttribute('viewBox', val); } </script> <rect x="0" y="0" width="450" height="500" fill="#F88"/> <rect x="50" y="25" width="150" height="166.7" fill="#AAA"/> <svg x="75" y="75" width="100" height="100" overflow="visible" viewBox="0 0 100 100" onload="setViewBoxTo(evt, '-10 -10 120 120')"> <rect x="-10" y="-10" width="120" height="120" fill="#F88"/> </svg> <rect x="75" y="75" width="100" height="100" fill="#AAF"/> <text x="125" y="45" class="title">viewBox modification <tspan x="125" dy="1.2em"> in 'onload'</tspan></text> <text x="125" y="188" class="legend">No red should show</text> </svg> 1.54 +8 -2 xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java Index: SVGImageElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- SVGImageElementBridge.java 11 Apr 2003 13:54:49 -0000 1.53 +++ SVGImageElementBridge.java 7 Jun 2003 17:19:18 -0000 1.54 @@ -24,6 +24,7 @@ import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit; import org.apache.batik.ext.awt.image.renderable.Filter; import org.apache.batik.ext.awt.image.spi.ImageTagRegistry; +import org.apache.batik.gvt.CanvasGraphicsNode; import org.apache.batik.gvt.CompositeGraphicsNode; import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.ImageNode; @@ -367,13 +368,18 @@ } SVGSVGElement svgElement = imgDocument.getRootElement(); - GraphicsNode node = ctx.getGVTBuilder().build(ctx, svgElement); + CanvasGraphicsNode node; + node = (CanvasGraphicsNode)ctx.getGVTBuilder().build(ctx, svgElement); ctx.addUIEventListeners(imgDocument); // HACK: remove the clip set by the SVGSVGElement as the overflow // and clip properties must be ignored. The clip will be set later // using the overflow and clip of the <image> element. node.setClip(null); + // HACK: remove the viewingTransform set by the SVGSVGElement + // as the viewBox must be ignored. The viewingTransform will + // be set later using the width/height of the image element. + node.setViewingTransform(new AffineTransform()); result.getChildren().add(node); // create the implicit viewBox for the SVG image. The viewBox for a 1.34 +6 -3 xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java Index: SVGSVGElementBridge.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- SVGSVGElementBridge.java 11 Apr 2003 13:54:52 -0000 1.33 +++ SVGSVGElementBridge.java 7 Jun 2003 17:19:18 -0000 1.34 @@ -74,7 +74,7 @@ // have a parent SVG element, this check makes sure only the // real root of the SVG Document tries to do negotiation with // the UA. - SVGDocument doc = (SVGDocument)((SVGElement)e).getOwnerDocument(); + SVGDocument doc = (SVGDocument)e.getOwnerDocument(); boolean isOutermost = (doc.getRootElement() == e); float x = 0; float y = 0; @@ -132,14 +132,17 @@ // agent, so we don't need to set the transform for outermost svg Shape clip = null; if (!isOutermost) { + // X & Y are ignored on outermost SVG. cgn.setPositionTransform(positionTransform); - cgn.setViewingTransform(viewingTransform); } else { // <!> FIXME: hack to compute the original document's size if (ctx.getDocumentSize() == null) { ctx.setDocumentSize(new Dimension((int)w, (int)h)); } } + // Set the viewing transform, this is often updated when the + // component prepares for rendering. + cgn.setViewingTransform(viewingTransform); if (CSSUtilities.convertOverflow(e)) { // overflow:hidden float [] offsets = CSSUtilities.convertClip(e); 1.96 +9 -1 xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml Index: samplesRendering.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v retrieving revision 1.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- samplesRendering.xml 24 Mar 2003 10:07:01 -0000 1.95 +++ samplesRendering.xml 7 Jun 2003 17:19:18 -0000 1.96 @@ -39,6 +39,7 @@ <test id="samples/moonPhases.svg" /> <test id="samples/sizeOfSun.svg" /> <test id="samples/sunRise.svg" /> + <test id="samples/sydney.svg" /> <test id="samples/textRotate.svg" /> <test id="samples/textRotateShadows.svg" /> </testGroup> @@ -77,6 +78,12 @@ <test id="samples/extensions/filterRegionDetailed.svg" > <property name="Validating" class="java.lang.Boolean" value="false" /> </test> + <test id="samples/extensions/opera/opera-subImage.svg" > + <property name="Validating" class="java.lang.Boolean" value="false" /> + </test> + <test id="samples/extensions/opera/opera-subImageRef.svg" > + <property name="Validating" class="java.lang.Boolean" value="false" /> + </test> </testGroup> <!-- ======================================================================= --> @@ -364,6 +371,7 @@ <test id="samples/tests/spec/scripting/tspanProperties.svg" /> <test id="samples/tests/spec/scripting/use.svg" /> <test id="samples/tests/spec/scripting/visibility.svg" /> + <test id="samples/tests/spec/scripting/viewBoxOnLoad.svg" /> <test id="samples/tests/spec/scripting/xyModifOnLoad.svg" /> </testGroup>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]