xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tonny Kohar <to...@kiyut.com>
Subject Re: using JSVGCanvas to draw somewhere else
Date Fri, 23 Jul 2004 04:00:55 GMT

> 1) Why does JSVGCanvas.getGraphicsNode()sometimes return null, at
> first. What event must I wait on to be sure that the data is
> available?

I think you can wait for GVT listener specially rendererComplete. Hope
it solve your problem.

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

It maybe because the viewbox or transform stuff. Try to calculate the
bounds by applying the transform of graphicsNode.getGlobalTransform()
Shape shape = (Shape)graphicsNode.getBounds();
AffineTransform at = graphicsNode.getGlobalTransform()
shape = at.createTransformedShape(shape);
Rectangle bounds = shape.getBounds();

Tonny Kohar
SVG Graphics Editor

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

View raw message