You definately want to use ShapeNode.getGlobalTransform. The reason you end up with such a small output image is because your UserAgent doesn't provide an appropriate viewportSize. The default viewport size (from batik.bridge.UserAgentAdapter) is 1x1. You probably want to change this so it returns BridgeContext.getDocumentSize().
I think this will solve your problems.
Andres Toussaint wrote:
Hello:
I have a DXF export utility that converts graphics2D objects into DXF.
I am using the GVTTreeWalker to gain access to the Graphics2D objects to feed my converter, specifically I intercept the ShapeNode and the TextNode graphics objects.
For a self contained SVG file everything works almost fine (will explain later).
The problem at hand is when i place another SVG file into my original file using the <image .... /> SVG attribute. I have noticed that the GVT refers to this image with a ImageNode. The problem is: The SVG placed image has a width/height of, for instance 100x100pt, and the placed image has a width/height attributes of 50x50pt. I have not found a way to properly transform my shapes to, a) be actual size (72dpi), and b) have the width/height specified in the attributes.
MY problem will be defined in several scenarios:
1. If I retrieve every shape using:
Shape s = ShapeNode.getOutline(); PathIterator pi = s.getPathIterator(*new AffineTransform()*);
I get a file that has bounds bigger than those defined in the attributes of the main SVG file (for example, defined 300x200 and i get 380x240), and the embedded images are rendered at their original size, instead of the one defined in the attributes. TextNode attributes are rendered properly.
2. If i retrieve every shape using this second option:
Shape s = ShapeNode.getOutline(); PathIterator pi = s.getPathIterator(*ShapeNode.getGlobalTransform*);
I get a file that has the embedded images properly scaled (transformed) as defined in the main SVG document, but the resulting image has bounds really, really small (for example, instead of 300x200 i get 3x2). The textNode.getLocation() returns (0,0) as a value, so i tried by retrieving the Bounds, and i get (0,0,x,y) where x,y is the actual location of of the text, but if I use getTransformedBounds(getGlobalTransform()) i do not get a good transform of the coordinates.
-----------------
What i want to accomplish is to "render" the GVT applying properly the Transforms and being able to have the output shapes in actual 72 dpi size. My images are quite large (3500x1500 pts. average) and i do require to generate relatively accurate DXF output.
I would appreciate your help,
Andres Toussaint
PS. The method TextNode.getLocation() does not return an appropriate value (it returns 0,0), i think this may be a bug.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]