Hi Shamjith,
Shamjith K V <[EMAIL PROTECTED]> wrote on 02/28/2006 02:35:35 AM:
> I am trying to implement a SVG viewer with SWT(Standard Widget Toolkit)
and
> batik libraries. I am also providing custom zooming options.The widget I
am
> using is org.eclipse.swt.widgets.MenuItem, for %level zooming, for this
I am
> making use of the swing thread to get the desired zooming. But it doesnt
change the
> rendered canvas. ( I have embedded the SVGCanvas in SWT application
using
> SWT_AWT.newFrame() utilities available in SWT to embedded swing
components.)
> I have given the code below.
To adjust the view in the Canvas you need to adjust the 'rendering
transform'.
Currently the 'default' view will always have an identity rendering
transform.
So if you want to set the zoom to 200% you would want to do something
like:
final AffineTransform at = AffineTransform.getScaleInstance(2,2);
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
canvas.setRenderingTransform(at);
/* canvas needs to be the displayed instance */
}});
Note that this code will blow away any navigation the user has done
like
panning or rotating. You will most likely want to preserve at least
translation which is "just" a matter of twiddling the affine transforms.
> Can anyone please suggest me a solution for this.
> canvas.new ZoomAction(SVGCanvas.zoomInVal, 1);
This just creates a ZoomAction if you activated it
you might have gotten the desired result, but the
above is better.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]