5

I am using the Batik library, which is very useful to display SVG graphics in Java. For the basic use case of displaying and rendering an SVG document is quite simple to use. However, I want to do some other advanced graphic manipulation and I am struggling as I don't find any good resource that will allow me to perform the following types of task:

  • Detecting the component under the mouse
  • Getting a component by id and changing the color used to render
  • Manipulate components
  • Adding new components
  • Detecting mouse clicks on components

Is there any good resource or tips to use this library that you know about?

4

4 回答 4

5

您可能想通读几年前我在 SVG Open上展示的关于使用 Batik 的教程会议的幻灯片。

于 2010-01-02T11:14:46.717 回答
2

可能值得一看Java™ Drawing with Apache Batik: A Tutorial。内容列表看起来非常全面。

我很久以前写了一个 SVG 显示器,它使用 Batik 并处理鼠标事件/颜色变化。IIRC 我不得不通过 DOM 接口对 SVG 进行更改,因为 Batik 根本不支持它。当然,现在情况可能已经改变。

于 2009-10-13T13:07:29.113 回答
0

你看过关于 SVG 的 W3C 文档吗?

它似乎列出了如何做大部分事情;特别看附录A:DOM Enhancemenets,如果没有,可以查看之前版本的文档。

希望能帮助到你!

于 2009-10-13T08:30:32.613 回答
0

也许它也会有帮助

http://code.google.com/p/svgweb/

于 2009-10-13T10:09:40.610 回答