Tonny Kohar wrote:
2) Why does GraphicsNode.getBounds()sometimes return really tiny rectangles? (Drawing many of the sample SVGs included with Batik renders them in a 1 or 2 pixel box, and I have to zoom the hell out of the transform in order to see anything. Still, other SVG samples display at the proper size.)
I suspect this is caused by loading the SVG before the JSVGCanvas has a size. If the canvas doesn't have a size (or size is zero) it set's it's size to 1 for purposes of calculating the viewing transform.
This raises the other issue I was going to mention which is the JSVGCanvas may not be what you want to be using here. A better match might be to use the batik.transcoder.SVGAbstractTranscoder. This will build the GVT tree and set the viewing transform in a bit lighter weight manner - and also probably easier to understand.
It maybe because the viewbox or transform stuff. Try to calculate the
bounds by applying the transform of graphicsNode.getGlobalTransform()
eg: Shape shape = (Shape)graphicsNode.getBounds();
AffineTransform at = graphicsNode.getGlobalTransform()
shape = at.createTransformedShape(shape);
Rectangle bounds = shape.getBounds();
Regards Tonny Kohar
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
