INF: Using the DRAWPATTERNRECT Escape In Windows

ID Number: Q75380

2.03 2.10 3.00 3.10

WINDOWS

Summary:

The DRAWPATTERNRECT escape is implemented by the PCL/HP driver for

Hewlett-Packard (HP) LaserJet printers and compatibles. The escape is

used to draw a patterned rectangle without using the graphics banding

bitmap. Using this escape can enhance the performance for many

applications, particularly when a majority of users have

LaserJet-compatible printers.

More Information:

The HP LaserJet Plus and all later LaserJets implement a command

called a rule. A rule is a rectangle filled with some pattern, such as

a black rule, a quasi-halftone gray scale, or a hatch pattern.

The output does not go through the graphics banding bitmap (it is

actually sent to the printer in the text band). The DRAWPATTERNRECT

escape can be used to print line and block graphics in the text band

without using graphics banding at all. Because many applications use

only horizontal and vertical lines or blocks, this is a significant

optimization.

An application should determine support for rules using the

QUERYESCSUPPORT escape. In particular, the application should not

check for the PCL/HP driver, since other page printer drivers may

implement the escape as well.

There are some limitations to the escape. First, rules drawn with

DRAWPATTERNRECT are not subject to clipping regions in the Device

Context (DC). Second, rules cannot be opaqued; no white pixel in the

graphics band will erase a pixel drawn by a rule (the same limitation

occurs for PCL text). Once a rule is drawn, it cannot be erased.

If these limitations are acceptable, if all graphics on the page are

likely to be horizontal and vertical lines, and if a significant

number of users are expected to have LaserJet-type printers (which is

the case for most Windows applications), the DRAWPATTERNRECT escape

should be used.

If for any reason DRAWPATTERNRECT cannot be used, then the application

should generally use the PatBlt function. If the device is a

plotter, the Rectangle function should be used. In the case of the

PatBlt function, if a black rectangle is to be printed, the BLACKNESS

raster operator (ROP) should be used to avoid the overhead of

selecting and later deselecting a black brush into the printer DC.

Additional reference words: 2.03 2.10 3.00 3.10 fast printing HPPCL HP-PCL