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


OpenCPort

The OpenCPort procedure allocates space for and initializes a color graphics port. The Window Manager calls OpenCPort for every color window that it creates, and the NewGWorld procedure calls OpenCPort for every offscreen graphics world that it creates on a Color QuickDraw computer.

PROCEDURE OpenCPort (port: CGrafPtr);
port
A pointer to a CGrafPort record.
DESCRIPTION
The OpenCPort procedure is analogous to OpenPort (described in the chapter "Basic QuickDraw"), except that OpenCPort opens a CGrafPort record instead of a GrafPort record. The OpenCPort procedure is called by the Window Manager's NewCWindow and GetNewCWindow procedures, as well as by the Dialog Manager when the appropriate color resources are present. The OpenCPort procedure allocates storage for all the structures in the CGrafPort record, and then calls InitCPort to initialize them. The InitCPort procedure does not allocate a color table for the PixMap record for the color graphics port; instead, InitCPort copies the handle to the current device's CLUT into the PixMap record. The initial values for the CGrafPort record are shown in Table 4-3.
Initial values in the CGrafPort record (Continued)
FieldData typeInitial setting
deviceInteger0 (the screen)
portPixMapPixMapHandleHandle to the port's PixMap record
portVersionInteger$C000
grafVarsHandleHandle to a GrafVars record where black is assigned to the rgbOpColor field, the default highlight color is assigned to the rgbHiliteColor field, and all other fields are set to 0
chExtraInteger0
pnLocHFracIntegerThe value in this field represents the low word of a Fixed number; in decimal, its initial value is 0.5.
portRectRectscreenBits.bounds (boundary for entire main screen)
visRgnRgnHandleHandle to a rectangular region coincident with screenBits.bounds
clipRgnRgnHandleHandle to the rectangular region (-32768,-32768,32767,32767)
bkPixPatPatternWhite
rgbFgColorRGBColorBlack
rgbBkColorRGBColorWhite
pnLocPoint(0,0)
pnSizePoint(1,1)
pnModeIntegerpatCopy
pnPixPatPixPatHandleBlack
fillPixPatPixPatHandleBlack
pnVisInteger0 (visible)
txFontInteger0 (system font)
txFaceStylePlain
txModeIntegersrcOr
txSizeInteger0 (system font size)
spExtraFixed0
fgColorLongIntblackColor
bkColorLongIntwhiteColor
colrBitInteger0
patStretchInteger0
picSaveHandleNIL
rgnSaveHandleNIL
polySaveHandleNIL
grafProcsCQDProcsPtrNIL

The additional structures allocated are the portPixMap, pnPixPat, fillPixPat, bkPixPat, and grafVars handles, as well as the fields of the GrafVars record.

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


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996