How to paint SVG images efficiently in Java?
Reference: How can you produce sharp paint results when rotating a BufferedImage?
In the referenced question I asked about quality regarding transformations of rasterized images. Someone suggested that I should use SVG images, as the quality of transformations will b开发者_开发问答e greater and more flexible. (Which is correct, yes?)
So I've been spending quite some time trying to figure out how to use the Batik libraries, reading through their API's and googling to see if other people have had the same problem.
So far I haven't come across anything substantial, so I'm hoping that someone can help me out. Here's effectively what I'd like to do:
In a similar fashion to AffineTransform and Graphics2D's drawImage(...) using BufferedImages,
is it possible (and how) to transform and then paint an SVG image/object onto a JPanel?I was thinking before I want to paint it, I could somehow rasterize it first according to an AffineTransform object, and then paint it using Graphics2D, but if I have to rasterize every time before I can paint an image... surely there's a better approach.
So after much thought, I'm wondering whether SVG is really the way to go here. What's the best approach that I should take then?
Rasterized vs. Vector images.Note: Creating the SVG files hasn't been an issue at all.
Thanks.
I use this library in a pdf context (with jasper /iReport) and the result is correct. I have tried Batik but i have found it's difficult to use
精彩评论