The XCPD Color Management API
Profile Selection Overview
Note: The following assumes that a “ICC color profile” option is located in the PPD, ensuring that the user-specified ICC selection option is already within the ppd_file_t* object. An alternative solution for PPDs without this mechanism will be mentioned in Part 3d.
The XCPDCM Selector Module handles the profile selection code via Oyranos, a well-known color management system (CMS). Its job is to receive configuration data from a PPD file – specifically during the selection of options by the user in the print dialog – and apply the profile-selection workflow as recommended here. Based on the settings marked in the PPD object, a profile will thus be stored in an xcpd_cm_t* object, which will be available for PDF transport (see Part 3B of this manual for details on the PDF rendering code).
A function named xcpdCM_setProfileFromPPD() is to be called in order to initiate the profile-selection sequence. A ppd_file_t* object must be marked with the user-selected options prior to sending it into this function, along with an xcpd_cm_t* object. What is returned is both the xcpd_cm_t* object with an appropriate profile, and a xcpdcm_sstatus_t result enumeration.
Here is a snippet of the code:
xcpd_cm_t* cm_obj = xcpdCM_initialize(); ppd_file_t* ppd = ppdOpenFile("ppdfile.ppd"); //... // Select dialog options by marking the PPD file object. // ... xcpdcm_sstatus_t result = xcpdCM_setProfileFromPPD(cm_obj, ppd); if(result != XCPDCM_SELECTOR_INVALID_PPD || result != XCPDCM_SELECTOR_NOPROFILE) puts(xcpdCM_getProfile(cm_obj));
If desired, the xcpdcm_sstatus_t enumeration can be returned in the dialog code to check on the result of the function. The following are the enumeration values that can be returned:
XCPDCM_SELECTOR_INVALID_PPD XCPDCM_SELECTOR_USERPROFILE_SET XCPDCM_SELECTOR_SYSTEMPROFILE_SET XCPDCM_SELECTOR_AUTOPROFILE_SET XCPDCM_SELECTOR_CUPSFALLBACK_SET XCPDCM_SELECTOR_OYDEFAULT_SET XCPDCM_SELECTOR_NOPROFILE