使用蜡染缩放 SVG?
我想在java中放大/缩小SVG文件。我想从程序中做到这一点,但找不到方法。
我知道您可以通过鼠标或键盘放大/缩小,但这不是我想要的。我是java新手(学习了2周),可能有一个简单的解决方案可以解决我的问题,但我找不到它。
谁能帮助我吗?
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 solution to my problem but I can't find it.
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在java中正确放大/缩小svg,您需要使用
注意,您还需要在svg的XML中使用viewbox。
To properly zoom in/out on svg in java you need to use
Note that you also need viewbox in your XML of svg.
我认为您想在 JSVGCanvas 组件上调用 setRenderingTransform 。该方法采用 AffineTransform 和一个布尔值,表示是否要立即重绘。
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.