Cosmetic Lines

A cosmetic line is always one pixel wide and is drawn using a solid color brush. It is rendered according to the Grid Intersection Quantization (GIQ) diamond convention in which each pixel can be thought of as having a 1-pixel by 1-pixel diamond around it.

For rendering cosmetic lines, DrvStrokePath follows the GIQ diamond convention. Figure 3.1 illustrates this convention, with the shaded diamonds representing the pixels to be lit. Wherever the line touches a diamond, the corresponding pixel is lighted. Start and end pixels are determined by the diamond convention. A diamond is exclusive of its sides, except for the right and bottom vertices. These points on the diamond are inclusive, unless the slope of the line is exactly one. In this case the left and bottom vertices are inclusive. A cosmetic line is last-pixel-exclusive; that is, if the line ends inside the diamond for a pixel, that pixel is not illuminated.

Figure 3.1 Diamond Convention for Cosmetic Line

DrvLineTo is an optional entry point that a driver can supply as an optimization for application calls to the Win32 LineTo function. DrvLineTo is simpler than DrvStrokePath because it supports only integer end-points and solid cosmetic lines.

For raster devices that support the R2_NOT mix mode, the driver must use exact rendering. Rendering should also be exact for devices that need GDI to draw on some bitmaps and the driver to draw on other surfaces (unless the pixels are too small to make any visible difference) or for devices that request GDI handle complex clipping.