gpt4 book ai didi

java - 将 JPanel 导出为 vector 图形

转载 作者:搜寻专家 更新时间:2023-11-01 01:11:58 25 4
gpt4 key购买 nike

我想将我的 JPanel 中的图像导出为 vector 图形文件,以便可以在高于屏幕的分辨率下对其进行编辑和打印。本质上,我希望使用目标图形调用其 paint() 函数,将绘图命令保存到 vector 图形文件中。

有什么好的、简单的方法可以做到这一点?推荐哪些库?哪种 vector 格式最好,为什么?

最佳答案

看看The Java EPS Graphics2D package .

Many Java programs use Graphics2D to draw stuff on the screen, and while it is easy to save the output as a png or jpeg file, it is a little harder to export it as an EPS for including in a document or paper.

This package makes the whole process extremely easy, because you can use the EpsGraphics2D object as if it's a Graphics2D object. The only difference is that all of the implemented methods create EPS output, which means the diagrams you draw can be resized without leading to any of the jagged edges you may see when resizing pixel-based images, such as JEPG and PNG files.

关于java - 将 JPanel 导出为 vector 图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/811916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com