Graphics Initialization
In the initialization process, illustrated in the next figure, the firmware in a
video card's ROM supplies information about what sort of graphics device it is
(indexed or direct), how much card RAM is available, and so on. Some of this
information is stored in the graphics device record for that card, where it is
available to the entire graphics system.
Initializing Macintosh graphics
When you open a window, the color grafPort record contains a handle to a
pixel map record that was cloned from the pixel map record in the main
screen's graphics device record. The pixel map record for your window
thereby contains the correct pixel specifications for the screen on which it is
displayed.
The situation is more complex when a window is displayed in a multi screen
environment, but QuickDraw does the housekeeping for you. When a multiscreen system starts up, one of the screens is determined to be the startup
screen, the screen on which the “happy Macintosh” appears. (If the user has
specified a startup screen in the Monitors control panel, then that screen is
used.) By default, the menu bar appears on the startup screen. The screen with
the menu bar is called the main screen. Global coordinates are anchored to
the main screen, whose upper-left corner is at (0,0).
Each screen has its own graphics device record created from information in
the video card's ROM. Thus, there is a graphics destination for each screen, but
QuickDraw lets you draw to the window's grafPort as if it were all on one drawing to the other screens.
During the startup of a multiscreen environment, the InitWindows procedure is called to create a region that is the union of all the active screen
devices (minus the menu bar and the rounded corners on the outermost
screens). It saves this region as the global variable GrayRgn. The gray
region describes and defines the desktop, the area on which windows can be
dragged.
Windows can be dragged anywhere within the gray region, from one screen to
another or spanning screen boundaries. QuickDraw calculates the global coordinates of the rectangle into which it must draw and issues the drawing
command to each device the rectangle intersects.