3.1.1.1 EMF Object Table

When a graphics object is created by an EMF object creation record (section 2.3.7), the record specifies a numerical index. The object can be referenced by its index during metafile processing until the object is deleted. Object indexes start at 1; zero is reserved for references to the metafile itself.

An object manipulation record (section 2.3.8) can use the index of a graphics object to select it into the playback device context. This has the effect of activating the object so it can be used in graphics operations specified by subsequent metafile records. Until the object is activated, it is not used. Later, if a different object of the same type is activated, the former object is deactivated but not deleted. An object is not deleted until an object manipulation record is processed that deletes it.

Before a graphics object of a particular type is created and activated, a stock object (section 2.1.31) of that type is used in graphics operations.

The EMF object table refers to an abstract model for managing graphics objects during the processing of an EMF metafile. It consists of a table in which graphics objects are associated with their indexes as they are created, activated, used, deactivated, and deleted.

The following types of graphics objects are managed in this model:

  • Brushes

  • Color spaces

  • Fonts

  • Palettes

  • Pens

The following process model can be used to manage graphics objects with an EMF object table:

  1. At the start of metafile processing, an EMF object table is created. The maximum number of objects is specified in the EMF Header object (section 2.2.9) of the EmfMetafileHeader record (section 2.3.4.2.1).

  2. The EMF object table needs to be large enough to keep track of objects that are explicitly created as well as stock objects. Each element in the object table contains information that indicates whether an object with that index has been created, a way to access the object, and whether the object is currently active.

  3. When a graphics object is created, the element in the EMF object table that corresponds to its index is updated so that it can be accessed later.

  4. When a graphics object is activated, the element in the EMF object table that corresponds to its index is updated. In addition, the element that was activated before is now deactivated.

  5. When a graphics object is deactivated, the element in the EMF object table that corresponds to its index is updated. In addition, the default stock object of that type is now activated.

  6. When a record is encountered that deletes the graphics object, its memory is released and the EMF object table is updated accordingly. A graphics object can be deleted without first being deactivated. If that happens, the default stock object of that type is now activated.

Note: There are some index values that are reserved:

  • The index zero is reserved; it refers to the EMF metafile itself.

  • Indexes that have the most-significant bit set refer to stock objects.

The object state changes of creation, activation, deactivation, and deletion, require management during playback to achieve the expected results in rendering the image stored in the metafile.

Show: