Important: The information in this document is obsolete and should not be used for new development.
NewGDevice
You can use theNewGDevice
function to create a newGDevice
record, although you generally don't need to, because Color QuickDraw uses this function to createGDevice
records for your application automatically.
FUNCTION NewGDevice (refNum: Integer; mode: LongInt): GDHandle;
refNum
- Reference number of the graphics device for which you are creating a
GDevice
record. For most video devices, this information is set at system startup.mode
- The device configuration mode. Used by the screen driver, this value sets the pixel depth and specifies color or black and white.
DESCRIPTION
For the graphics device whose driver is specified in therefNum
parameter and whose mode is specified in themode
parameter, theNewGDevice
function allocates a newGDevice
record and all of its handles, and then calls theInitGDevice
procedure to initialize the record. As its function result,NewGDevice
returns a handle to the newGDevice
record. If the request is unsuccessful,NewGDevice
returnsNIL
.The
NewGDevice
function allocates the newGDevice
record and all of its handles in the system heap, and theNewGDevice
function sets all attributes in thegdFlags
field of theGDevice
record toFALSE
. If your application creates aGDevice
record, it can use theSetDeviceAttribute
procedure, described on page 5-21, to change the flag bits in thegdFlags
field of theGDevice
record toTRUE
. Your application should never directly change thegdFlags
field of theGDevice
record; instead, your application should use only theSetDeviceAttribute
procedure.If your application creates a
GDevice
record without a driver, it should set themode
parameter to -1. In this case,InitGDevice
cannot initialize theGDevice
record, so your application must perform all initialization of the record. AGDevice
record's default mode is defined as 128; this is assumed to be a black-and-white mode. If you specify a value other than 128 in themode
parameter, the record'sgdDevType
bit in thegdFlags
field of theGDevice
record is set toTRUE
to indicate that the graphics device is capable of displaying color.The
NewGDevice
function doesn't automatically insert theGDevice
record into the device list. In general, your application shouldn't createGDevice
records, and if it ever does, it should never add them to the device list.SPECIAL CONSIDERATIONS
If your program usesNewGDevice
to create a graphics device without a driver,InitGDevice
does nothing; instead, your application must initialize all fields of theGDevice
record. After your application initializes the color table for theGDevice
record, your application should call the Color Manager procedureMakeITable
to build the inverse table for the graphics device.The
NewGDevice
function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.SEE ALSO
TheGDevice
record is described on page 5-14. See Designing Cards and Drivers for the Macintosh Family, third edition, for more information about the device modes that you can specify in themode
parameter. The Color Manager is described in Advanced Color Imaging on the Mac OS.