## Printer Device Driver

[prev][next][parent][TOC]

### Grey Scaling

The driver uses a grey scaling technique when all of the following conditions are met:

The current printer is a mono printer.

An application is drawing (into the band or a memory bit map) using a Bitblt or PolyScanLine call with any raster operation (ROP) in which the source bit map is not involved.

The pattern set and symbol in the pattern bundle attributes are the default values (for example, solid fill pattern in the default pattern set) .

The drawing is then completed using a pattern copy ROP and one of 65 grey scale patterns. These are mono patterns with a width and height of 8; the number of bits set to on ranges from 0 to all 64. The pattern is drawn with on bits as black and off bits as white. The pattern used is always 8x8, regardless of the current resolution.

The foreground color from the pattern bundle attributes is used to determine which one of these 65 grey scale patterns to use. A grey scale value is calculated from the R, G, and B components using weighting factors as follows:

                               ((59 x G) + (27 x R) + (14 x B))

         Grey scale value =   ----------------------------------

                                             100

The resulting grey scale value will lie between 0 and 255. This range is then translated into an index value within the range of 0 to 64 and this index value is then used to extract a grey scale pattern from the grey scale pattern table that represents the grey scale value, as follows:

Value Pattern
0 64 bits set on (completely black)
1 to 3 63 bits set on
4 to 7 62 bits set on
248 to 251 1 bit set on
252 to 256 0 bits set on (completely white)