6.12.9 Creating Additional Function Sets

The creation of additional function sets should be required only when an output device does not conform to existing function sets or when additional device-dependent color spaces are necessary. A function set consists primarily of a collection of device-dependent XcmsColorSpace structures and a means to read and store a screen's color characterization data. This data is stored in an XcmsFunctionSet structure. A handle to this structure (that is, by means of global variable) is usually made accessible to the client program for use with XcmsAddFunctionSet().

If a function set uses new device-dependent XcmsColorSpace structures, they will be transparently processed into the color management system. Function sets can share an XcmsColorSpace structure for a device-dependent color space. In addition, multiple XcmsColorSpace structures are allowed for a device-dependent color space; however, a function set can reference only one of them. These XcmsColorSpace structures will differ in the functions to convert to and from CIE XYZ, thus tailored for the specific function set.

typedef struct _XcmsFunctionSet {
	XcmsColorSpace **DDColorSpaces;
	XcmsScreenInitProc screenInitProc;
	XcmsScreenFreeProc screenFreeProc;
} XcmsFunctionSet;

The DDColorSpaces member is a pointer to a NULL terminated list of pointers to XcmsColorSpace structures for the device-dependent color spaces that are supported by the function set. The screenInitProc member is set to the callback procedure (see the following interface specification) that initializes the XcmsPerScrnInfo structure for a particular screen.

The screen initialization callback must adhere to the following software interface specification:

typedef Status (*XcmsScreenInitProc)(display, screen_number, screen_info)
      Display *display;
      int screen_number;
      XcmsPerScrnInfo *screen_info;

display Specifies the connection to the X server.
screen_number Specifies the appropriate screen number on the host server.
screen_info Specifies the XcmsPerScrnInfo structure, which contains the per screen information.
The screen initialization callback in the XcmsFunctionSet structure fetches the color characterization data (device profile) for the specified screen, typically off properties on the screen's root window. It then initializes the specified XcmsPerScrnInfo structure. If successful, the procedure fills in the XcmsPerScrnInfo structure as follows:

If unsuccessful, the procedure sets the state member to XcmsInitFailure and returns .PN XcmsFailure .

The XcmsPerScrnInfo structure contains:

typedef struct _XcmsPerScrnInfo {
	XcmsColor screenWhitePoint;
	XPointer functionSet;
	XPointer screenData;
	unsigned char state;
	char pad[3];
} XcmsPerScrnInfo;

The screenWhitePoint member specifies the white point inherent to the screen. The functionSet member specifies the appropriate function set. The screenData member specifies the device profile. The state member is set to one of the following:

The screen free callback must adhere to the following software interface specification:

typedef void (*XcmsScreenFreeProc)(screenData)
      XPointer screenData;

screenData Specifies the data to be freed.
This function is called to free the screenData stored in an XcmsPerScrnInfo structure.
Next Chapter: Graphics Context Functions

Christophe Tronche, ch@tronche.com