开发者

Zooming SVG using batik?

开发者 https://www.devze.com 2023-03-19 10:25 出处:网络
I would like to zoom in/out on SVG file in java. I would like to do it from the program and can\'t find a way.

I would like to zoom in/out on SVG file in java. I would like to do it from the program and can't find a way.

I know you can zoom in/out via mouse or keyboard but that is not what I'm looking for. I'm new to java (2 weeks of learning) and there is probably an easy sol开发者_如何学运维ution to my problem but I can't find it.

Can anyone help me?


To properly zoom in/out on svg in java you need to use

AffineTransform at = new AffineTransform(); 
at.scale(X,Y); 
svgCanvas.setRenderingTransform(at, true);

Note that you also need viewbox in your XML of svg.


I think you want to call setRenderingTransform on your JSVGCanvas component. The method takes an AffineTransform and a boolean which says whether you want to redraw immediately.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号