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


The OpenCPort procedure uses the InitCPort procedure to initialize a color graphics port.

PROCEDURE InitCPort (port: CGrafPtr); 
A pointer to a CGrafPort record.
The InitCPort procedure is analogous to InitPort (described in the chapter "Basic QuickDraw"), except InitCPort initializes a CGrafPort record instead of a GrafPort record. The InitCPort procedure does not allocate any storage; it merely initializes all the fields in the CGrafPort and GrafVars records to the default values shown in Table 4-3 on page 4-55.

The PixMap record for the new color graphics port is set to be the same as the current device's PixMap record. This allows you to create an offscreen graphics world that is identical to the screen's port for drawing offscreen. If you want to use a different set of colors for offscreen drawing, you should create a new GDevice record and set it as the current GDevice record before opening the CGrafPort record.

Remember that InitCPort does not copy the data from the current device's CLUT to the color table for the graphics port's PixMap record. It simply replaces whatever is in
the PixMap record's pmTable field with a copy of the handle to the current device's CLUT.

If you try to initialize a GrafPort record using InitCPort, it simply returns without doing anything.

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

The chapter "Graphics Devices" in this book describes GDevice records; the chapter "Offscreen Graphics Worlds" in this book describes how to use offscreen graphics worlds.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996