Important: The information in this document is obsolete and should not be used for new development.
InitCPort
TheOpenCPortprocedure uses theInitCPortprocedure to initialize a color graphics port.
PROCEDURE InitCPort (port: CGrafPtr);
port- A pointer to a
CGrafPortrecord.DESCRIPTION
TheInitCPortprocedure is analogous toInitPort(described in the chapter "Basic QuickDraw"), exceptInitCPortinitializes aCGrafPortrecord instead of aGrafPortrecord. TheInitCPortprocedure does not allocate any storage; it merely initializes all the fields in theCGrafPortandGrafVarsrecords to the default values shown in Table 4-3 on page 4-55.The
PixMaprecord for the new color graphics port is set to be the same as the current device'sPixMaprecord. 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 newGDevicerecord and set it as the currentGDevicerecord before opening theCGrafPortrecord.Remember that
InitCPortdoes not copy the data from the current device's CLUT to the color table for the graphics port'sPixMaprecord. It simply replaces whatever is in
thePixMaprecord'spmTablefield with a copy of the handle to the current device's CLUT.If you try to initialize a
GrafPortrecord usingInitCPort, it simply returns without doing anything.SPECIAL CONSIDERATIONS
TheInitCPortprocedure 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 describesGDevicerecords; the chapter "Offscreen Graphics Worlds" in this book describes how to use offscreen graphics worlds.