To a graphics driver, a clip region is a series of rectangles that can be filled by painting with a brush. A driver must support the DrvPaint function if the driver performs any drawing on a device-managed surface. When GDI calls DrvPaint, it passes a CLIPOBJ structure to define the region. The iDComplexity member of the structure classifies the painting operation as one of the following:
·Rectangular—A single rectangle is painted.
·Complex—A set of rectangles is painted.
DrvPaint performs the specified operation on the region indicated. If a complex region has been specified, the driver must first call the GDI service functions CLIPOBJ_cEnumStart and CLIPOBJ_bEnum to enumerate the rectangles that make up the region. It specifies, in the call, the type of shape it supports.
Note Vector drivers can implement this function using EngCreatePath and the PATHOBJ functions to create the hatch patterns for filling.
As indicated in Figure 3.5, the painting boundary conventions for a rectangle are similar to those for a path. The area consists of interior pixels bounded by the pixels of four lines. Two of the lines are horizontal, one designated as the top scan line and the other as the bottom scan line. The top scan line is the first line of the rectangle. The pixels of each scan line down to bottom one are included in the rectangle, but the pixels of the bottom line itself are excluded.
The two side lines of the rectangle must also be specified to completely define the shape. Pixels that fall between the left and right sides are included. Those that are exactly on the left side are also included, but those exactly on the right side are excluded.
Figure 3.5 Defining Rectangles for a Clip Region.
DrvPaint paints the area specified by the CLIPOBJ onto the surface. DrvPaint uses the pointer pbo, to indicate the BRUSHOBJ that defines the pattern and colors to fill the area.