xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Morawetz <martin.moraw...@kreativezone.at>
Subject How to render the content of a SVG-File into some Graphics2D Object?
Date Thu, 22 Dec 2005 19:54:39 GMT
I'd like to paint the content of an existing
Svg-File into some other Graphics2D Object.

I experimented whith BridgeContext and
GVTBuilder without success:

UserAgent userAgent = new UserAgentAdapter();
DocumentLoader loader = new DocumentLoader(userAgent);
BridgeContext ctx = new BridgeContext(userAgent, loader);
ctx.setDynamic(true);
SVGDocument svgDoc = (SVGDocument) loader.loadDocument(strInputFile);
GVTBuilder builder = new GVTBuilder();
GraphicsNode graphicsNode = builder.build(ctx, svgDoc);
graphicsNode.paint(newSvgGraphics2D);


The result is just:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg style="stroke-dasharray:none; shape-rendering:auto; 
font-family:&apos;sansserif&apos;; text-rendering:auto; fill-opacity:1; 
color-rendering:auto; color-interpolation:auto; font-size:12; 
fill:black; stroke:black; image-rendering:auto; stroke-miterlimit:10; 
stroke-linecap:square; stroke-linejoin:miter; font-style:normal; 
stroke-width:1; stroke-dashoffset:0; font-weight:normal; 
stroke-opacity:1;" xmlns="http://www.w3.org/2000/svg" 
contentScriptType="text/ecmascript" preserveAspectRatio="xMidYMid meet" 
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" 
version="1.0" contentStyleType="text/css">
   <!--Generated by the Batik Graphics2D SVG Generator-->
   <defs id="genericDefs" />
   <g>
     <defs id="defs1">
       <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1">
         <path d="M0 0 L1 0 L1 1 L0 1 L0 0 Z" />
       </clipPath>
     </defs>
     <g style="fill:white; stroke:white;">
       <rect x="0" y="0" width="640" style="clip-path:url(#clipPath1); 
stroke:none;" height="480" />
     </g>
   </g>
</svg>


The output is not even a subset of the original svg-file.

Has anybody an idea how to solve my problem?

Is there an other way than using the GVTBuilder?

-- 
Regards
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message