Important: The information in this document is obsolete and should not be used for new development.
Opening and Closing Basic Graphics Ports
All graphics operations are performed in graphics ports. Before a basic graphics port can be used, it must be allocated and initialized with theOpenPort
procedure. Normally, your application does not call this procedure directly. Instead, your application creates a basic graphics port by using theGetNewWindow
orNewWindow
function (described in the chapter "Window Manager" in Inside Macintosh: Macintosh Toolbox Essentials) or theNewGWorld
function (described in the chapter "Offscreen Graphics Worlds" in this book). These functions callOpenPort
, which in turn calls theInitPort
procedure.To dispose of a graphics port when you are finished using a window, you normally use the
DisposeWindow
procedure (if you let the Window Manager allocate memory for the window) or theCloseWindow
procedure (if you allocated memory for the window). You use theDisposeGWorld
procedure to dispose of a graphics port when you are finished with an offscreen graphics world. These routines automatically call theClosePort
procedure. If you use theCloseWindow
procedure, you also dispose of the window record containing the graphics port by calling the Memory Manager procedureDisposePtr
.
Subtopics
- OpenPort
- InitPort
- ClosePort