3.1.1 Device Independence

WMF metafiles are useful for transferring images between applications. Most applications support the clipboard format associated with metafiles, called METAFILEPICT (for more information, see [MSDN-CLIPFORM]). When treated as a single graphics primitive, a metafile is easy to paste into an application without that application needing to know the specific content of the image. An application can store a metafile in global memory or to disk.

The mapping mode of a metafile can be altered during playback. Thus, the image can be scaled arbitrarily, with every component scaling separately, which minimizes the loss of information for the image as a whole, which is not characteristic of bitmaps.

To ensure that metafiles can be transported between different computers and applications, any application that creates a metafile needs to ensure that the metafile is device independent and sizable. The following guidelines help ensure that every metafile can be accepted and manipulated by other applications:

  • Set the mapping mode as one of the first records. Some applications only accept metafiles that are in MM_ANISOTROPIC mode.

  • Set the META_SETWINDOWORG (section and META_SETWINDOWEXT (section records. Do not use the META_SETVIEWPORTEXT (section or META_SETVIEWPORTORG (section record if the user will be able to resize or change the dimensions of the object.

  • Do not use any of the region records, because they are device dependent.

  • Use META_STRETCHBLT (section or META_STRETCHDIB (section instead of META_BITBLT (section

  • Terminate the metafile with a META_EOF Record (section (0x0000).