Important: The information in this document is obsolete and should not be used for new development.
OpenCPort
TheOpenCPortprocedure allocates space for and initializes a color graphics port. The Window Manager callsOpenCPortfor every color window that it creates, and theNewGWorldprocedure callsOpenCPortfor every offscreen graphics world that it creates on a Color QuickDraw computer.
PROCEDURE OpenCPort (port: CGrafPtr);
port- A pointer to a
CGrafPortrecord.DESCRIPTION
TheOpenCPortprocedure is analogous toOpenPort(described in the chapter "Basic QuickDraw"), except thatOpenCPortopens aCGrafPortrecord instead of aGrafPortrecord. TheOpenCPortprocedure is called by the Window Manager'sNewCWindowandGetNewCWindowprocedures, as well as by the Dialog Manager when the appropriate color resources are present. TheOpenCPortprocedure allocates storage for all the structures in theCGrafPortrecord, and then callsInitCPortto initialize them. TheInitCPortprocedure does not allocate a color table for thePixMaprecord for the color graphics port; instead,InitCPortcopies the handle to the current device's CLUT into thePixMaprecord. The initial values for theCGrafPortrecord are shown in Table 4-3.The additional structures allocated are the
portPixMap,pnPixPat,fillPixPat,bkPixPat, andgrafVarshandles, as well as the fields of theGrafVarsrecord.SPECIAL CONSIDERATIONS
TheOpenCPortprocedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.