2.3.11 State Record Types

The State record types specify graphics properties that define the playback device context during the processing of EMF metafile records. For more information about the state used for metafile playback, see the Abstract Data Model section 3.1.1.

Note: The EMR_REALIZEPALETTE and EMR_SAVEDC records do not specify parameters.

The following are EMF state record types.

Name

Section

Description

EMR_COLORMATCHTOTARGETW

2.3.11.1

Specifies how to preview colors as they would appear on the target device.

EMR_FORCEUFIMAPPING

2.3.11.2

Forces the font mapper to match fonts based on their UniversalFontId in preference to LogFont (section 2.2.13).

EMR_INVERTRGN

2.3.11.3

Inverts the colors in the specified region.

EMR_MOVETOEX

2.3.11.4

Specifies the coordinates of a new drawing position, in logical units.

EMR_PIXELFORMAT

2.3.11.5

Specifies the pixel format.

EMR_REALIZEPALETTE

2.3.11

This record maps palette entries from the current LogPalette object (section 2.2.17) to the system_palette.

This record specifies no parameters.

EMR_RESTOREDC

2.3.11.6

Restores the playback device context to the specified state, which was saved by a preceding EMR_SAVEDC record.

EMR_SAVEDC

2.3.11

Saves the current state of the playback device context in an array of states saved by preceding EMR_SAVEDC records if any.

An EMR_RESTOREDC record is used to restore the state.

This record specifies no parameters.

EMR_SCALEVIEWPORTEXTEX

2.3.11.7

Specifies the viewport by using the ratios formed by the specified multiplicands and divisors.

EMR_SCALEWINDOWEXTEX

2.3.11.8

Specifies the window by using the ratios formed by the specified multiplicands and divisors.

EMR_SETARCDIRECTION

2.3.11.9

Specifies the drawing direction to be used for arc and rectangle output.

EMR_SETBKCOLOR

2.3.11.10

Specifies the background color.

EMR_SETBKMODE

2.3.11.11

Specifies the background mode, which determines how to combine the background with foreground text, hatched brushes, and pen styles that are not solid lines.

EMR_SETBRUSHORGEX

2.3.11.12

Specifies the origin of the current brush.

EMR_SETCOLORADJUSTMENT

2.3.11.13

Specifies color adjustment values to use in bitmap stretching.

EMR_SETICMMODE

2.3.11.14

Specifies ICM to be enabled, disabled, or queried.

EMR_SETICMPROFILEA

2.3.11.15

Specifies how to set a specified color profile as the output profile.

EMR_SETICMPROFILEW

2.3.11.16

Specifies how to set a specified color profile as the output profile.

EMR_SETLAYOUT

2.3.11.17

Specifies the layout of the playback device context.

EMR_SETLINKEDUFIS

2.3.11.18

Sets the UniversalFontId (section 2.2.27) of the linked fonts to use during character lookup.

EMR_SETMAPMODE

2.3.11.19

Specifies the mapping mode.

EMR_SETMAPPERFLAGS

2.3.11.20

Specifies the algorithm the font mapper uses when it maps logical fonts to physical fonts.

EMR_SETMITERLIMIT

2.3.11.21

Specifies the limit for the length of miter joins.

EMR_SETPOLYFILLMODE

2.3.11.22

Defines polygon fill mode.

EMR_SETROP2

2.3.11.23

Defines a binary raster operation mode.

EMR_SETSTRETCHBLTMODE

2.3.11.24

Specifies bitmap stretch mode.

EMR_SETTEXTALIGN

2.3.11.25

Specifies text alignment.

EMR_SETTEXTCOLOR

2.3.11.26

Defines the current text color.

EMR_SETTEXTJUSTIFICATION

2.3.11.27

Sets the amount of extra space to add to break characters for justification purposes.

EMR_SETVIEWPORTEXTEX

2.3.11.28

Defines the viewport extent.

EMR_SETVIEWPORTORGEX

2.3.11.29

Defines the viewport origin.

EMR_SETWINDOWEXTEX

2.3.11.30

Defines the window extent.

EMR_SETWINDOWORGEX

2.3.11.31

Defines the window origin.

The generic structure of state records is specified as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Type

Size

StateRecordBuffer (variable, optional)

...

Type (4 bytes): An unsigned integer that defines the type of record. The state record types are listed in the following table. See the preceding table for descriptions of these record types.

Name

Value

EMR_SETWINDOWORGEX

0x0000000A

EMR_SETVIEWPORTEXTEX

0x0000000B

EMR_SETVIEWPORTORGEX

0x0000000C

EMR_SETBRUSHORGEX

0x0000000D

EMR_SETCOLORADJUSTMENT

0x00000017

EMR_MOVETOEX

0x0000001B

EMR_SCALEVIEWPORTEXTEX

0x0000001F

EMR_SETWINDOWEXTEX

0x00000009

EMR_SETMAPPERFLAGS

0x00000010

EMR_SETMAPMODE

0x00000011

EMR_SETBKMODE

0x00000012

EMR_SETPOLYFILLMODE

0x00000013

EMR_SETROP2

0x00000014

EMR_SETSTRETCHBLTMODE

0x00000015

EMR_SETTEXTALIGN

0x00000016

EMR_SETTEXTCOLOR

0x00000018

EMR_SETBKCOLOR

0x00000019

EMR_SCALEWINDOWEXTEX

0x00000020

EMR_SAVEDC

0x00000021

EMR_RESTOREDC

0x00000022

EMR_REALIZEPALETTE

0x00000034

EMR_SETARCDIRECTION

0x00000039

EMR_SETMITERLIMIT

0x0000003A

EMR_INVERTRGN

0x00000049

EMR_SETICMMODE

0x00000062

EMR_PIXELFORMAT

0x00000068

EMR_FORCEUFIMAPPING

0x0000006D

EMR_SETICMPROFILEA

0x00000070

EMR_SETICMPROFILEW

0x00000071

EMR_SETLAYOUT

0x00000073

EMR_SETLINKEDUFIS

0x00000077

EMR_SETTEXTJUSTIFICATION

0x00000078

EMR_COLORMATCHTOTARGETW

0x00000079

Size (4 bytes): An unsigned integer that specifies the size in bytes of this record in the metafile. This value MUST be a multiple of 4 bytes.

StateRecordBuffer (variable, optional): An array of bytes that contains the remainder of the state record.

The EMR_REALIZEPALETTE and EMR_SAVEDC records do not contain this field.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

StateRecordParm (variable)

...

AlignmentPadding (variable, optional)

...

StateRecordParm (variable): An array of bytes that contains the parameters for the state record.

AlignmentPadding (variable, optional): An array of up to 3 bytes that pads the record so that its total size is a multiple of 4 bytes. This field MUST be ignored.

See section 2.3 for more EMF record types.