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 theOpenPortprocedure. Normally, your application does not call this procedure directly. Instead, your application creates a basic graphics port by using theGetNewWindoworNewWindowfunction (described in the chapter "Window Manager" in Inside Macintosh: Macintosh Toolbox Essentials) or theNewGWorldfunction (described in the chapter "Offscreen Graphics Worlds" in this book). These functions callOpenPort, which in turn calls theInitPortprocedure.To dispose of a graphics port when you are finished using a window, you normally use the
DisposeWindowprocedure (if you let the Window Manager allocate memory for the window) or theCloseWindowprocedure (if you allocated memory for the window). You use theDisposeGWorldprocedure to dispose of a graphics port when you are finished with an offscreen graphics world. These routines automatically call theClosePortprocedure. If you use theCloseWindowprocedure, you also dispose of the window record containing the graphics port by calling the Memory Manager procedureDisposePtr.
Subtopics
- OpenPort
- InitPort
- ClosePort