DRAWPATTERNRECT

short Escape(hdc, DRAWPATTERNRECT, sizeof(PRECTSTRUCT),lpInData, NULL)

The DRAWPATTERNRECT printer escape creates a pattern, gray scale, or
solid black rectangle by using the pattern and rule capabilities of Page Control
Language (PCL) on Hewlett-Packard LaserJet or LaserJet-compatible printers.
A gray scale is a gray pattern that contains a specific mixture of black and white pixels.

Parameters

hdc

HDC Identifies the device context.

lpInData

PRECT_STRUCT FAR * Points to a PRECT_STRUCT structure that describes the rectangle. For more information on this structure, see the following Comments section.

Return Value

The return value specifies the outcome of the escape. This value is 1 if the escape is successful. Otherwise, it is zero.

Comments

The lpInData parameter points to a PRECT_STRUCT structure that defines the rectangle to be created. This structure has the following form:

struct PRECT_STRUCT {
    POINT ptPosition;
    POINT ptSize;
    WORD  wStyle;
    WORD  wPattern;
};

Following are the members in the PRECT_STRUCT structure:

ptPosition

Specifies the upper-left corner of the rectangle.

ptSize

Specifies the lower-right corner of the rectangle.

wStyle

Specifies the type of pattern. It can be one of the following values:

Value Meaning

0 Black rule
1 White rule that erases bitmap data previously written to same area (available on the HP LaserJet IIP only)
2 Gray scale
3 HP-defined

wPattern

Specifies the pattern. It is ignored for a black rule. It specifies the percentage of gray for a gray-scale pattern. It represents one of six patterns defined by Hewlett-Packard.

Comments

The output of the DRAWPATTERNRECT escape does not go through the graphics banding bitmap; it is sent to the printer in the text band. An application can use this escape to print line and block graphics without using graphics banding at all. Because many applications use only horizontal and vertical lines or blocks in graphic output, this is a significant optimization.

An application should use the QUERYESCSUPPORT escape to determine whether a device is capable of drawing patterns and rules before using the DRAWPATTERNRECT escape. If an application uses the BANDINFO escape, all patterns and rectangles sent by using DRAWPATTERNRECT should be treated as text and sent on a text band.

Applications that use the DRAWPATTERNRECT escape must observe two limitations. First, rules drawn with DRAWPATTERNRECT are not subject to clipping regions in the device context. Second, applications should not try to erase patterns and rules created with DRAWPATTERNRECT by placing opaque objects over them. If the printer supports white rules, these can be used to erase patterns created by DRAWPATTERNRECT. If the printer does not support white rules, there is no method for erasing these patterns.

If an application cannot use the DRAWPATTERNRECT escape, it should generally use the PatBlt function instead. (If PatBlt is used to print a black rectangle, the application should use the BLACKNESS raster operator.) If the device is a plotter, the application should use the Rectangle function.