KCMS Application Developer's Guide

Advanced Profile Operations Using the KCMS API

This section discusses advanced profile topics.

Operation Hints

KcsEvaluate() takes an additional argument that describes the operation to be performed on the profile. This argument is an operation hint. For example, your application can tell KcsEvaluate() to convert data in the forward direction (KcsOpForward), such as from the scanner to the printer. Data also can be converted in the reverse direction, such as from the monitor to the scanner. The reverse operation (KcsOpReverse), when it is available in a profile, inverts the function performed by KcsOpForward. However, KcsEvaluate()rarely performs an exact inverse, because information is lost when color data is transformed. In other words, if your application performs a KcsOpForward and then a KcsOpReverse of a profile on the same buffer, the result is almost equivalent to what it started with before KcsOpForward. Some quality may be lost.

Only one of these operation hint bits can be set at a time for KcsEvaluate(), unlike general load hints for which any combination can be set at the same time. As part of the KcsLoadHints data type, the operation hints signify the required set of operations available to use with the profile. By contrast, KcsEvaluate() uses only the single operation that the application wants to perform.

See "Operation Hint Constants" for more information on operation hints.

Content Hints

Your application can also specify hints about the content of the data being processed. Consider, for example, a photographic image data or computer-generated graphic image data. A CMM can use these hints to do a better job of converting the data such as adjusting the gamut-mapping technique.

See "Content Hint Constants" for more information on content hints.

Freeing Profiles

After creating a complete color profile (CCP), your application can use it more than once. For example, it can use the CCP to convert images page-by-page during printing and to process individual rasters or tiles in a large image. When your application no longer needs the profile, it can call K()csFreeProfile() to free the profile's resources. The profiles in the profile sequence used to create a CCP can be freed without affecting the CCP.

Managing Profile Memory

The KCMS API expects the application to allocate memory required for the data returned by the KCMS framework. In general, the application allocates a C structure and passes a pointer to that structure into the KCMS framework.

The one exception to this is the profile. The KCMS framework returns and accepts a profile Id only. Your application must manage the memory allocated for the Id. To inform the KCMS framework that it should release the memory associated with the profile Id, your application must call the KcsFreeProfile()function.

Optimizing Profiles

Once a color profile has been loaded, a CMM may be able to optimize it. Using the KcsOptimizeProfile()function, your application can optimize a profile (an individual profile or a CCP) in two ways:

Because optimization can take a long time, your application can provide a callback similar to the one used with KcsEvaluate().

After your application optimizes a profile, it must call KcsSaveProfile() to save the profile for future use. Then it can use this profile with KcsLoadProfile() to avoid the slow performance of KcsOptimizeProfile().

Saving an optimized profile has some potential implications. The optimization may indirectly affect future operations on the profile. For example, if the profile is optimized for size, portions of the profile needed only for highest accuracy may be discarded, resulting in compromised accuracy.

Characterizing and Calibrating Profiles

Characterization establishes a norm for a particular device across a range of samples of the device. This form of profile is typically supplied by a profile vendor. To obtain an optimally accurate DCP for a particular device, calibration is required.

Calibration makes measurements of an individual device and applies them to the base DCP. This causes the updated DCP to represent the actual color device the customer is using.

The KCMS API provides two API functions, KcsCreateProfile() and KcsUpdateProfile(), to create new blank profiles and then to update them with characterization data or calibration data.

The first step your application should take in building a new profile is to create an empty profile using KcsCreateProfile(). Then it can fill the empty profile with KcsSetAttribute() to describe the device being characterized. For example, it can supply monitor chromaticities and white-point values. Measurement data is required for KcsUpdateProfile() to complete the creation of the new profile. Once updated, your application should save the profile with KcsSaveProfile() to the desired KcsProfileDesc location.

Updating profiles typically is a CMM-dependent operation. Using measurement data at the KCMS framework interface level frees you from details of the profile format and the process by which the CMM turns the measurement data into its methodology for color manipulation.

The default CMM supports characterization and calibration of monitors and scanners.