Important: The information in this document is obsolete and should not be used for new development.
|
|
Log In | Not a Member? |
Contact ADC |
InitGraf
Use theInitGrafprocedure 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 theInitGrafprocedure before initializing any other Toolbox managers, such as the Menu Manager and Window Manager. TheInitGrafprocedure initializes the global variables listed in Table 2-1 (as well as some private global variables for QuickDraw's own internal use). TheInitGrafprocedure 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. SincethePortis 4 bytes, you would pass theglobalPtrparameter as follows:
PEA -4(A5) _InitGrafTheInitGrafprocedure stores this pointer tothePortin 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
TheInitGrafprocedure 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
InitCursorprocedure, which is described in the chapter "Cursor Utilities."
Get information on Apple products.
Visit the Apple Store online or at retail locations. 1-800-MY-APPLE Copyright © 2007 Apple Inc. All rights reserved. | Terms of use | Privacy Notice |