You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Duong, Lien T" <Li...@jhuapl.edu> on 2002/02/21 18:47:21 UTC

zoomable with scrollable window

I like to be able to do zoom in as in the svg brower example but have a
scrollable window. The current svgbrowser only show part of the file. In
stead of using the JSVGCanvas, I modified the source code and got what I
wanted but I couldn't zoom in any bigger than 6400 x 6400. It ran out of
memory. Does anyone have a solution to this problem? I am in the process of
writing the code to only show part of the image and tie that with the
scrollbar. It would be better if I can draw the whole image the first time.

P.S. please email all response to me directly.

Thanks,

Lien

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


Re: zoomable with scrollable window

Posted by Thierry Kormann <tk...@ilog.fr>.
Duong, Lien T wrote:

> I like to be able to do zoom in as in the svg brower example but have a
> scrollable window. The current svgbrowser only show part of the file. In
> stead of using the JSVGCanvas, I modified the source code and got what I
> wanted but I couldn't zoom in any bigger than 6400 x 6400. It ran out of
> memory. Does anyone have a solution to this problem? I am in the process of
> writing the code to only show part of the image and tie that with the
> scrollbar. It would be better if I can draw the whole image the first time.
> 
> P.S. please email all response to me directly.

If you put the JSVGCanvas inside a JScrollPane, that's not the right way

to go. JScrollPane just set the canvas' size to its preferred size (which is 
the size of the svg document - defined by the width/height attributes).

The JSVGCanvas allocates an offscreen buffer for the document and the image is 
as big as the size of the component - and in that case, the offscreen image 
can be really huge.

What I recommend is to subclass the JSVGCanvas and implements a custom 
scrollable behavior. It means that scrolling top/bottom or right/left is 
equivalent to panning inside the document. Panning can be achieve using the 
setRenderingTransform on the JSVGCanvas.

The most difficult part is to update the thumb according to the zoom factor 
(if you need to zoom). Using the getRenderingTransform, you can update the 
thumb' size.

Hope that helps,
Thierry.



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