如何加载 EPS 文件并使用 WinForms 绘制它们

发布于 2024-08-07 22:20:17 字数 249 浏览 9 评论 0原文

是否可以使用普通 WinForms GDI+ 加载和显示 EPS 文件?如果没有,有免费的图书馆可以帮忙吗?

我似乎记得 Windows GDI 支持 EPS 文件,但是在谷歌搜索了一下之后,我开始怀疑那个记忆。

我想做的就是加载文件并使用图形上下文绘制它。

我知道我可以使用任何程序将文件转换为 PNG 或其他内容并以这种方式渲染它,但因为我试图以多种分辨率渲染,所以我更愿意将矢量数据保留在 EPS 文件中。

谢谢!

Is it possible to load and display EPS file using plain WinForms GDI+? If not, is there a free library to help out?

I seem to remember that Windows GDI supported EPS files, but after Googling around a bit, I am starting to doubt that memory.

All I want to do is load the file and draw it using a Graphics context.

I am aware that I can just use any program to convert the file to PNG or something and render it that way, but because I am trying to render at multiple resolutions, I would prefer to keep the vector data in the EPS file.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

谎言 2024-08-14 22:20:17

我所知道的所有可以将 EPS 转换为其他矢量或光栅格式的免费或开源库都是基于 Ghostscript 的。您可以使用提供的包装器直接调用 Ghostscript,或者查看 imagemagick。它是一个非常流行的图像图形处理库,并且已经存在很长时间了。它还在内部依赖 Ghostscript 来处理 EPS 格式。您可以在 http://imagemagick.codeplex.com/ 找到它的 .NET 包装器。您也可以在这里阅读一些有关其背景的信息 http://www.codeproject.com/ KB/dotnet/ImageMagick_in_VBNET.aspx。还有 pstoedit 也是基于 Ghostscript 来读取 EPS 并允许导出为 WMF 等格式。您将需要使用 .NET 中的互操作来调用 pstoedit API

除了 Ghostscript 之外,还有我所知道的几种商业产品,例如 ImageGear 和 LeadTools,它们可以让您将 EPS 转换为几乎任何其他类型的图形格式。

All the free or open source libraries I know that can convert EPS to other vector or raster format are all based on Ghostscript. You can invoke ghostscript directly, with wrapper provided or alternatively look at imagemagick. It is a very popular library for manipulating image graphics and has been around for a long time. It also internally relies on Ghostscript for handling EPS format. There is a .NET wrapper for it that you can find at http://imagemagick.codeplex.com/. You can read a bit about its background here too http://www.codeproject.com/KB/dotnet/ImageMagick_in_VBNET.aspx. There is also pstoedit that is also based on ghostscript to read EPS and allow export to format like WMF. You will need to the call to pstoedit API using interop in .NET

Besides Ghostscript there are several commercial products that I known of like ImageGear and LeadTools which will let you take EPS to almost any other kind of graphic formats.

坏尐絯 2024-08-14 22:20:17

您可以使用 GhostScript 从 EPS 生成图像。获得图像后,您可以在应用程序中显示该图像。

You can use GhostScript to produce images from an EPS. Once you have an image you can then display that within your application.

月朦胧 2024-08-14 22:20:17

在您的问题中,您表示您希望以矢量格式输出,这将排除位图、jpeg 等。以下是获取 XAML 文件的几种方法,该文件是 Microsoft 广泛支持的矢量文件。

Microsoft Expression Blend 3 和 Design 3 都可以打开 .ai (eps) 文件并将其分别转换为矢量格式、design 和 XAML,所以这绝对是可能的。

我知道大多数 Microsoft Office 应用程序(如 Word 和 Excel)的自动化相对容易,但我还没有看到这些 Expression 产品的任何记录的 com 互操作程序集。

也许您可以以未记录的方式使用属于 Expression 一部分的转换器?

如果这不起作用,还有 B 计划:

这是一个免费转换器,可以转换 .ai (eps) 文件转换为 XAML。不过,要使用它,您需要 Adob​​e Illustrator。

In your question you indicated you want the output in a vector format which would preclude bitmaps, jpeg etc. Here are a couple of ways of getting a XAML file which is a vector file with extensive support by Microsoft.

Microsoft Expression Blend 3 and Design 3 can both open .ai (eps) files and convert them to vector formats, design and XAML respectively, so it is definitely possible.

I know it is relatively easy to automate most Microsoft Office applications like Word and Excel, but I have not seen any documented com inter-op assemblies for these Expression products.

Perhaps you can use the converters that are part of Expression in an undocumented way?

If that doesn't work here is plan B:

Here is a free converter that will convert .ai (eps) files to XAML. To use it you need Adobe Illustrator however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文