XCPD Manual (Part 3a)

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.

Basic Functions

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 );

3 thoughts on “XCPD Manual (Part 3a)

  1. Hi Kai-Uwe.

    I have not finished writing the other parts of the API documentation, but once they’re written, it should make more sense.

    The function ‘xcpdCM_setSpoolPdf()’ will actually handle the PDF rendering part of the workflow. The pre-condition for this function is that a PDF file is loaded into an ‘xcpd_cm_t’ object, and that a profile is loaded as well (via the “profile-selection” process).


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