3.1.5 Playback Device Context

The playback device context is an abstract data structure that defines the state of graphics at any point in time during playback of a WMF metafile. The graphics state includes:

  • A complete set of Graphics Objects (section 2.2.1), including a brush, font, palette, pen, and region, which are created and managed by WMF Object Record Types (section 2.3.4).

  • A set of selected Structure Objects (section 2.2.2), which define parameters of the output surface. These elements of the playback device context are not explicitly created by any record, but they can be modified.

  • A vector of graphics properties, which are numerical values that specify modes and parameters for graphics operations.

Although the state defined by the playback device context can be modified by WMF records, there is no guarantee that every graphics object and property will be explicitly initialized by records in a given metafile before any output takes place. Thus, whenever a metafile is played back, it is necessary to define initial conditions consisting of a set of default values for the playback device context. These initial conditions are dependent on multiple factors, including the operating system and the device that is the destination for output.<67>

The following table lists the graphics objects that are defined in the playback device context.

Graphics object

Created by record(s)

Used by record(s)

Notes

Brush Object (section 2.2.1.1)

META_CREATEBRUSHINDIRECT Record (section 2.3.4.1)

META_CREATEPATTERNBRUSH Record (section 2.3.4.4)

META_DIBCREATEPATTERNBRUSH Record (section 2.3.4.8)

Bitmap Record Types (section 2.3.1), when the raster operation involves a brush.

Drawing Record Types (section 2.3.3) that perform area filling.

This object is not used until it is specified in a META_SELECTOBJECT Record (section 2.3.4.10).

The default is a solid color brush stock object.

Font Object (section 2.2.1.2)

META_CREATEFONTINDIRECT Record (section 2.3.4.2)

META_EXTTEXTOUT Record (section 2.3.3.5)

META_TEXTOUT Record (section 2.3.3.20)

This object is not used until it is specified in a META_SELECTOBJECT Record (section 2.3.4.10).

The default is a stock object.

Palette Object (section 2.2.1.3)

META_ANIMATEPALETTE Record (section 2.3.5.1)

META_CREATEPALETTE Record (section 2.3.4.3)

META_RESIZEPALETTE Record (section 2.3.5.9)

META_SETPALENTRIES Record (section 2.3.5.19)

META_REALIZEPALETTE Record (section 2.3.5.8)

This object is not used until it is specified in a META_SELECTPALETTE Record (section 2.3.4.11).

The default is a stock object.

Pen Object (section 2.2.1.4)

META_CREATEPENINDIRECT Record (section 2.3.4.5)

Drawing Record Types (section 2.3.3) that perform line drawing.

This object is not used until it is specified in a META_SELECTOBJECT Record (section 2.3.4.10).

The default is a stock object.

Region Object (section 2.2.1.5)

META_CREATEREGION Record (section 2.3.4.6)

META_EXCLUDECLIPRECT Record (section 2.3.5.2)

META_INTERSECTCLIPRECT Record (section 2.3.5.3)

META_OFFSETCLIPRGN Record (section 2.3.5.5)

Bitmap Record Types (section 2.3.1)

Drawing Record Types (section 2.3.3) that allow clipping.

This object is not used until it is specified in a META_SELECTCLIPREGION Record (section 2.3.4.9).

The default is the entire drawing surface.

The following table lists the structure objects that are defined in the playback device context.

Structure object

Description

Data type

Modified by record(s)

Background text color

The color used as background for text.

ColorRef Object (section 2.2.2.8)

META_SETBKCOLOR Record (section 2.3.5.14)

Drawing position

The (x,y) coordinates of the current drawing position in the output window

PointS Object (section 2.2.2.16)

META_MOVETO Record (section 2.3.5.4)

Foreground text color

The color used for text.

ColorRef Object (section 2.2.2.8)

META_SETTEXTCOLOR Record (section 2.3.5.26)

Output surface

An array of pixels in a device-independent format that correspond to the logical units of the output surface.

DeviceIndependentBitmap Object (section 2.2.2.9)

Bitmap Record Types (section 2.3.1)

Viewport extent

The horizontal and veritical dimensions of the visible part of the output window

PointS Object (section 2.2.2.16)

META_SCALEVIEWPORTEXT Record (section 2.3.5.12)

META_SETVIEWPORTEXT Record (section 2.3.5.28)

Viewport origin

The (x,y) coordinates of theĀ  left, top corner of the visible part of the output window.

PointS Object (section 2.2.2.16)

META_OFFSETVIEWPORTORG Record (section 2.3.5.6)

META_SETVIEWPORTORG Record (section 2.3.5.29)

Window extent

The horizontal and vertical dimensions of the output window on the output surface.

PointS Object (section 2.2.2.16)

META_SCALEWINDOWEXT Record (section 2.3.5.13)

META_SETWINDOWEXT Record (section 2.3.5.30)

Window origin

The (x,y) coordinates of the left, top corner of the output window on the output surface.

PointS Object (section 2.2.2.16)

META_OFFSETWINDOWORG Record (section 2.3.5.7)

META_SETWINDOWORG Record (section 2.3.5.31)

The following table lists the graphics properties that are defined in the playback device context.

Property

Description

Modified by record(s)

Background mix mode

The mode for combining pens, text, hatched brushes, and interiors of filled objects with background colors on the output surface.

META_SETBKMODE Record (section 2.3.5.15)

Break extra space

The total extra space to be added to a line of text for justification.

META_SETTEXTJUSTIFICATION Record (section 2.3.5.27)

Font matching mode

A Boolean value that specifies whether the font mapper attempts to match a font aspect ratio to the current device aspect ratio.

META_SETMAPPERFLAGS Record (section 2.3.5.18)

Foreground mix mode

The mode for combining pens and interiors of filled objects with foreground colors on the output surface.

META_SETROP2 Record (section 2.3.5.22)

Layout mode

The direction in which text and graphics are drawn.

META_SETLAYOUT Record (section 2.3.5.16)

Mapping mode

How logical units are mapped to physical units.

META_SETMAPMODE Record (section 2.3.5.17)

Polygon fill mode

The method used for filling a polygon.

META_SETPOLYFILLMODE Record (section 2.3.5.20)

Stretchblt mode

How the system combines rows or columns of pixels when shrinking a bitmap.

META_SETSTRETCHBLTMODE Record (section 2.3.5.23)

Text alignment mode

The relationship between a reference point and a bounding rectangle, for text alignment.

META_SETTEXTALIGN Record (section 2.3.5.24)

Text extra space

The amount of extra space to add to each character when writing a line of text.

META_SETTEXTCHAREXTRA Record (section 2.3.5.25)

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