Important: The information in this document is obsolete and should not be used for new development.
GetPort
To save the current graphics port (basic or color), you can use theGetPortprocedure.
PROCEDURE GetPort (VAR port: GrafPtr);
port- A pointer to a
GrafPortrecord. If the current graphics port is a color graphics port,GetPortcoerces itsCGrafPortrecord into aGrafPortrecord.DESCRIPTION
TheGetPortprocedure returns a pointer to the current graphics port in theportparameter. The current graphics port is also available through the global variablethePort, but you may prefer to useGetPortfor better readability of your code. For example, your program could includeGetPort(savePort)before setting a new graphics port, followed bySetPort(savePort)to restore the previous port.SEE ALSO
Listing 2-3 on page 2-16 illustrates how to useGetPortto save the graphics port for the active window andSetPortto make an inactive window the current graphics port; then how to useSetPortagain to restore the active window as the current graphics port. The basic graphics port is described on page 2-27. TheSetPortprocedure is described next.When your application runs in Color QuickDraw or uses offscreen graphics worlds, it should use the
GetGWorldprocedure instead ofGetPort. TheGetGWorldprocedure saves the current graphics port for basic and color graphics ports as well as offscreen graphics worlds. See the chapter "Offscreen Graphics Worlds" for more information.