3.1.4.1 WMF Object Table

The WMF Object Table is a conceptual element of WMF graphics objects management. Graphics Objects (section 2.2.1) include Brush Objects (section 2.2.1.1), Font Objects (section 2.2.1.2), Palette Objects (section 2.2.1.3), Pen Objects (section 2.2.1.4), and Region Objects (section 2.2.1.5); they can be defined, used, reused, and deleted by records in a WMF metafile. This section describes a hypothetical WMF Object Table to keep track of graphics objects during the processing of a WMF metafile.

The WMF Object Table is simply an array of indexes assigned to graphics object structures defined during the processing of a WMF metafile. The maximum number of indexes needed in a WMF Object Table for a given metafile can be computed from the total number of objects defined in the metafile, which is specified by the NumberOfObjects field in the WMF META_HEADER Record (section 2.3.2.2). An implementation of the WMF Object Table will store and manage that number of objects.

Whenever a graphics object is created by one of the Object Record Types listed in section 2.3.4, the following actions are implied:

  • Every object is assigned the lowest available index—that is, the smallest numerical value—in the WMF Object Table. This binding happens at object creation, not when the object is used. Moreover, each object table index uniquely refers to an object. Indexes in the WMF Object Table always start at 0.

  • Subsequent WMF records refer to an object by its assigned WMF Object Table index. However, there is no requirement that every object defined in the metafile will be used.

  • An object is not used in drawing operations until a META_SELECTOBJECT Record (section 2.3.4.10) is received that specifies its WMF Object Table index. This record activates the object and makes it current in the Playback Device Context section 3.1.5).

  • Later in the processing of the metafile, another META_SELECTOBJECT Record might be encountered that selects a different object of the same object type into the playback device context. When that happens, the previously defined object is not deleted, and its index is not returned to the pool of available indexes.

  •  When a META_DELETEOBJECT Record (section 2.3.4.7) is received that specifies this object's particular index, the object's resources are released, the binding to its WMF Object Table index is ended, and the index value is returned to the pool of available indexes. The index will be reused, if needed, by a subsequent object created by another Object Record Type (section 2.3.4) record.

Thus, graphics object creation, use, and deletion depend on the correct order of records during playback to achieve the expected results.

Note This specification does not mandate that implementations adhere to the implementation of the WMF Object Table presented in this section, as long as the implementation of external behavior is compatible with the behavior described in this specification.