KCMS Application Developer's Guide

Names of CMM-Specific Attributes

The following CMM-specific attribute names are never stored in a profile. They are used to access portions of an ICC profile that are not covered by ICC attributes (listed in the ICC profile format specification).

These attributes are not defined in the ICC profile format specification. Instead, they are defined in the kcstypes.h header file. KCMS registered these attributes with the ICC so that they are available for public use.

icSigHeaderTag

#define icSigHeaderTag (0x69636864UL) /* `ichd' */

This attribute is associated with the icHeader data structure and is an ICC header. See "icHeader " for the format of icHeader. The header file contains useful attribute information.

icSigNumTag

#define icSigNumTag (0x6E746167UL) /* `ntag' */

This attribute name is associated with a data structure that returns a KcsULong value indicating the number of ICC profile attributes in a file. This is a read-only attribute: it cannot be set. The count includes the icSigHeaderTag, icSigNumTag and icSigListTag entries.

icSigListTag

#define icSigListTag (0x6C746167UL) /* `ltag' */

This attribute name is associated with the icTagList data structure, which is a list of the ICC attributes in a profile. See "icTagList "for the format of icTagList.

Example: Using icSigNumTag and icSigListTag

Example 5-1shows you how to use icSigNumTag and icSigListTag.


Example 5-1 icSigNumTag and icSigListTag

#include <kcms/kcs.h>
 KcsAttributeValue					attrValue, *attrPtr;
 int					i;
 char					*tmp;

 /* Set the value of countSupplied */
 attrValue.base.countSupplied = 1;
 attrValue.base.type = KcsULong;

 /* Get the number of attributes in the profile */
 status = KcsGetAttribute(profile, icSigNumTag, &attrValue);
 if (status != KCS_SUCCESS) {
 	KcsFreeProfile(profile);
 	exit(1);
 }

 /* Make space to get a list of all tags */
 size = sizeof(KcsAttributeBase) + sizeof(long)*attrValue.val.uLongVal[0];
 if ((attrPtr = (KcsAttributeValue *)malloc(size)) == NULL) {
 	perror("malloc failed : ");
 	KcsFreeProfile(profile);
 	exit(1);
 }

 /* Get the list of tags */
 attrPtr->base.type = KcsULong;
 attrPtr->base.sizeOfType = sizeof(long);
 attrPtr->base.countSupplied = attrValue.val.uLongVal[0];
 status = KcsGetAttribute(profile, icSigListTag, attrPtr);
 if (status != KCS_SUCCESS) {
 	KcsFreeProfile(profile);
 	free (attrPtr);
 	exit(1);
 }

 /* Print the list */
 printf("Number of tags = %d\n", attrPtr->base.countSupplied);
 for (i=0; i<attrPtr->base.countSupplied; i++) {
 	tmp = (char *)&attrPtr->val.uLongVal[i];
 	printf("Tag # = %d, Tag Hex = 0x%x, Tag Ascii = %c%c%c%c\n", i,
 		attrPtr->val.uLongVal[i]; *tmp, *(tmp+1), *(tmp+2), *(tmp+3));
 }

 KcsFreeProfile(profile);
 free (attrPtr);