XCPD Manual (Part 3d)

The XCPD Color Management API

Profile Selection Overview (Alternate)

This is a continuation of the profile selection explanation of Part 3c.

In the case where a static PPD file does not have options to read in ICC profile mode selection, the XCPD CM API provides an explicit solution that uses xcpdCM_setProfileFromPPD2(). This function requires an additional xcpdcm_selectormode_t enum parameter, which will have been set each time a user selects an ICC selection option directly from the UI.

Its use is demonstrated by the following extension to the previous code tutorial:

QString iccModeString;
QComboBox iccModeComboBox;

xcpd_cm_t* cm_obj = xcpdCM_initialize();
xcpdcm_selectormode_t mode;

ppd_file_t* ppd = ppdOpenFile("ppdfile.ppd");

// ...
// The following is the ICC profile selection segment
// in the UI.
// ...
iccModeString = iccModeComboBox.currentText();

if(iccModeString == "Auto Set")
  mode = XCPDCM_AUTOSELECT_MODE;
else if (iccModeString == "Application Set")
  mode = XCPDCM_SYSTEMSELECT_MODE;
// In this case, we must explicitly set a profile into XCPDCM.
else if (iccModeString == "Manual") {
  mode = XCPDCM_USERSELECT_MODE; 
  QString userSelection = QFileDialog::getOpenFileName( ... );
  const char* user_profile = userSelection.toLocal8Bit();

  xcpdCM_setProfile(user_profile, cm_obj);  
}
// ...
// The last segment of the code will call a refresh
// of the profile settings based on ICC mode...
// ...
xcpdcm_sstatus_result = xcpdCM_setProfileFromPPD2(cm_obj,
                                                     ppd,                                                                               
                                                    mode);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s