18 / 306
[MS-EMF] — v20101112
Enhanced Metafile Format
Copyright © 2010 Microsoft Corporation.
Release: Friday, November 12, 2010
Figure 1: EMF metafile structures
Thus, all EMF metafiles can be considered to have three sections:
EMF Header: The metafile header with extensions that correspond to this type of EMF metafile.
The header record contains information concerning the structure and contents of the metafile,
including an optional description string and pixel format descriptor. See section 2.3.4.2 for details
concerning the EMF header.
EMF Records: An array of EMF records that contains drawing orders, graphics state information,
and graphics object definitions. At least one record has to be present—not counting the EMF
header or EMF end-of-file records—or the metafile is invalid. See sections 2.3.10 and 2.3.5 for
specifications of all EMF record types.
EMF End-of-File: The EMF end-of-file record signals the end of all EMF metafiles. It has to be
the last record in the metafile. If the EMF metafile contains an optional palette, it is in the form
of an array of LogPaletteEntry (section 2.2.18) objects located in the EMF end-of-file record.
Offsets to the palette are present in both the EMF header and EMF end-of-file records.
Within the portions of these files identified as EMF header records, the description and pixel format
substructures are optional, and they can be placed in any order. Their presence, location, and
relative order in a given EMF file are determined by offset values in the EMF header record. If
present, they are part of the EMF header record, and cannot be located at some arbitrary location in
the EMF metafile, such as between EMF records.
EMF records are contiguous; this is required, because the information that is available for traversing
the file from record to record depends on it. That is, from any given EMF record, including the
header record, in order to move to the next sequential record in the file, the length of the record is
used.
1.3.2 Graphics Objects
Graphics objects, which are used in the drawing and painting operations specified in the records of
an EMF metafile, are created by Object Creation record types, specified in section 2.3.7, prior to the
records that specify their use. These objects are designed to be reusable during the course of
processing the EMF metafile.
Throughout this specification, it is assumed that these previously defined, reusable graphics objects
are available when needed for the processing of particular metafile records. This store of available
objects is referred to in the text as the EMF Object Table, which is described in section 3.1.1.1. The
exact characteristics of an object store for EMF objects can be determined by the particular
implementation that parses or writes EMF metafiles.
The types of reusable objects that can be created and managed during EMF metafile playback
include:
Brushes, specified in section 2.2.12
Color spaces, specified in [MS-WMF] sections 2.2.2.11 and 2.2.2.12
Fonts, specified in sections 2.2.13, 2.2.14, 2.2.15, and 2.2.16
Palettes, specified in section 2.2.17
Pens, specified in sections 2.2.19 and 2.2.20