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 / Changing the Pixel Depth for a Video Device


To determine whether a video device supports a specific pixel depth, you can use the HasDepth function.

FUNCTION HasDepth (aDevice: GDHandle; depth: Integer; 
                  whichFlags: Integer; flags: Integer): Integer;
A handle to the GDevice record of the video device.
The pixel depth for which you're testing.

The gdDevType constant, which represents a bit in the gdFlags field of the GDevice record. (If this bit is set to 0 in the GDevice record, the video device is black and white; if the bit is set to 1, the device supports color.)
The value 0 or 1. If you pass 0 in this parameter, the HasDepth function tests whether the video device is black and white; if you pass 1 in this parameter, HasDepth tests whether the video device supports color.
The HasDepth function checks whether the video device you specify in the aDevice parameter supports the pixel depth you specify in the depth parameter, and whether the device is black and white or color, whichever you specify in the flags parameter.

The HasDepth function returns 0 if the device does not support the depth you specify in the depth parameter or the display mode you specify in the flags parameter.

Any other value indicates that the device supports the specified depth and display mode. The function result contains the mode ID that QuickDraw passes to the video driver to set its pixel depth and to specify color or black and white. You can pass this mode ID in the depth parameter for the SetDepth function (described next) to set the graphics device to the pixel depth and display mode for which you tested.

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

See Designing Cards and Drivers for the Macintosh Family, third edition, for more information about the device modes returned as a function result for HasDepth.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996