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 2 - Basic QuickDraw / Basic QuickDraw Reference
Routines / Opening and Closing Basic Graphics Ports


ClosePort

The ClosePort procedure closes a basic graphics port. The Window Manager calls this procedure when you close or dispose of a window, and the DisposeGWorld procedure calls it when you dispose of an offscreen graphics world containing a basic graphics port.

PROCEDURE ClosePort (port: GrafPtr);
port
A pointer to a GrafPort record.
DESCRIPTION
The ClosePort procedure releases the memory occupied by the given graphics port's visRgn and clipRgn fields. When you're completely through with a basic graphics port, you can use this procedure and then dispose of the graphics port with the Memory Manager procedure DisposePtr (if it was allocated with NewPtr). When you call the DisposeWindow procedure to close or dispose of a window, it calls ClosePort and DisposePtr for you. When you use the CloseWindow procedure, it calls ClosePort, but you must call DisposePtr.

SPECIAL CONSIDERATIONS
If ClosePort isn't called before a basic graphics port is disposed of, the memory used by the visible region and the clipping region will be unrecoverable.

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

SEE ALSO
The CloseCPort procedure (described in the chapter "Color QuickDraw") closes a color graphics port. The DisposeGWorld procedure is described in the chapter "Offscreen Graphics Worlds" in this book. The DisposeWindow and CloseWindow procedures are described in the chapter "Window Manager" in Inside Macintosh: Macintosh Toolbox Essentials. The DisposePtr procedure is described in the chapter "Memory Manager" in Inside Macintosh: Memory.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996