Hi Phil,

"Phil Wright" <[EMAIL PROTECTED]> wrote on 11/23/2006 02:05:36 PM:

> So I have some <path> elements in my SVG document and I want to get the 
bounding box.

   You need to boot the CSS and SVG DOM's:
        http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom 

> 
> I tried this (basically guessing at the procedure):
> 
>     public static Rectangle2D getPathBBox(SVGDocument doc, String name) 
{ 
>         SVGRect rect;
>         SVGOMPathElement pe;
>         pe = (SVGOMPathElement)doc.getElementById(name);
>         pe.setSVGContext(new SVGPathElementBridge());
>         rect = pe.getBBox();
>         return new 
Rectangle2D.Double(rect.getX(),rect.getY(),rect.getWidth(),
> rect.getHeight());
>     }
> 
> But it went boom:
> 
>     at 
org.apache.batik.bridge.AbstractGraphicsNodeBridge.getBBox(Unknown Source)
>     at org.apache.batik.dom.svg.SVGLocatableSupport.getBBox (Unknown 
Source)
>     at org.apache.batik.dom.svg.SVGGraphicsElement.getBBox(Unknown 
Source)
>     at SVGDocUtil.getPathBBox(SVGDocUtil.java:160)
> 
> Any help gratefully accepted.
> 
>      Phil
> 
> -- 
> Visit http://www.darkisle.com for photos of castles, cairns and other 
historic
> sites in the British Isles. 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to