Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 6 - Offscreen Graphics Worlds / Offscreen Graphics Worlds Reference
Routines / Saving and Restoring Graphics Ports and Offscreen Graphics Worlds


SetGWorld

To change the current graphics port (basic, color, or offscreen), use the SetGWorld procedure.

PROCEDURE SetGWorld (port: CGrafPtr; gdh: GDHandle);
port
A pointer to an offscreen graphics world, color graphics port, or basic graphics port.
gdh
A handle to a GDevice record. If you pass a pointer to an offscreen graphics world in the port parameter, set this parameter to NIL, because SetGWorld ignores this parameter and sets the current device to the device attached to the offscreen graphics world.
DESCRIPTION
The SetGWorld procedure sets the current graphics port to the one specified by the port parameter and--unless you set the current graphics port to be an offscreen graphics world--sets the current device to that specified by the gdh parameter.

In the port parameter, you can specify values of type GrafPtr, CGrafPtr, or GWorldPtr, depending on whether you want to set the current graphics port to be a basic graphics port, color graphics port, or offscreen graphics world. Any drawing your application performs then occurs in this graphics port.

SPECIAL CONSIDERATIONS
The SetGWorld procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SetGWorld procedure are
Trap macroSelector
_QDExtensions$00080006

SEE ALSO
Listing 6-1 on page 6-5 and Listing 6-2 on page 6-10 illustrate how to use the GetGWorld procedure to save the current graphics port for an active window, the SetGWorld procedure to change the current graphics port to an offscreen graphics world, and then SetGWorld again to restore the active window as the current graphics port.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996