xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thierry Kormann <tkorm...@ilog.fr>
Subject Re: zoomable with scrollable window
Date Wed, 27 Feb 2002 22:25:10 GMT
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,

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

View raw message