Carbon


GDevice

Header: Quickdraw.h

struct GDevice {
    SInt16 gdRefNum; 
    SInt16 gdID; 
    SInt16 gdType; 
    ITabHandle gdITable; 
    SInt16 gdResPref; 
    SProcHndl gdSearchProc; 
    CProcHndl gdCompProc; 
    SInt16 gdFlags; 
    PixMapHandle gdPMap; 
    SInt32 gdRefCon; 
    GDHandle gdNextGD; 
    Rect gdRect; 
    SInt32 gdMode; 
    SInt16 gdCCBytes; 
    SInt16 gdCCDepth; 
    Handle gdCCXData; 
    Handle gdCCXMask; 
    SInt32 gdReserved;
};
typedef GDevice GDPtr;

Field descriptions

gdRefNum

The reference number of the driver for the screen associated with the video device. For most video devices, this information is set at system startup time.

gdID

Reserved. If you create your own GDevice structure, set this field to 0.

gdType

The general type of graphics device. See “Graphics Device Type Constants” for a description of the values which you can use in this field.

gdITable

A handle to the inverse table for color mapping.

gdResPref

The preferred resolution for inverse tables.

gdSearchProc

A handle to the list of search functions. Its value is NULL for the default function.

gdCompProc

A handle to a list of complement functions. Its value is NULL for the default function.

gdFlags

The GDevice structure’s attributes. To set the attribute bits in the gdFlags field, use the SetDeviceAttribute function. Do not set gdFlags directly in the GDevice structure.

gdPMap

A handle to a PixMap structure giving the dimension of the image buffer, along with the characteristics of the graphics device (resolution, storage format, color depth, and color table). For GDevice structures, the high bit of the global variable

(((**TheGDevice).**gdPMap).**pmTable).ctFlags

is always set.

gdRefCon

A value used by system software to pass device-related parameters. Since a graphics device is shared, do not store data here.

gdNextGD

A handle to the next graphics device in the device list. If this is the last graphics device in the device list, the field contains 0.

gdRect

The boundary rectangle of the graphics device represented by the GDevice structure. The main screen has the upper-left corner of the rectangle set to (0,0). All other graphics devices are relative to this point.

gdMode

The current setting for the graphics device mode. This value is passed to the video driver to set its pixel depth and to specify color or black and white; applications do not need this information.

gdCCBytes

The rowBytes value of the expanded cursor. Your application should not change this field.

gdCCDepth

The depth of the expanded cursor. Your application should not change this field.

gdCCXData

A handle to the cursor’s expanded data. Your application should not change this field.

gdCCXMask

A handle to the cursor’s expanded mask. Your application should not change this field.

gdReserved

Reserved for future expansion; it must be set to 0 for future compatibility.

Color QuickDraw stores state information for video devices and offscreen graphics worlds in GDevice structures. When the system starts up, it allocates and initializes one handle to a GDevice structure for each video device it finds. When you use the Offscreen Graphics Devices function, NewGWorld, Color QuickDraw automatically creates a GDevice structure for the new offscreen graphics world. The system links these GDevice structures in a list, called the device list. (You can find a handle to the first element in the device list in the global variable DeviceList.) By default, the GDevice structure corresponding to the first video device found is marked as the current device. All other graphics devices in the list are initially marked as inactive.

When the user moves a window or creates a window on another screen, and your application draws into that window, Color QuickDraw automatically makes the video device for that screen the current device. Color QuickDraw stores that information in the global variable TheGDevice.

GDevice structures that correspond to video devices have drivers associated with them. These drivers can be used to change the mode of the video device from black and white to color and to change the pixel depth. Application-created GDevice structures usually don’t require drivers.

Your application should never need to directly change the fields of a GDevice structure. If you find it absolutely necessary for your application to so, immediately use the GDeviceChanged function to notify QuickDraw that your application has changed the GDevice structure.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)