 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
enzo Guest
|
Posted: Mon Mar 12, 2007 3:16 pm Post subject: read and parse a WMF ( windows metafile ) file |
|
|
Hi
I need to read and parse a WMF ( windows metafile ) file, in order to
get the GDI commands stored inside the wmf and rerun it , mybe after
some change.
I look on the web for some info, but I only find how to build a wmf
using GDI, non the opposite, how to scan and parse a GDI to extract the
original gdi commands.
I suppose it should be possible, bu I didn't know how.
Do you knoen if there some documentation which explain me how to do
that job ?
I would also appreciate info about already existing libraries which do
this.
Kindly regards, Enzo |
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Mon Mar 12, 2007 10:01 pm Post subject: Re: read and parse a WMF ( windows metafile ) file |
|
|
enzo wrote:
| Quote: | I need to read and parse a WMF ( windows metafile ) file, in order to
get the GDI commands stored inside the wmf and rerun it , mybe after
some change.
I look on the web for some info, but I only find how to build a wmf
using GDI, non the opposite, how to scan and parse a GDI to extract the
original gdi commands.
I suppose it should be possible, bu I didn't know how.
Do you knoen if there some documentation which explain me how to do that
job ?
|
A Windows metafile is just a record of all the functions that were
needed to create the image. The way how all these functions are recorded
in the metafile is documented. See
http://www.wotsit.org/
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
Joe C. Hecht Guest
|
Posted: Tue Mar 13, 2007 10:54 pm Post subject: Re: read and parse a WMF ( windows metafile ) file |
|
|
| Quote: | I need to read and parse a WMF ( windows metafile ) file, in order to get the GDI commands stored inside the wmf and rerun it ,
mybe after
|
Having done this, a bit of advice,
Using the EnumMetafile functions will leak resources. Depending on the metafile,
it may leak enough resources to bring down a Windows 9.x machine. The resource
leaks are somewhat documented by Microsoft. Your best bet is to open the metafile
using a file or stream, and work with it directly. There are three types of metafiles you
must deal with (wmf, placeable (if it is a .wmf and is stored on the disk, this is most
likly the format), and the emf format.
Another bit of advice. The documentation on the metafile format is often inaccurate,
meaning you are going to have to create a metafile contiaing most all of the commands
(some are only available by stealing the ouput from an EMF print spooler), and looking
at the parameters for each call, and deciding if the docs are correct, or if they are not,
then you must patch up the record types for each that is wrong. It can get rather complex.
I have a wmf reader unit that is largely complete for wmf and placeable wmf, and somewhat
complete for emf. It is also able to render the metafile without resource leaks or font scaling
problems. FWIW, it is complete enough to be used in a few commercial projects that use wmf's.
I would be interested in selling thesource code to the unit. If you are interested, place email.
Joe
--
Delphi, graphics, and printing specialist available - $35/hr
http://www.code4sale.com/codeit/index.htm
Joe Hecht Associates
121 Louise Drive
Crestview, FL 32536 |
|
| Back to top |
|
 |
Bruce Larrabee Guest
|
Posted: Thu Mar 15, 2007 2:13 am Post subject: Re: read and parse a WMF ( windows metafile ) file |
|
|
Hi Enzo,
Take a look at, 'Programming Windows - Fifth Edition', by Charles Petzold.
Chapter 18 - Metafiles, it's covers .wmf and .emf. It might be of use...
HTH,
Bruce Larrabee |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|