Delphi 7 和 EMF+文件
我有一个应用程序,可以加载各种图形文件格式,如 bmp、jpg、png、emf 等...并将它们渲染到屏幕上进行预览。
我使用的是 Delphi 7。我刚刚了解了 EMF+ 文件格式,该格式是在 Windows XP 左右创建的,是利用 GDIPlus.dll 创建的。我可以使用 Windows 图片查看器打开 EMF+ 文件,图像质量非常高,可以放大和缩小,一点也不模糊。
问题是我似乎无法找到一种方法(在 Delphi 7 中)来打开此文件格式并将其呈现在屏幕上。有谁知道可在 Delphi 7 中用于呈现 EMF+ 文件的代码示例或组件?
I have an application that can load various graphical file formats such as bmp, jpg, png, emf, etc... and render them onto the screen for previewing.
I am using Delphi 7. I have just been introduced to the EMF+ file format that was created around the time of Windows XP that is created utilizing the GDIPlus.dll. I can open the EMF+ files with Windows Picture Viewer and the image is very high quaility and can zoom in and out without any blurring at all.
The problem is I can't seem to find a way (in Delphi 7) to open this file format and render it on the screen. Does anyone know of a code sample or component that can be used in Delphi 7 to render an EMF+ file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TMetaFileCanvas 无法与 EMF+ 一起正常工作,但您的任务可以使用 GDI+ 完成。
下面是一些示例代码,演示了如何使用 GDI+ 执行此操作:
您可以这样调用它:
TMetaFileCanvas won't work correctly with EMF+ but your task can be completed using GDI+.
Here's some sample code that demonstrates how to do it using GDI+:
And you can call it like this:
您可以使用具有 EMF 支持的“TMetaFileCanvas”。代码片段:
这样您就可以加载 EMF、绘制到 EMF 并保存它。但将其呈现为 Delphi 中的矢量图形则完全是另一个问题。 Delphi 仅适用于开箱即用的位图图形。但据我了解,你只想阅读和绘制它。例如,要将其转换为 BMP,您可以执行以下操作:
编辑:
正如 Marco 善意指出的那样,TMetaFileCanvas 可能无法与 EMF+ 一起正常工作。还没有测试过,所以我无法确认。
但似乎有一个单位可以处理这个问题。
http://blog.synopse.info/post/ 2010/04/02/Antialiased-drawing-from-TMetaFile
可从以下位置下载:
http: //synopse.info/files/SynGdiPlus.zip
我自己还没有检查过,但它看起来适合这项工作。
You can use a "TMetaFileCanvas" that has EMF support. A code snippet:
This way you can load EMF, draw to EMF and save it. But presenting it as a vector graphics from Delphi is another problem altogether. Delphi only works well with bitmap graphics out of the box. But as I understand you only want to read and draw it. To convert it to BMP for instance you can do:
EDIT:
As Marco kindly pointed out TMetaFileCanvas probably woun't work correctly with EMF+. Haven't tested that so I can't confirm it.
But there seems to be a unit that works with that.
http://blog.synopse.info/post/2010/04/02/Antialiased-drawing-from-TMetaFile
Download is available from:
http://synopse.info/files/SynGdiPlus.zip
Havent checked it out myself, but it looks appropriate for the job.