2.3.1 Bitmap Record Types

The Bitmap record types perform block transfers of bitmap images.

The following are the bitmap record types.

Name

Section

Description

EMR_ALPHABLEND

2.3.1.1

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, including alpha transparency data, according to a specified blending operation.

EMR_BITBLT

2.3.1.2

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, optionally in combination with a brush pattern, according to a specified raster operation.

EMR_MASKBLT

2.3.1.3

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, optionally in combination with a brush pattern and with the application of a color mask bitmap, according to specified foreground and background raster operations.

EMR_PLGBLT

2.3.1.4

Specifies a block transfer of pixels from a source bitmap to a destination parallelogram, with the application of a color mask bitmap.

EMR_SETDIBITSTODEVICE

2.3.1.5

Specifies a block transfer of pixels from specified scanlines of a source bitmap to a destination rectangle.

EMR_STRETCHBLT

2.3.1.6

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, optionally in combination with a brush pattern, according to a specified raster operation, stretching or compressing the output to fit the dimensions of the destination, if necessary.

EMR_STRETCHDIBITS

2.3.1.7

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, optionally in combination with a brush pattern, according to a specified raster operation, stretching or compressing the output to fit the dimensions of the destination, if necessary.

EMR_TRANSPARENTBLT

2.3.1.8

Specifies a block transfer of pixels from a source bitmap to a destination rectangle, treating a specified color as transparent, stretching or compressing the output to fit the dimensions of the destination, if necessary.

The generic structure of bitmap 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

BitmapRecordBuffer (variable)

...

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

Name

Value

EMR_BITBLT

0x0000004C

EMR_STRETCHBLT

0x0000004D

EMR_MASKBLT

0x0000004E

EMR_PLGBLT

0x0000004F

EMR_SETDIBITSTODEVICE

0x00000050

EMR_STRETCHDIBITS

0x00000051

EMR_ALPHABLEND

0x00000072

EMR_TRANSPARENTBLT

0x00000074

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.

BitmapRecordBuffer (variable): An array of bytes that contains the remainder of the bitmap record.


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

BitmapRecordParm (variable)

...

AlignmentPadding (variable, optional)

...

BitmapRecordParm (variable): An array of bytes that contains the parameters for the bitmap 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.

The following notes apply generally to EMF bitmap block transfers, unless specified otherwise:

  • Source and mask bitmaps are in DIB format. DIBs are specified by DeviceIndependentBitmap objects ([MS-WMF] section 2.2.2.9).

  • The clipping regions used by bitmap records are maintained in a Regions state element (section 3.1.1.2.1) in the playback device context (section 3.1).

  • If the color format of the source or pattern bitmap does not match the color format of the destination, the source pr pattern bits MUST be converted to the destination format prior to performing the block transfer.

  • If the source and destination rectangles are not the same size, the source bitmap MUST be expanded or compressed to match the destination rectangle. This stretching function is performed according to a property from the StretchMode enumeration (section 2.1.32).

  • If an XForm object (section 2.2.28) is specified, a world-space to page-space transform SHOULD be applied to the source bitmap. Scaling, translation, and reflection transforms SHOULD be supported, and rotation and shear transforms MAY be supported.

    For more information concerning transforms and coordinate spaces, see [MSDN-WRLDPGSPC].

See section 2.3 for more EMF record types.