a guide for non-windows programmersWindows Metafiles (wmf) files are common in the windows world. Basically they are a recording of the windows gdi (graphic) calls. They consist of a list of calls to such graphic primitives as LineTo, Polygon, Rectangle, etc. And as such as inherently a vector based format.
There are three basic kinds,
While this information is very useful, it lacks an explanation of each of the records that can exist in a metafile, for the development of libwmf it was required to understand each of the metafile records. To this end the wine source was a great aid. As was the basic help files of MS's Visual C compiler. In most cases just looking at the definition of an equivalent windows api call allows you to know what the parameters of each metafile record mean.
First you must know that the arguments to each
api call are stored in reverse order in the actual disk dump that is a metafile record.
BOOL32 Rectangle ( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom );
Now wine uses the win32 api, so in 16 bit wmf files left,top,right and bottom are all 16 bit values,
not 32, and also they are stored in reverse order in the parameter list of wmf record, so
the layout on disk for a RECTANGLE entry is
|32bit size of total record|0x041B |bottom|right|top|left|Got that ?, so all the other records are the same.
There are complications when you start into the more complex operands such as BITBLT, and CREATEPATTERNBRUSH as they appear to get converted into DIBBITBLT and DIBCREATEPATTERNBRUSH when used in conjuntion with a metafile
There are other complications in many of the other operands, my particular favorite is one i found in DIBBITBLT.
I've created a list of all the known operands that can be used in 16 bit metafiles, as listed in wine's wingdi.h (and windows of course). The list attempts to document all the calls in terms of the layout of the operands' parameters as dumped to file, some of them are definitely correct, and some have been pieced together by the wine developers, and one of two ive put together myself from mucking around with a hexeditor and wmf files that i've created under windows. So if you know them to be incorrect or have any information that you think would help, please do send that information to me
This information is primarily intended for developers to create alternative bindings
to the libwmf library which
is a wmf library for non-windows machines that ive written, it takes care of most
of the housecleaning and handling of wmf files. All new bindings should have
to implement is handlers for the calls as listed in the (as yes non-existant) libwmf developer's
Enough already, here is the the known world's most complete wmf documentation to data