KCMS Application Developer's Guide

KcsConnectProfiles()

KcsStatusId
 KcsConnectProfiles(KcsProfileId *resultProfileId,
 		unsigned long profileCount,
 		KcsProfileId *profileSequence,
 		KcsOperationType operationLoadSet,
 		unsigned long *failedProfileIndex)

Purpose

Use KcsConnectProfiles() to combine several existing profiles into a new complete profile, or to restrict the functionality of a single existing profile to make it more efficient.

If KcsConnectProfiles() returns successfully, it generates a new profile from the sequence of existing profiles. The reference (profile Id) to this new profile is stored in the resultProfileId argument. With this reference, you can free the resources of the existing profiles in profileSequence if they are no longer required. Use KcsFreeProfile() to release the resources.


Note -

If you have minimized a profile's load operation or state with operationLoadSet or with KcsOptimizeProfile() ("KcsOptimizeProfile()"), only that load operation or state is saved with KcsSaveProfile(). Therefore, operations not included in the profile are not available the next time the profile is loaded.


If the last profile in a sequence to be connected includes a gamut transform, the operation hint KcsOpGamutTest (see "Operation Hint Constants") may be requested for that profile. The result of KcsEvaluate() with this gamut hint is a bit map image that contains 1 bit for each pixel in the original image. In the bit map, 0 means the color is in the gamut of the device requested by the final profile, and FF means the color is out of gamut (that is, the color cannot be represented by the device).

Arguments

Table 4-3 KcsConnectProfiles() Arguments

Argument 

Description 

resultProfileId

The identifier of the profile returned if this function executes successfully.  

profileCount

The number of profiles to be connected. 

profileSequence

An array of the Ids of the profiles to be connected. 

operationLoadSet

One or more flags symbolizing the kind of information in the resultant profile. It also describes what, how, when, and where to load and unload the resulting resultProfileId. See "KcsLoadHints " for more information.

failedProfileIndex

KcsConnectProfiles() returns an integer in failedProfileIndex. This value has meaning only when KcsConnectProfiles() returns a value other than KCS_SUCCESS. If the function fails, this index helps you identify which input profile caused the failure. If the index = 0, the first profile in profileSequence failed; if index = 1, the second profile in profileSequence failed, and so on. A common problem when making the resultant profile is that the profiles specified in profileSequence could not be connected. In this case, the index returns an integer symbolizing the latter profile in a failed connection pair. For example, if the first profile and second profile in the sequence were mismatched, the index contains 1 (for the second profile).

Returns

Table 4-4 KcsConnectProfiles() Return Strings

KCS_SUCCESS

KCS_PROF_ID_BAD

KCS_MEM_ALLOC_ERROR

KCS_CONNECT_PRECISION_UNACCEPTABLE

KCS_MISMATCHED_COLORSPACES

KCS_CONNECT_OPT_FORCED_DATA_LOSS

Example


Example 4-1 KcsConnectProfiles()

KcsProfileDesc				scannerDesc, monitorDesc, completeDesc;
 KcsProfileId				scannerProfile, monitorProfile;
 KcsProfileId				profileSequence[2], completeProfile;
 KcsStatusId				status;
 KcsErrDesc 				errDesc;
 u_long				failedProfileNum;
 KcsOperationType=(KcsOpForward+KcsContImage);
 /*file names input a program arguments */

 scannerDesc.type = KcsSolarisProfile;
 scannerDesc.desc.solarisFile.fileName = argv[1];
 scannerDesc.desc.solarisFile.hostName = NULL;
 scannerDesc.desc.solarisFile.oflag = O_RDONLY;
 scannerDesc.desc.solarisFile.mode = 0;
 
 monitorDesc.type = KcsSolarisProfile;
 monitorDesc.desc.solarisFile.fileName = argv[2];
 monitorDesc.desc.solarisFile.hostName = NULL;
 monitorDesc.desc.solarisFile.oflag = O_RDONLY;
 monitorDesc.desc.solarisFile.mode = 0;

 status = KcsLoadProfile(&scannerProfile, &scannerDesc, KcsLoadAllNow);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("Scanner LoadProfile error: %s\n", errDesc.desc);
 	exit(1);
 }

 status = KcsLoadProfile(&monitorProfile, &monitorDesc, KcsLoadAllNow);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("Monitor LoadProfile error: %s\n", errDesc.desc);
 	exit(1);
 }

 /* See if we can combine them */
 profileSequence[0] = scannerProfile;
 profileSequence[1] = monitorProfile;

 status = KcsConnectProfiles(&completeProfile, 2, profileSequence, op,
 		&failedProfileNum);

 if(status != KCS_SUCCESS) {
 	KcsGetLastError(&errDesc);
 	printf("ConnectProfile error: %s\n", errDesc.desc);
 	fprintf(stderr, "Failed in profile number %d\n", failedProfileNum);
 	exit(1);
 }