出口的JPanel以矢量图形 [英] Export JPanel to vector graphics

查看:113
本文介绍了出口的JPanel以矢量图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在图像中我的JPanel导出到矢量图形文件,以便它可以编辑和在比屏幕更高分辨率打印。基本上我想它的的paint()函数与保存绘图命令到一个矢量图形文件的目标图形被调用。

I would like to export the image in my JPanel to a vector graphics file so it can be edited and printed at a higher-than-screen resolution. Essentially I want its paint() function to be called with a destination Graphics that saves the drawing commands into a vector graphic file.

什么是好,简单的方法来做到这一点?建议使用哪些库?其中矢量格式是最好的,为什么?

What is a good, simple way to do this? What libraries are recommended? Which vector format would be best, and why?

推荐答案

看一看了Java的Graphics2D EPS包

许多Java程序使用的Graphics2D绘制在屏幕上的东西,虽然很容易将输出保存为PNG或JPEG文件,这是一个有点困难,将其导出为EPS为包括文件或文件英寸

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.

这包使整个过程非常简单,因为你可以使用EpsGraphics2D对象,如果它是一个Graphics2D对象。唯一的区别是,所有的实施方法创建EPS输出,这意味着您绘制的图表可以在不导致任何调整基于像素的图像,如JEPG和PNG文件时,您可能会看到锯齿边缘的大小。

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.

这篇关于出口的JPanel以矢量图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆