xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Bunn <...@basen.net>
Subject Solved - Re: Identifying SVG DOM node equivalents in GVT
Date Mon, 25 Sep 2006 12:20:48 GMT

On Sep 22, 2006, at 19:06 , Erik Bunn wrote:

> Hm. What are the prerequisites to using the SVGLocatable transforms?
> Should I be able to add an element and transform it like this?
>
>   // ...load SVGDocument...
>   Element g = svgDocument.createElementNS 
> ( SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_G_TAG );
>   someElement.appendChild( g );
>   SVGMatrix xform = SVGLocatableSupport.getCTM( g );
>   xform.translate( 42.0f, 42.0f );
>   // ...proceed to rendering...
>
>
> This produces a NullPointerException in the anonymous SVGMatrix  
> implementation by SVGLocatableSupport.getCTM() - the 'g' I created  
> doesn't have an SVGContext yet. I suppose I'm skipping essential  
> steps... Do I need to build a GVT first, or do some sort of update?

Further digging brought me to what I surmise is the right way:

         SVGTransformList transformList = ((SVGTransformable) 
someElement).getTransform().getBaseVal();
         SVGSVGElement svg = mySVGDocument.getRootElement();
         SVGTransform xform = svg.createSVGTransform();
         xform.setTranslate( 42.0f, 42.0f );
         transformList.appendItem( xform );

Somehow, when trying to figure out Batik processing, I seem to zero  
in on interestingly named methods in all the wrong classes, and to  
make shaky assumptions. Ah, well, this part is solved, now onward;
//ebu


---------------------------------------------------------------------
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