Hi Sudhakar,

Sudhakar S <[EMAIL PROTECTED]> wrote on 07/05/2006 05:30:03 AM:

> I am trying to export Zoomed In SVGDocument to JPEG file. But after 
exported
> as JPEG, it doesn?t have same size, which is in SVGCanvas. I am setting
> KEY_WIDTH and KEY_HEIGHT transcoding hint values calculated using 
following
> code. 
> 
> GraphicsNode gNode = getGraphicsNode();
> Rectangle2D viewRect = (Rectangle2D)gNode.getBounds().clone();

   This is not necessarily the same as the viewBox rect.  This
is the actual bounds of the geometry which can be larger or
smaller than the rectangle specified by the viewBox attribute.

   The batik.bridge.ViewBox class has a bunch of useful methods for
dealing with the viewBox (in particular parseViewBoxAttribute).

> AffineTransform vCoordi = getViewBoxTransform();

   The viewBoxTransform includes the transform due to viewBox
(the Viewing Transform) along with the transform due to user
pan/zoom (the Rendering Transform).

> In SVGAbstractTranscoder, while calculating the scale value using 
following
> code, it doesn?t return the same scale value of 
> ?getSVGDocument().getRootElement().getCurrentScale()?.

   The value returned by 'getCurrentScale' only considers the 
transform due to user pan/zoom (the rendering transform)
it does not include the viewing transform.

> float xscale, yscale;
> xscale = width/docWidth;
> yscale = height/docHeight;
> float scale = Math.min(xscale,yscale);
> 
> Since there is some difference is scale value, it doesn?t export scaled 
JPEG
> file with exact size. Can anyone please explain how to export JPEG file 
with
> exact zoom in size?

    I would transform the real viewBox with the viewingTransform,
this should give you the proper width/height.


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

Reply via email to