KCMS Application Developer's Guide

KcsGetAttribute()

KcsStatusId
 KcsGetAttribute(KcsProfileId profile, KcsAttributeName name,
 		KcsAttributeValue *value)

Purpose

Use KcsGetAttribute() to find the value of a particular attribute of the given profile. (See Chapter 5, KCMS Profile Attributes for more information on attributes.)

Arguments

Table 4-11 KcsGetAttribute() Arguments

Argument 

Description  

profile

The identifier of the loaded profile. 

name

The attribute name. See "List of All Attributes" for the names of all the attributes KCMS allows your application to specify in a call to this function.

value

A pointer to the structure to hold the value of the profile's attribute. Your application needs to set the countSupplied field in the value argument. If your application does not set it, the warning KCS_ATTR_LARGE_CT_SUPPLIED or the error KCS_ATTR_CT_ZERO_OR_NEG may be returned.

Returns

Table 4-12 KcsGetAttribute() Return Strings

KCS_SUCCESS

KCS_PROF_ID_BAD

KCS_ATTR_NAME_OUT_OF_RANGE

KCS_ATTR_CT_ZERO_OR_NEG

KCS_ATTR_LARGE_CT_SUPPLIED (warning)

Example


Example 4-5 KcsGetAttribute()

#include "./kcms_utils.h"

 KcsProfileId								profileid;
 KcsAttributeValue								*attrValue;
 int								size;
 void print_header(icHeader *hdr);

 size = sizeof(KcsAttributeBase) + sizeof(icHeader);
 attrValue = (KcsAttributeValue *)malloc(size);

 /* Get the header */
 attrValue->base.type = icSigHeaderType;
 attrValue->base.sizeOfType = sizeof(icHeader);
 attrValue->base.countSupplied = 1;
 KcsGetAttribute(profileid, icSigHeaderTag, attrValue);
 ...
 print_header(&attrValue->val.icHeader);
 ...

 void
 print_header(icHeader *hdr)
 {
 	char			charstring[5];

 	printf("Size in bytes = %d\n", hdr->size);
 	printf("CMM Id = 0x%x\n", hdr->cmmId);
 	printf("Major version number = 0x%x\n", hdr->version>>24);
 	printf("Minor version number = 0x%x\n", (hdr->version&0x00FF0000)>>16);

     switch(hdr->deviceClass) {
     case icSigInputClass :
 			printf("deviceClass = input\n");
 			break;
 	case icSigDisplayClass :
 			printf("deviceClass = display\n");
 			break;
 	case icSigOutputClass :
 			printf("deviceClass = output\n");
 			break;
 	case icSigLinkClass :
 			printf("deviceClass = link\n");
 			break;
 	case icSigAbstractClass :
 			printf("deviceClass = abstract\n");
 			break;
 	case icSigColorSpaceClass :
 			printf("deviceClass = colorspace\n");
 			break;
 	default :
 			printf("Unknown\n");
 			break;
    
 	}

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->colorSpace, 4);
 	printf("colorspace = %s\n", charstring);

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->pcs, 4);
 	printf("profile connection space = %s\n", charstring);

 	printf("date = %d/%d/%d,  ", hdr->date.day,hdr->date.month,
 				hdr->date.year);
     printf("time = %d:%d:%d\n", hdr->date.hours,hdr->date.minutes,
 				hdr->date.seconds);

 	memset(charstring, 0 ,5);
 	memcpy(charstring, &hdr->magic, 4);
 	printf("magic number = %s\n", charstring);

 	switch(hdr->platform) {
 	case icSigMacintosh :
 			printf("platform = Macintosh\n");
 			break;
 	case icSigMicrosoft :
 			printf("platform = Microsoft\n");
 			break;
 	case icSigSolaris :
 			printf("platform = Solaris\n");
 			break;
 	case icSigSGI :
 			printf("platform = SGI\n");
 			break;
 	case icSigTaligent :
 			printf("platform = Taligent\n");
 			break;
 	default :
 			printf("Unknown\n");
 			break;
 	}

     if(hdr->flags && icEmbeddedProfileTrue)
 			printf("Embedded profile.\n");
     else
 			printf("Non-embedded profile\n");

     if(hdr->flags && icUseWithEmbeddedDataOnly)
 			printf("If this profile is embedded, it is not allowed to strip
 						it out and use it independently.\n");
     else
 			printf("OK to strip embedded profile out and use> > # end of Para