参考: 如何在旋转BufferedImage时产生清晰的绘画效果?
在参考的问题中,我询问了关于光栅化图像转换的质量。 有人建议我应该使用SVG图像,因为转换的质量会更好,更灵活。 (这是正确的,是吗?)
所以我花了一段时间试图弄清楚如何使用Batik库,通过API读取数据并用Google搜索来查看其他人是否也遇到了同样的问题。
到目前为止,我还没有遇到任何实质性的事情,所以我希望有人能帮助我。 这是我想要做的事情:
与使用BufferedImages的AffineTransform和Graphics2D的drawImage(...)类似, 是否有可能 (以及如何)转换并将SVG图像/对象绘制到JPanel上?
我在想绘制它之前就想过了,我可以根据AffineTransform对象先将其光栅化,然后使用Graphics2D对其进行绘制,但是如果必须在绘制图像之前每次都要进行光栅化处理......当然,还有更好的方法做法。
所以经过多番思考,我想知道SVG是否真的是这里的方式。 那么我应该采取什么最好的方法呢? 栅格化与矢量图像。
注意:创建SVG文件根本不是问题。
谢谢。
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 be 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.
最满意答案
我在pdf上下文中使用这个库(使用jasper / iReport),结果是正确的。 我曾尝试蜡染,但我发现它很难使用
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
更多推荐
发布评论