Important: The information in this document is obsolete and should not be used for new development.
InitCPort
TheOpenCPort
procedure uses theInitCPort
procedure to initialize a color graphics port.
PROCEDURE InitCPort (port: CGrafPtr);
port
- A pointer to a
CGrafPort
record.DESCRIPTION
TheInitCPort
procedure is analogous toInitPort
(described in the chapter "Basic QuickDraw"), exceptInitCPort
initializes aCGrafPort
record instead of aGrafPort
record. TheInitCPort
procedure does not allocate any storage; it merely initializes all the fields in theCGrafPort
andGrafVars
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'sPixMap
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 newGDevice
record and set it as the currentGDevice
record before opening theCGrafPort
record.Remember that
InitCPort
does not copy the data from the current device's CLUT to the color table for the graphics port'sPixMap
record. It simply replaces whatever is in
thePixMap
record'spmTable
field with a copy of the handle to the current device's CLUT.If you try to initialize a
GrafPort
record usingInitCPort
, it simply returns without doing anything.SPECIAL CONSIDERATIONS
TheInitCPort
procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.SEE ALSO
The chapter "Graphics Devices" in this book describesGDevice
records; the chapter "Offscreen Graphics Worlds" in this book describes how to use offscreen graphics worlds.