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 2.3.5.31) and META_SETWINDOWEXT (section 2.3.5.30) records. Do not use the META_SETVIEWPORTEXT (section 2.3.5.28) or META_SETVIEWPORTORG (section 2.3.5.29) 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 2.3.1.5) or META_STRETCHDIB (section 2.3.1.6) instead of META_BITBLT (section 2.3.1.1).

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

Show: