The XCPD Color Management API
(The following is a draft of the API documentation. This is part 1.)
The XCPD CM API is a small, internal API that will bridge the print dialog and the XCPD Color Management layer. It was created for hiding the color management details from the dialog code, and freeing the dialog programmer from concerns over the color management process.
While initially coded for the XCPD, the XCPD CM API is itself a prototype for a more ‘generic’ interface that can be used to attach color management to *any* print dialog.
An XCPD CM object is used to help carry out printer color management throughout the XCPD. This ‘xcpd_cm_t‘ object will hold and transport the necessary color management data throughout the print workflow. More specifically, the object should be used during, and in this order, the “profile selection” and “pdf rendering” stages of the workflow.
The XCPD CM object can be initialized by way of the following:
xcpd_cm_t* cm_obj = xcpdCM_initialize();
All functions in the API are prefixed with “xcpdCM_”, followed by the function name (in this case, the function name is ‘initialize‘).
An important use of the XCPD CM object is in keeping track of the PDF and ICC profile files throughout the workflow. These can explicitly be set in the object using the ‘setProfile‘ and ‘setPdfFile‘ functions:
int error = 0; error = xcpdCM_setProfile("sRGB.icc", cm_obj); error = xcpdCM_setPdfFile("myPdf.pdf", cm_obj);
File name strings are passed in the first argument, while the second argument requires passing in an XCPD CM object pointer. As used here and in many of the XCPD CM API functions, error values are returned with ‘0’ (for a successful operation) or ‘1’ (unsuccessful operation).
Getting the file string values require using the ‘getProfile‘ and ‘getPdfFile‘ functions:
char* profile_string = xcpdCM_getProfile(cm_obj); char* pdf_string = xcpdCM_getPdfFile(cm_obj);
To close and free memory in an XCPD CM instance, use the ‘close‘ function:
xcpdCM_close( cm_obj );