Partager via


2.2.2.2.1.1.2.3 PatBlt (PATBLT_ORDER)

The PatBlt Primary Drawing Order is used to paint a rectangle by using a specified brush and three-way raster operation.

 Encoding order number: 1 (0x01)
 Negotiation order number: 1 (0x01)
 Number of fields: 12
 Number of field encoding bytes: 2
 Maximum encoded field length: 26 bytes

Note that the negotiation order number for the PatBlt Primary Drawing Order (0x01) is the same as that for the OpaqueRect Primary Drawing Order (section 2.2.2.2.1.1.2.5). Hence support for PatBlt implies support for OpaqueRect. The converse is also true.


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

nLeftRect (variable)

nTopRect (variable)

nWidth (variable)

nHeight (variable)

bRop (optional)

BackColor (optional)

ForeColor (optional)

BrushOrgX (optional)

BrushOrgY (optional)

BrushStyle (optional)

BrushHatch (optional)

BrushExtra

...

...

nLeftRect (variable): Left coordinate of the destination rectangle specified using a Coord Field (section 2.2.2.2.1.1.1.1).

nTopRect (variable): Top coordinate of the destination rectangle specified using a Coord Field (section 2.2.2.2.1.1.1.1).

nWidth (variable): Width of the destination rectangle specified using a Coord Field (section 2.2.2.2.1.1.1.1).

nHeight (variable): Height of the destination rectangle specified using a Coord Field (section 2.2.2.2.1.1.1.1).

bRop (1 byte): Index of the ternary raster operation to perform (see section 2.2.2.2.1.1.1.7).

BackColor (3 bytes): Background color described using a Generic Color (section 2.2.2.2.1.1.1.8) structure.

ForeColor (3 bytes): Foreground color described using a Generic Color (section 2.2.2.2.1.1.1.8) structure.

BrushOrgX (1 byte): An 8-bit, signed integer. The x-coordinate of the point where the top leftmost pixel of a brush pattern MUST be anchored.

BrushOrgY (1 byte): An 8-bit, signed integer. The y-coordinate of the point where the top leftmost pixel of a brush pattern MUST be anchored.

BrushStyle (1 byte): An 8-bit, unsigned integer. The style of the brush used in the drawing operation.

If the TS_CACHED_BRUSH (0x80) flag is set in the most significant bit of the BrushStyle field, a brush that was previously cached using the Cache Bitmap Secondary Order (see section 2.2.2.2.1.2.7) MUST be used. In this case, the BrushHatch field MUST contain the index of the Brush Cache entry that holds the selected brush to use, and the low nibble of the BrushStyle field MUST contain an identifier describing the color depth of the cached brush.

Value

Meaning

BMF_1BPP

0x1

1 bit per pixel

BMF_8BPP

0x3

8 bits per pixel

BMF_16BPP

0x4

15 or 16 bits per pixel

BMF_24BPP

0x5

24 bits per pixel

BMF_32BPP

0x6

32 bits per pixel

If the TS_CACHED_BRUSH (0x80) flag is not set in the most significant bit of the BrushStyle field, an 8-by-8-pixel brush MUST be used, and one of the following style identifiers MUST be present in the field.

Value

Meaning

BS_SOLID

0x00

Solid color brush. The BrushHatch field SHOULD be set to 0.

BS_NULL

0x01

Hollow brush. The BrushHatch field SHOULD be set to 0.

BS_HATCHED

0x02

Hatched brush. The hatch pattern MUST be described by the BrushHatch field (there are six possible hatch patterns).

BS_PATTERN

0x03

Pattern brush. The pixel pattern MUST be described by the BrushExtra and BrushHatch fields.

BrushHatch (1 byte): An 8-bit, unsigned integer. Holds a brush hatch identifier or a Brush Cache index, depending on the contents of the BrushStyle field.

If the TS_CACHED_BRUSH (0x80) flag is set in the most significant bit of the BrushStyle field, the BrushHatch value MUST contain the index of the Brush Cache entry that holds the selected brush to use.

If the BrushStyle field is set to BS_SOLID (0x00) or BS_NULL (0x01), the BrushHatch field SHOULD be set to 0.

If the BrushStyle field is set to BS_HATCHED (0x02), the BrushHatch field MUST contain one of the following hatch constants.

Value

Meaning

HS_HORIZONTAL

0x00

Horizontal hatching as in the following figure.

Horizontal hatch

Figure 2: Horizontal hatch

HS_VERTICAL

0x01

Vertical hatching as in the following figure.

Vertical hatch

Figure 3: Vertical hatch

HS_FDIAGONAL

0x02

Diagonal hatching as in the following figure.

45-degree downward, left-to-right hatch

Figure 4: 45-degree downward, left-to-right hatch

HS_BDIAGONAL

0x03

Diagonal hatching as in the following figure.

45-degree upward, left-to-right hatch

Figure 5: 45-degree upward, left-to-right hatch

HS_CROSS

0x04

Cross-hatching as in the following figure.

Horizontal and vertical cross-hatch

Figure 6: Horizontal and vertical cross-hatch

HS_DIAGCROSS

0x05

Cross-hatching as in the following figure.

45-degree cross-hatch

Figure 7: 45-degree cross-hatch

If the BrushStyle field is set to BS_PATTERN (0x03), the BrushHatch field MUST encode the pixel pattern present in the bottom row of the 8x8 pattern brush (the pixel patterns in the top seven rows MUST be encoded in the BrushExtra field). For example, if the bottom row of the pattern brush contains an alternating series of black and white pixels, BrushHatch will contain either 0xAA or 0x55.

BrushExtra (7 bytes): A byte array of length 7. BrushExtra contains an array of bitmap bits that encodes the pixel pattern present in the top seven rows of the 8x8 pattern brush. The pixel pattern present in the bottom row is encoded in the BrushHatch field. The BrushExtra field is only present if the BrushStyle is set to BS_PATTERN (0x03). The rows are encoded in reverse order, that is, the pixels in the penultimate row are encoded in the first byte, and the pixels in the top row are encoded in the seventh byte. For example, a 45-degree downward sloping left-to-right line would be encoded in BrushExtra as { 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 } with BrushHatch containing the value 0x01 (the bottom row).