Export (0) Print
Expand All

2.3.4.2 EMR_HEADER Record Types

The EMR_HEADER record types define the starting points of EMFmetafiles and specify properties of the device on which the image in the metafile was created. The information in the header record makes it possible for EMF metafiles to be independent of any specific output device.

The following are EMR_HEADER record types.

Name

Section

Description

EmfMetafileHeader

2.3.4.2.1

The header record present in the original version of EMF metafiles.<78>

EmfMetafileHeaderExtension1

2.3.4.2.2

The header record used in the first extension to EMF metafiles.<79>

EmfMetafileHeaderExtension2

2.3.4.2.3

The header record used in the second extension to EMF metafiles.<80>

The generic structure of EMR_HEADER records is specified as follows.

Note  Fields that are not described in this section are specified in section 2.3.4.


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

EmfHeader

...

...

...

...

...

...

...

(EmfHeader cont'd for 12 rows)

EmfHeaderRecordBuffer (variable)

...

Type (4 bytes): A 32-bit unsigned integer that identifies this record type as EMR_HEADER. This MUST be 0x00000001.

 

EmfHeader (80 bytes): A Header object (section 2.2.9), which contains information about the content and structure of the metafile.

EmfHeaderRecordBuffer (variable): An optional array of bytes that contains the remainder of the EMF header record. The size of this field MUST be a multiple of 4 bytes.


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

EmfHeaderRecordParm (variable)

...

AlignmentPadding (variable)

...

EmfHeaderRecordParm (variable): An optional array of bytes that contains additional parameters for the EMF header record.

AlignmentPadding (variable): An optional 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.

The value of the Size field can be used to distinguish between the different EMR_HEADER record types listed earlier in this section. There are three possible headers:

  • The base header, which is the EmfMetafileHeader record. The fixed-size part of this header is 88 bytes, and it contains a Header object.

  • The first extension header, which is the EmfMetafileHeaderExtension1 record. The fixed-size part of this header is 100 bytes, and it contains a Header object and a HeaderExtension1 object (section 2.2.10).

  • The second extension header, which is the EmfMetafileHeaderExtension2 record. The fixed-size part of this header is 108 bytes, and it contains a Header object, a HeaderExtension1 object, and a HeaderExtension2 object (section 2.2.11).

Note that there are one or two optional, variable-length fields that are possible in a given header: a description string and a pixel format field. In all three types of headers, the fixed-size part comes first, followed by the variable-length fields.

The algorithm shown in the following figure computes a non-negative integer variable called HeaderSize from the offsets and lengths of the variable-length data. The type of header is determined from that value.

f0dbe3bf-d937-4cf9-91a3-e540a938ade0

Figure 2: Header Type Determination Algorithm

After applying the algorithm, consider the value of HeaderSize:

  • If HeaderSize >= 108, the record type is EmfMetafileHeaderExtension2.

  • If HeaderSize >= 100, the record type is EmfMetafileHeaderExtension1.

  • Otherwise, the record type is EmfMetafileHeader.

See section 2.3.4 for additional control record types.

 
Show:
© 2015 Microsoft