Important: The information in this document is obsolete and should not be used for new development.
SetDepth
To change the pixel depth of a video device, use theSetDepth
function.
FUNCTION SetDepth (aDevice: GDHandle; depth: Integer; whichFlags: Integer; flags: Integer): OSErr;
aDevice
- A handle to the
GDevice
record of the video device whose pixel depth you wish to change.depth
- The mode ID returned by the
HasDepth
function (described in the previous section) indicating that the video device supports the desired pixel depth. Alternatively, you can pass the desired pixel depth directly in this parameter, although you should use theHasDepth
function to ensure that the device supports this depth.whichFlags
ThegdDevType
constant, which represents a bit in thegdFlags
field of theGDevice
record. (If this bit is set to 0 in theGDevice
record, the video device is black and white; if the bit is set to 1, the device supports color.)flags
- The value 0 or 1. If you pass 0 in this parameter, the
SetDepth
function changes the video device to black and white; if you pass 1 in this parameter,SetDepth
changes the video device to color.DESCRIPTION
TheSetDepth
function sets the video device you specify in theaDevice
parameter to the pixel depth you specify in thedepth
parameter, and it sets the device to either black and white or color as you specify in theflags
parameter. You should use theHasDepth
function to ensure that the video device supports the values you specify toSetDepth
. TheSetDepth
returns zero if successful, or it returns a nonzero value if it cannot impose the desired depth and display mode on the requested device.The
SetDepth
function does not change the'scrn'
resource; when the system is restarted, the original depth for this device is restored.SPECIAL CONSIDERATIONS
Your application should useSetDepth
only if your application can run on devices of a particular pixel depth and is unable to adapt to any other depth. Your application should display a dialog box that offers the user a choice between changing to that depth or canceling display of the image before your application usesSetDepth
. Such a dialog box saves the user the trouble of going to the Monitors control panel before returning to your application.The
SetDepth
function may move or purge blocks of memory in the application heap. Your application should not call this function at interrupt time.SEE ALSO
See the chapter "Dialog Manager" in Inside Macintosh: Macintosh Toolbox Essentials for information about creating and using dialog boxes.