Important: The information in this document is obsolete and should not be used for new development.
InitGraf
Use theInitGraf
procedure to initialize QuickDraw.
PROCEDURE InitGraf (globalPtr: Ptr);
globalPtr
- A pointer to the global variable
thePort
, which from Pascal can be passed as@thePort
.DESCRIPTION
Use theInitGraf
procedure before initializing any other Toolbox managers, such as the Menu Manager and Window Manager. TheInitGraf
procedure initializes the global variables listed in Table 2-1 (as well as some private global variables for QuickDraw's own internal use). TheInitGraf
procedure also initializes Color QuickDraw on computers with Color QuickDraw capabilities.ASSEMBLY-LANGUAGE INFORMATION
The QuickDraw global variables are stored in reverse order, from high to low memory as listed in Table 2-1, and require the number of bytes specified by the global constantgrafSize
. Most development systems preallocate space for these global variables immediately below the location pointed to by register A5. SincethePort
is 4 bytes, you would pass theglobalPtr
parameter as follows:
PEA -4(A5) _InitGrafTheInitGraf
procedure stores this pointer tothePort
in the location pointed to by A5.This value is used as a base address when accessing the other QuickDraw global variables, which are accessed using negative offsets (the offsets have the same names as the Pascal global variables). For example:
MOVE.L (A5),A0 ;point to first QuickDraw global MOVE.L randSeed(A0),A1 ;get global variable randSeedSPECIAL CONSIDERATIONS
TheInitGraf
procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.SEE ALSO
Listing 2-1 on page 2-14 illustrates the use ofInitGraf
.To initialize the cursor, call the
InitCursor
procedure, which is described in the chapter "Cursor Utilities."