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 5 - Graphics Devices / Graphics Devices Reference
Routines for Graphics Devices / Creating, Setting, and Disposing of GDevice Records


The NewGDevice function uses the InitGDevice procedure to initialize a GDevice record.

PROCEDURE InitGDevice (gdRefNum: Integer; mode: LongInt; 
                       gdh: GDHandle);
Reference number of the graphics device. System software sets this number at system startup time for most graphics devices.
The device configuration mode. Used by the screen driver, this value sets the pixel depth and specifies color or black and white.
The handle, returned by the NewGDevice function, to the GDevice record to be initialized.
The InitGDevice procedure initializes the GDevice record specified in the gdh parameter. The InitGDevice procedure sets the graphics device whose driver has the reference number specified in the gdRefNum parameter to the mode specified in the mode parameter. The InitGDevice procedure then fills out the GDevice record, previously created with the NewGDevice function, to contain all information describing that mode.

The mode parameter determines the configuration of the device; possible modes for a device can be determined by interrogating the video device's ROM through Slot Manager routines. The information describing the device's mode is primarily contained in the video device's ROM. If the video device has a fixed color table, then that table is read directly from the ROM. If the video device has a variable color table, then InitGDevice uses the default color table defined in a 'clut' resource, contained in the System file, that has a resource ID equal to the video device's pixel depth.

In general, your application should never need to call InitGDevice. All video devices are initialized at start time, and users change modes through the Monitors control panel.

If your program uses NewGDevice to create a graphics device without a driver, InitGDevice does nothing; instead, your application must initialize all fields of the GDevice record. After your application initializes the color table for the GDevice record, your application should call the Color Manager procedure MakeITable to build the inverse table for the graphics device.

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

The GDevice 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 the mode parameter. The MakeITable procedure is described in the chapter "Color Manager" in Advanced Color Imaging on the Mac OS.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996