2.3.1.3 EMR_MASKBLT Record

The EMR_MASKBLT record 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.

Fields not specified in this section are specified in section 2.3.1.


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

Bounds

...

...

...

xDest

yDest

cxDest

cyDest

ROP4

xSrc

ySrc

XformSrc (24 bytes)

...

...

...

BkColorSrc

UsageSrc

offBmiSrc

cbBmiSrc

offBitsSrc

cbBitsSrc

xMask

yMask

UsageMask

offBmiMask

cbBmiMask

offBitsMask

cbBitsMask

BitmapBuffer (variable)

...

Type (4 bytes): An unsigned integer that identifies this record type as EMR_MASKBLT. This value is 0x0000004E.

Bounds (16 bytes): A RectL object ([MS-WMF] section 2.2.2.19) that specifies the destination bounding rectangle in logical coordinates. If the intersection of this rectangle with the current clipping regions (section 3.1.1.2.1) in the playback device context (section 3.1) is empty, this record has no effect.

xDest (4 bytes): A signed integer that specifies the logical x-coordinate of the upper-left corner of the destination rectangle.

yDest (4 bytes): A signed integer that specifies the logical y-coordinate of the upper-left corner of the destination rectangle.

cxDest (4 bytes): A signed integer that specifies the logical width of the destination rectangle.

cyDest (4 bytes): A signed integer that specifies the logical height of the destination rectangle.

ROP4 (4 bytes): A quaternary raster operation, which specifies ternary raster operations for the foreground and background colors of a bitmap. These values define how the color data of the source rectangle is to be combined with the color data of the destination rectangle.


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

Reserved

BackgroundROP3

ForegroundROP3

Reserved (2 bytes): This field SHOULD be 0x0000 and MUST be ignored.<57>

BackgroundROP3 (1 byte): The unsigned, most-significant 8 bits of a 24-bit ternary raster operation value from the Ternary Raster Operation enumeration ([MS-WMF] section 2.1.1.31). This code defines how to combine the background color data of the source and destination bitmaps and brush pattern.

ForegroundROP3 (1 byte): The unsigned, most-significant 8 bits of a 24-bit ternary raster operation value from the Ternary Raster Operation enumeration. This code defines how to combine the foreground color data of the source and destination bitmaps and brush pattern.

xSrc (4 bytes): A signed integer that specifies the logical x-coordinate of the upper-left corner of the source rectangle.

ySrc (4 bytes): A signed integer that specifies the logical y-coordinate of the upper-left corner of the source rectangle.

XformSrc (24 bytes): An XForm object (section 2.2.28) that specifies a world-space to page-space transform to apply to the source bitmap.

BkColorSrc (4 bytes): A ColorRef object ([MS-WMF] section 2.2.2.8) that specifies the background color of the source bitmap.

UsageSrc (4 bytes): An unsigned integer that specifies how to interpret values in the color table in the source bitmap header. This value is in the DIBColors enumeration (section 2.1.9).

offBmiSrc (4 bytes): An unsigned integer that specifies the offset in bytes, from the start of this record to the source bitmap header in the BitmapBuffer field.

cbBmiSrc (4 bytes): An unsigned integer that specifies the size in bytes of the source bitmap header.

offBitsSrc (4 bytes): An unsigned integer that specifies the offset in bytes, from the start of this record to the source bitmap bits in the BitmapBuffer field.

cbBitsSrc (4 bytes): An unsigned integer that specifies the size in bytes, of the source bitmap bits.

xMask (4 bytes): A signed integer that specifies the logical x-coordinate of the upper-left corner of the mask bitmap.

yMask (4 bytes): A signed integer that specifies the logical y-coordinate of the upper-left corner of the mask bitmap.

UsageMask (4 bytes): An unsigned integer that specifies how to interpret values in the color table in the mask bitmap header. This value is in the DIBColors enumeration.

offBmiMask (4 bytes): An unsigned integer that specifies the offset in bytes, from the start of this record to the mask bitmap header in the BitmapBuffer field.

cbBmiMask (4 bytes): An unsigned integer that specifies the size in bytes, of the mask bitmap header.

offBitsMask (4 bytes): An unsigned integer that specifies the offset in bytes, from the start of this record to the mask bitmap bits in the BitmapBuffer field.

cbBitsMask (4 bytes): An unsigned integer that specifies the size in bytes, of the mask bitmap bits.

BitmapBuffer (variable): A buffer containing the source and mask bitmaps, which are not required to be contiguous with the fixed portion of the EMR_MASKBLT record or with each other. Thus, fields in this buffer that are labeled "UndefinedSpace" are optional and MUST be ignored.

Note: The source and mask bitmaps can be present in this buffer in any order.


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

UndefinedSpace1 (variable, optional)

...

BmiSrc (variable)

...

UndefinedSpace2 (variable, optional)

...

BitsSrc (variable)

...

UndefinedSpace3 (variable, optional)

...

BmiMask (variable)

...

UndefinedSpace4 (variable, optional)

...

BitsMask (variable)

...

BmiSrc (variable): The source bitmap header.

BitsSrc (variable): The source bitmap bits.

BmiMask (variable): The mask bitmap header.

BitsMask (variable): The mask bitmap bits.

The mask bitmap MUST be monochrome; that is, each pixel value MUST be zero or one. A pixel value of one in the mask indicates that the color of the corresponding pixel in the source bitmap SHOULD be copied to the destination. A value of zero in the mask indicates that the destination pixel color SHOULD NOT be changed. If the mask rectangle is smaller than the source and destination rectangles, the mask pattern MUST be replicated as necessary.

See section 2.3.1 for more bitmap record types.