The Graphics Device Record
The Graphics Device Record
The color grafPort record contains information about a window, but there can
be many windows on a screen, and even many screens. The graphics device
record is the data structure that holds information about the physical
characteristics of a drawing environment.
Like the grafPort, the graphics device record is created automatically for you:
the Graphics Devices Manager uses information supplied by the
Slot Manager to create a graphics device record for each device found in a
slot card during startup.
Color QuickDraw needs ready access to a number of characteristics of the
display devices. It collects this vital information in the graphics device record,
whose contents can be manipulated by a set of routines described in the
Graphics Devices Manager. These routines issue standard device control
calls to the card's device-specific driver, which set and query characteristics
such as pixel depth. The Graphics Devices Manager routines are also
responsible for updating the graphics device records.
Much of the information in a graphics device record is too esoteric for an
overview, and the new offscreen graphics routines ( described in the
Graphics Devices Manager) provide a procedural interface to its fields.
But a look at this last link is important in the conceptual chain.
The gdITable field points to an inverse table, which the Color Manager
creates and maintains, and uses to quickly find the nearest match for a
requested color. (The technique is described in the Color Manager) The
process is very fast once the table is built, but if a color is changed in the
device's CLUT, the Color Manager must rebuild the inverse table the next
time it has to find a color. Using high tolerance values in the palettes
associated with your windows, rather than always demanding exact matches to
your colors, lessens the recalculations required. (For an explanation of
tolerance values, see the Palette Manager)
The gdPMap field contains a handle to the pixel map that reflects the imaging
capabilities of the device. The pixel map's type, size, and component fields
indicate whether the device is direct or indexed and what pixel depth it
displays. The pixel map's color table is synchronized with the CLUT on the
device.
The gdRect field describes the device's bounds in global coordinates.
If you want to work with offscreen graphics that have characteristics
different from those of the actual devices on the system, you can use the
offscreen graphics world routines to create and maintain offscreen port and
device records. (See the Graphics Devices Manager.)