简体   繁体   English

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

[英]How to load EPS files and draw them using WinForms

Is it possible to load and display EPS file using plain WinForms GDI+? 是否可以使用普通的WinForms GDI +加载和显示EPS文件? 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. 我似乎记得Windows GDI支持EPS文件,但谷歌搜索了一下后,我开始怀疑这个内存。

All I want to do is load the file and draw it using a Graphics context. 我想要做的就是加载文件并使用Graphics上下文绘制它。

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. 我知道我可以使用任何程序将文件转换为PNG或其他东西并以这种方式渲染,但因为我试图以多种分辨率渲染,我宁愿将矢量数据保存在EPS文件中。

Thanks! 谢谢!

You can use GhostScript to produce images from an EPS. 您可以使用GhostScript从EPS生成图像。 Once you have an image you can then display that within your application. 获得图像后,您可以在应用程序中显示该图像。

All the free or open source libraries I know that can convert EPS to other vector or raster format are all based on Ghostscript. 我所知道的所有可以将EPS转换为其他矢量或栅格格式的免费或开源库都基于Ghostscript。 You can invoke ghostscript directly, with wrapper provided or alternatively look at imagemagick. 您可以直接调用ghostscript,提供包装或者查看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. 它还内部依赖Ghostscript来处理EPS格式。 There is a .NET wrapper for it that you can find at http://imagemagick.codeplex.com/ . 您可以在http://imagemagick.codeplex.com/找到它的.NET包装器。 You can read a bit about its background here too http://www.codeproject.com/KB/dotnet/ImageMagick_in_VBNET.aspx . 你也可以在这里阅读一下它的背景知识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. 还有pstoedit也基于ghostscript来读取EPS并允许导出格式如WMF。 You will need to the call to pstoedit API using interop in .NET 您将需要在.NET中使用interop调用pstoedit API

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. 除了Ghostscript之外,还有一些我称之为ImageGear和LeadTools的商业产品,它们可以让你将EPS带到几乎任何其他类型的图形格式。

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. 在您的问题中,您表示您希望以矢量格式输出,这将排除位图,jpeg等。以下是获取XAML文件的几种方法,该文件是一个受到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. Microsoft Expression Blend 3和Design 3都可以打开.ai(eps)文件并将它们分别转换为矢量格式,设计和XAML,因此它绝对是可能的。

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. 我知道自动化大多数Microsoft Office应用程序(如Word和Excel)相对容易,但我还没有看到任何针对这些Expression产品的文档com互操作程序集。

Perhaps you can use the converters that are part of Expression in an undocumented way? 也许您可以以未记录的方式使用属于Expression的转换器?

If that doesn't work here is plan B: 如果这不起作用,那么计划B:

Here is a free converter that will convert .ai (eps) files to XAML. 这是一个将.ai(eps)文件转换为XAML的免费转换器 To use it you need Adobe Illustrator however. 要使用它,您需要Adobe Illustrator。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM