You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Potts, David" <DP...@tandbergtv.com> on 2003/10/10 15:34:54 UTC

Size to Fit

 
I have an application with batik in an SVG canvas inside a scroll pane, I
have it set up so that it's possible to zoom in and out.
 
I also overlay on top several JComponents that zoom in sequence with the
Batik image.
 
 
When you zoom in on a Batik image, if there is enough space in the canvas
window, instead of using the scale factor quote in an AffineTransform the
batik image will sometimes enlarge its self if there is space, is there
anyway of stopping it doing this? Or alternatively find out what its actual
done?
 
 
If you have a Batik image in a JSvgCanvas and the Batik image is smaller
than the window, then the image in cantered in the middle of the window, is
there any way of forcing that batik image to either lock to the left hand
border.  It is possible to take the window size, and the batik image size,
subtract the two and use that as a image offset, but I would prefer that the
batik image, just  align itself to the left margin.
 
I have assumed that batik is being clever and performing a scale to fit
 
David.


***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.

www.tandbergtv.com
***********************************************************************************


Re: Size to Fit

Posted by Thomas DeWeese <Th...@Kodak.com>.
Potts, David wrote:

> 
> 
>  
> 
> I have an application with batik in an SVG canvas inside a scroll pane, 
> I have it set up so that it's possible to zoom in and out.
> 
> I also overlay on top several JComponents that zoom in sequence with the 
> Batik image.
> 
> When you zoom in on a Batik image, if there is enough space in the 
> canvas window, instead of using the scale factor quote in an 
> AffineTransform the batik image will sometimes enlarge its self if there 
> is space, is there anyway of stopping it doing this? Or alternatively 
> find out what its actual done?

    This is generally controlled by the 'updateRenderingTransform()'
method on the JSVGCanvas.  If you want to know what the current rendering
transform is (i.e. how the SVG document is being mapped to the window) you
can always call getRenderingTransform().

> If you have a Batik image in a JSvgCanvas and the Batik image is smaller 
> than the window, then the image in cantered in the middle of the window, 
> is there any way of forcing that batik image to either lock to the left 
> hand border.  It is possible to take the window size, and the batik 
> image size, subtract the two and use that as a image offset, but I would 
> prefer that the batik image, just  align itself to the left margin.

    This is done the by the updateRenderingTransform method.

> I have assumed that batik is being clever and performing a scale to fit

    Yes, but partly because the SVG specification requires this for content
that has a 'viewBox' attribute.  You may be able to get what you want just
by playing with the 'preserveAspectRatio' attribute on the outermost SVG element.




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