Hi Sudhakar,
Sudhakar S <[EMAIL PROTECTED]> wrote on 07/07/2006 07:07:45 AM:
> Actually i didnt use viewBox attribute in my application. Because if use
> viewBox attribute, SVGCanvas is not showing the exact size of the
document.
> Total SVG document is zoomed out to smaller size.
It is true that an SVG implementation must fit the viewBox to the
available Width/Height.
> But if i use other editors(Internet Explorer) to open exported SVG
> file. Size is perfect. So could you please explain how to show exact
> SVG Document with viewBox attribute.
As I think I mentioned earlier you can modify
JSVGComponent.calculateViewingTransform (perhaps to always return
the identity transform). I'm guessing that they don't limit width/height
in any way so the viewBox is generally mapped 1:1 to screen. Batik
limits width/height to screen size.
> I have used the following code to get zoomed in/zoomed out size of the
> Document. But still i couldn't able to get the exact size. So can you
please
> give some more information to get proper width and height?
The code below looks mostly right to me (see comment below).
So without any more information on how things are failing (how
far are they off, how you are determining what is right vs
wrong, etc) I can't help.
> SVGSVGElement el = _document.getRootElement();
> String viewBoxStr = el.getAttributeNS(null,
> SVGConstants.SVG_VIEW_BOX_ATTRIBUTE);
> float[] r = ViewBox.parseViewBoxAttribute(el, viewBoxStr);
> GraphicsNode gn = getGraphicsNode();
> CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn);
> if (cgn != null) {
> AffineTransform vTx = cgn.getViewingTransform();
This should probably be canvas.
getViewBoxTransform()
> final Rectangle docSize = vTx.createTransformedShape(new
> Rectangle((int)r[0], (int)r[1], (int)r[2], (int)r[3])).getBounds();
> System.out.println("Doc Size::" + docSize);
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]