3.1.4 Coordinate System

All the grabber-block functions operate using a left-hand coordinate system that is based on character cells in a manner similar to that used by the BIOS. The coordinate system origin (0,0) is located in the upper-left corner of the screen. Positive x direction is to the right and positive y direction is downward. The coordinate space consists of the set of integers that range from 0 to (icCharsX – 1) in the x direction and from 0 to (icCharsY – 1) in the y direction. The quantities icCharsX and icCharsY are found in the grabber's INFOCONTEXT structure, which may be obtained at any time by calling the extended-grabber function GetInfo. Notice that points in this space represent the upper-left corner of the character cells, not their center.

As indicated by their names, block functions operate on blocks of character cells. A block is fully specified by its origin (relative to the screen origin) and its x and y extents in the GRABREQUEST structure. The extents are unsigned one-based values. A block is the set of character cells in the rectangle defined by the origin of the block and the x and y coordinates. Specifying an extent of 0 on either axis has the same effect as specifying an extent equal to the maximum screen extent on that axis. In other words, the entire screen may be easily specified by setting:

grXorg = grYorg = grXext = grYext = 0

For graphics mode, the same cell-based convention applies so that Windows need not discern differences between graphics and text screens. The size of a character cell in graphics mode is the same size cell that the BIOS would use to display text using Interrupt 10h functions. The current grabbers do not yet support the specification of arbitrary block regions in graphics mode. An attempt to specify any other block in graphics mode will return the ERR_UNSUPPORTED error value.

The ERR_BOUNDARY error value indicates blocks that violate screen boundaries.