KCMS CMM Developer's Guide

Getting an Attribute

When getting an attribute, the KcsProfile object in the array passes the getting of the attribute to the KcsAttributeSet object contained in its KcsProfileFormat object (replacing set with get). This is illustrated in Figure 3-2 and in the KCMS API code excerpt shown in Example 3-8 .


Example 3-8 Getting an Attribute

/* Get the colorants */

/* icfixed2double converts signed 15.16 fixed point number to a double   *

float */ /*Red */ attrValuePtr = (KcsAttributeValue *)

malloc(sizeof(KcsAttributeBase) +  	sizeof(icXYZNumber));

attrValuePtr->base.type = icSigXYZArrayType;

attrValuePtr->base.countSupplied = 1; status = KcsGetAttribute(profileid,

icSigRedColorantTag, attrValuePtr); if (status != KCS_SUCCESS) { 	status =

KcsGetLastError(&errDesc); 	printf("GetAttribute error: $s\n",

errDesc.desc); 	KcsFreeProfile(profileid); 	exit(1); }  XYZval = (icXYZNumber

*)attrValuePtr->val.icXYZ.data; printf("Red X=%f Y=%f Z=%f\n", 

		icfixed2double(XYZval->X, icSigS15Fixed16ArrayType), 

		icfixed2double(XYZval->Y, icSigS15Fixed16ArrayType),     

icfixed2double(XYZval->Z, icSigS15Fixed16ArrayType),