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


OpenPort

The OpenPort procedure allocates space for and initializes a basic graphics port. The Window Manager calls OpenPort for each black-and-white window it creates, and the NewGWorld procedure calls OpenPort for every offscreen graphics world containing a basic graphics port that it creates.

PROCEDURE OpenPort (port: GrafPtr);
port
A pointer to a GrafPort record.
DESCRIPTION
The OpenPort procedure allocates space for visible and clipping regions for the graphics port specified in the port parameter, initializes the fields of the port's GrafPort record as indicated in Table 2-2, and makes that graphics port the current port (by calling SetPort). The Window Manager calls OpenPort when you create a black-and-white window; you normally won't call it yourself. You can create the graphics port pointer with the Memory Manager's NewPtr procedure.
Table 2-2 Initial values of a basic graphics port (Continued)
VariableTypeInitial setting
deviceInteger0 (the screen)
portBitsBitMapscreenBits (global variable for main screen)
portRectRectscreenBits.bounds
visRgnRgnHandleHandle to a rectangular region coincident with screenBits.bounds
clipRgnRgnHandleHandle to the rectangular region
(-32768,-32768,32767,32767)
bkPatPatternWhite
fillPatPatternBlack
pnLocPoint(0,0)
pnSizePoint(1,1)
pnModeIntegerpatCopy pattern mode
pnPatPatternBlack
pnVisInteger0 (visible)
txFontInteger0 (system font)
txFaceStylePlain
txModeIntegersrcOr source mode
txSizeInteger0 (system font size)
spExtraFixed0
fgColorLongIntblackColor
bkColorLongIntwhiteColor
colrBitInteger0
patStretchInteger0
picSaveHandleNIL
rgnSaveHandleNIL
polySaveHandleNIL
grafProcsQDProcsPtrNIL

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

SEE ALSO
The GrafPort record is described beginning on page 2-27. Listing 2-2 on page 2-15 illustrates how to use the Window Manager function GetNewWindow to create a basic graphics port. The OpenCPort procedure (described in the chapter "Color QuickDraw") creates a color graphics port.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996