Hello Volker,
in this case use the setToScale method which (i'm quite sure ) uses an absolut scalefactor.
something like this...
AffineTransform at = new AffineTransform();
at.setToScale(scale, scale);
dp.setRenderingTransform(at);
you may again want to concatenate with the original redneringtransform if you've applied other transforms that shouldn't be lost....
Gruß
Thomas
| "Schneider, Volker" <[EMAIL PROTECTED]>
16.02.2006 14:08
|
|
Hello Thomas,
thank you very much for your solution. This really works with relative scales!
But:
Do you know, how to solve this if someone wants an absolute scale factor?
For example, if the user choses 100% he would want to have original size of the picture. When the user scrolls with STRG+MouseLeft he will get an unknown scale. Using the JcomboBox (100%) he should be able to get back to the original size.
Is there a solution, or is it possible to get the current scale values, so that I could calculate the scales that brings the picture back to 100%?
Thank you, best regards
- Volker -
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 16. Februar 2006 13:51
An: [email protected]
Betreff: Antwort: JSVGCanvas: zooming using JComboBox
Hello Volker,
I don't know what you've tried so far, but you could do the following:
1. get the rendering transform from the JSVGCanvas:
AffineTransform at = jsvgCanvas.getRenderingTransform();
2. create a new scaling AffineTransform with the scalefactor selected from the combobox
AffineTransform t = AffineTransform.getScaleInstance(scale, scale);
3. concatenate the rendering transform with the new transform
t.concatenate(at);
4. apply the concatenated transform again to the JSVGCanvas
jsvgCanvas.setRenderinTransform(t);
I'm not sure if this is the most beautiful way of doing it, but it should work. You may also need to do some translate transforms on the new AffineTransformation depending on how you want the zoom to behave...
regards
Thomas
| "Schneider, Volker"
<[EMAIL PROTECTED]>
16.02.2006 13:32
|
|
Hello,
does anybody know, how I can zoom the JSVGCanvas using a JcomboBox that contains the items 50%, 100%, 200% for example?
I cannot find a way to invoke the Zoom-Actions, as you can do it with Jbutton.
Thank you, best regards
- Volker -
