KCMS Application Developer's Guide

Example: Using Profiles to Convert Color Data

Figure 2-1 shows how color data is converted between a scanner device and a monitor device.

Figure 2-1 Converting Color Data From a Scanner to a Monitor


In the figure, the devices do not perform their own color correction. Rather, the color data is converted from the form provided by the scanner (Scanner DCP) to a form appropriate for display on the monitor (Monitor DCP). To convert the color data, your application would follow the steps below:

  1. Load the scanner and monitor profiles.

    See "Loading Scanner and Monitor Profiles".

  2. Connect the scanner profile to the monitor profile to get a complete profile.

    See "Connecting Scanner to Monitor Profiles".

  3. Evaluate color data through the complete profile.

    See "Evaluating Color Data Through the Complete Profile".

Example 2-1 shows the sequence of calls that perform this conversion. For more information on the KcsConnectProfiles() function, see "Using Color Space Profiles" and the detailed function description on "KcsConnectProfiles() ".

Example 2-1 Simple Color Data Conversion

/* Load the scanner's DCP.*/
 KcsLoadProfile(&inProfile, &scannerDescription, KcsLoadAllNow);

 /* Load the monitor's DCP. */
 KcsLoadProfile(&outProfile, &monitorDescription, KcsLoadAllNow);

 /* Connect two DCPs to form a CCP */
 profileSequence[0] = inProfile;
 profileSequence[1] = outProfile;
 KcsConnectProfiles(&completeProfile, 2, profileSequence,
 		KcsLoadAllNow, &failedProfileIndex);

 /* Apply the CCP to input color data. */
 KcsEvaluate(completeProfile, KcsOperationForward, &inbufLayout,

Loading Scanner and Monitor Profiles

As shown in Example 2-1, the first color-conversion step is to use the KcsLoadProfile()function. KcsLoadProfile() loads the profile associated with a specific device, effect, partial, or complete profile, and it allocates any system resources the profile requires. For a detailed description of KcsLoadProfile() , see "KcsConnectProfiles() ".

Connecting Scanner to Monitor Profiles

As shown in Example 2-1 and Figure 2-2, the next color-conversion step is to connect a pair of DCPs to form a CCP. KcsConnectProfiles() provides this functionality. Continuing with the example illustrated in Figure 2-1, a CCP is built by connecting the scanner's DCP to the monitor's DCP. The resulting CCP converts scanner data to monitor data.

Figure 2-2 Building a CCP From Two DCPs


Evaluating Color Data Through the Complete Profile

The final color-conversion step is to use the KcsEvaluate() function. KcsEvaluate() applies a color transformation based on the supplied CCP. One of the following operations is associated with the evaluation. These operations are illustrated in Figure 2-3.

Figure 2-3 Profile Load Hint Operations



The forward operation is used to transform color from the scanner form to the monitor form.


The reverse operation is used to transform color from the monitor form to the scanner form. This is useful if your application modifies some colors in monitor space, to keep the greatest number of colors that can be converted back and stored in the scanner's color space.

A more familiar use of the reverse operation is to transform the color from printer to monitor form to see what the data looks like from the printer.


The simulate operation is used to simulate the effect of running color data through a CCP, but retaining it in the form of the last device profile. For example, the simulate operation can produce monitor data that simulates the result of printed data.


The gamut-test operation is used to determine if each color in the source data is within the gamut of the destination device. Physical devices have a range of colors they can produce. This range of colors is known as the gamut of the device.

Using A Callback Function When Evaluating

KcsEvaluate() can take a long time to execute, especially if the input image or graphic contains millions of pixels. Therefore, your application can provide a callback function using KcsSetCallback(), which KcsEvaluate() calls when necessary. The callback function can, for example, provide feedback to request that processing be cancelled. If the callback returns a non-KCS_SUCCESS status, the processing stops.