开发者

Zooming SVG using batik?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜