KCMS Application Developer's Guide

In This Chapter

This chapter discusses attributes (or tags). Every profile contains a group of attributes that describe the characteristics of that profile. Attributes are specified by name, value, and status (whether they are required or optional).

Note -

In this guide, you will encounter the terms attribute and tag. These terms are identical. The text in this guide uses the term attribute instead of tag, (but code examples and header files may use tag because the ICC specification and the icc.h header file use this term). Attribute is a KCMS-specific term that existed before the ICC-term tag came into use.

The ICC specification and icc.h define most attributes. KCMS includes a few additional KCMS CMM-specific attributes, which are registered with the ICC for public use and are defined in the kcstypes.h header file.

Several KCMS API functions create and modify attributes. Some functions define what is stored in an attribute. See Chapter 4, Functions, for detailed descriptions of all the API functions.

Using the Attribute Name

The header file icc.h defines an attribute with the enumerated constant, icTagSignature. icTagSignature is the list of all attribute names in the ICC profile format specification. Note that some of these attributes cannot be used by your application, and there are additional ones that can be used. See "List of All Attributes" for a complete list of all attribute by name that KCMS allows your application to use as arguments in calls to the API functions KcsGetAttribute() and KcsSetAttribute().

Interpreting the Attribute Value

An attribute value is defined in the val field of the KcsAttributeValue data structure (see "KcsAttributeValue "). Since there are many possible data types for val, you need some way of interpreting the value as the correct data type. The KcsAttributeType data type provides this interface (see "KcsAttributeType ").

Required and Optional Attributes

Attributes are either required or optional for all profiles. The color management module (CMM) software that creates a profile must assign required attributes.

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.


#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.


#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.


#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) {

 /* 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 : ");

 /* 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) {
 	free (attrPtr);

 /* 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));

 free (attrPtr);