Important: The information in this document is obsolete and should not be used for new development.
Opening and Closing Color Graphics Ports
All graphics operations are performed in graphics ports. Before a color graphics port can be used, it must be allocated with theOpenCPort
procedure and initialized with theInitCPort
procedure. Normally, your application does not call these procedures directly. Instead, your application creates a graphics port by using theGetNewCWindow
orNewCWindow
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 automatically callOpenCPort
, which in turn callsInitCPort
.To dispose of a color graphics port when you are finished using a color 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 when you are finished with a color graphics port for an offscreen graphics world. These routines automatically call theCloseCPort
procedure. If you use theCloseWindow
procedure, you also dispose of the window record containing the graphics port by calling the Memory Manager procedureDisposePtr
.
Subtopics
- OpenCPort
- InitCPort
- CloseCPort