How to display many SVGs in Java with high performance

谁说我不能喝 提交于 2020-01-02 07:54:07

问题


What I want

My goal is to be able to display a large number of SVG images on a single drawing area in Java, each with its own translation/rotation/scale values. I'm looking for the simplest solution allowing this, optionally even using OpenGL to speed things up.

What I've Tried

My initial naive approach was to use SVGSalamander to draw directly on a JPanel, but the performance was pathetic.

I poked around around and learned that I should do something like manually convert each SVG into a BufferedImage created with createCompatibleImage, then do the transformations I want, then draw it using double buffering. I ran into some troubles here, and before I continued I tried looking for frameworks to simplify things.

What I've Looked At

I've been a bit overwhelmed by the available options, which is why I'm turning to SO for help. I've looked at:

  • Cairo (with Glitz maybe?)
  • Libart - not sure if this actually supports SVGs
  • FengGUI
  • Slick - looks promising but a bit of an overkill

But couldn't decide what is best for me to start working with, and I hope someone here as experience with any of these doing similar things.


回答1:


Render your SVGs to textures, then render textured quads with desired transforms.



来源:https://stackoverflow.com/questions/2673994/how-to-display-many-svgs-in-java-with-high-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!