tkormann 01/09/11 02:18:32 Modified: sources/org/apache/batik/bridge SVGSVGElementBridge.java Added: samples/tests svgEnableBackground.svg Log: Fix a bug. enable-background is now supported on <svg> element. A new test based on the one provided by thomas has been added. Revision Changes Path 1.1 xml-batik/samples/tests/svgEnableBackground.svg Index: svgEnableBackground.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. --> <!-- ========================================================================= --> <!-- ========================================================================= --> <!-- Test description here --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id $ --> <!-- ========================================================================= --> <?xml-stylesheet type="text/css" href="test.css" ?> <svg id="body" width="450" height="500" viewBox="0 0 450 500"> <title> enable-background Test on< svg> </title> <!-- ============================================================= --> <!-- Test content --> <!-- ============================================================= --> <g id="testContent"> <text x="225" y="40" class="title"> Enable-Background Test on< svg> </text> <g transform="translate(0, 60)"> <defs> <g id="uglyBlobs"> <circle id="Circle1" cx="20" cy="65" r="15" style="fill:orange"/> <circle id="Circle2" cx="40" cy="55" r="15" style="fill:red"/> <rect id="Rect1" x="20" y="35" width="15" height="70" style="fill:DarkBlue"/> <rect id="Rect2" x="30" y="15" width="15" height="70" rx="10" ry="10" style="fill:Yellow"/> </g> <filter id="OffsetBGX" filterUnits="userSpaceOnUse" x="0" y="0" width="120" height="120"> <feOffset in="BackgroundImage" dx="60" dy="0"/> </filter> <filter id="OffsetBGY" filterUnits="userSpaceOnUse" x="0" y="0" width="440" height="260"> <feOffset in="BackgroundImage" dx="0" dy="140"/> </filter> </defs> <g transform="translate(0 40)" class="legend"> <!-- ============================================== --> <!-- Enable Background_1_* --> <!-- ============================================== --> <svg transform="translate(0 20)" class="row1" width="421" height="400" style="enable-background:new 19 30 403 60"> <g id="c1" transform="translate(20 0)" style="enable-background:new;"> <rect x="0" y="0" width="60" height="120" style="fill:Beige"/> <use xlink:href="#uglyBlobs"/> <rect x="0" y="0" width="1" height="1" style="filter:url(#OffsetBGX)"/> <rect x="0" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <rect x="60" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <g transform="translate(60, 135)"> <text x="0" y="0" style="text-anchor:middle"> Left Copied to right </text> </g> </g> <g id="c2" transform="translate(160 0)"> <line x1="-5" y1="20" x2="125" y2="45" style="stroke-width:5; stroke:#AA3333"/> <line x1="-5" y1="100" x2="125" y2="75" style="stroke-width:5; stroke:#AA3333"/> <g style="enable-background:new"> <rect x="0" y="0" width="60" height="120" style="fill:Beige"/> <g style="opacity: 0.75"> <rect x="5" y="5" width="50" height="50" style="fill:deepPink"/> <use xlink:href="#uglyBlobs" style="opacity:0.75"/> <rect x="0" y="0" width="120" height="120" style="filter:url(#OffsetBGX)"/> </g> </g> <rect x="0" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <rect x="60" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <g transform="translate(60, 135)"> <text x="0" y="0" style="text-anchor:middle"> Right is transparent </text> </g> </g> <g id="c2" transform="translate(300 0)"> <line x1="-5" y1="20" x2="125" y2="45" style="stroke-width:5; stroke:#AA3333"/> <line x1="-5" y1="100" x2="125" y2="75" style="stroke-width:5; stroke:#AA3333"/> <rect x="0" y="0" width="60" height="120" style="fill:Beige"/> <g style="enable-background:new"> <ellipse cx="25" cy="45" rx="20" ry="30" style="fill:#AA00CC"/> <g style="opacity: 0.75"> <use xlink:href="#uglyBlobs"/> <rect x="0" y="0" width="120" height="120" style="filter:url(#OffsetBGX)"/> </g> </g> <rect x="0" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <rect x="60" y="0" width="60" height="120" style="fill:none; stroke:black; stroke-width:2"/> <g transform="translate(60, 135)"> <text x="0" y="0" style="text-anchor:middle"> Blobs opaquely merged w/ oval </text> </g> </g> <!-- ============================================== --> <!-- BGEnable _2_* --> <!-- ============================================== --> <rect x="0" y="0" width="10" height="10" style="filter:url(#OffsetBGY)"/> <g transform="translate(220, 270)"> <text x="0" y="0" style="text-anchor:middle"> Copy of middle of first row (by setting enable-background bounds) </text> </g> </svg> </g> </g> </g> <!-- ============================================================= --> <!-- Batik sample mark --> <!-- ============================================================= --> <use xlink:href="../batikLogo.svg#Batik_Tag_Box"/> </svg> 1.16 +7 -1 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.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- SVGSVGElementBridge.java 2001/09/04 12:31:51 1.15 +++ SVGSVGElementBridge.java 2001/09/11 09:18:32 1.16 @@ -31,7 +31,7 @@ * Bridge class for the <svg> element. * * @author <a href="mailto:[EMAIL PROTECTED]">Thierry Kormann</a> - * @version $Id: SVGSVGElementBridge.java,v 1.15 2001/09/04 12:31:51 tkormann Exp $ + * @version $Id: SVGSVGElementBridge.java,v 1.16 2001/09/11 09:18:32 tkormann Exp $ */ public class SVGSVGElementBridge extends AbstractSVGBridge implements GraphicsNodeBridge, ErrorConstants { @@ -150,6 +150,12 @@ (gn, ctx.getGraphicsNodeRenderContext()); gn.setClip(new ClipRable8Bit(filter, clip)); } catch (NoninvertibleTransformException ex) {} + } + + // 'enable-background' + Rectangle2D r = CSSUtilities.convertEnableBackground(e, uctx); + if (r != null) { + gn.setBackgroundEnable(r); } ctx.openViewport --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]