Пример #1
0
/***************************************************************************
 * FUNCTION NAME
 *      SpProfileCreateSeqRecord
 *
 * DESCRIPTION
 *      This function creates the Profile Sequence record for the
 * profile pointed to by pProfile.  The Profile Sequence record to 
 * build is pointed to by pSeqRecord.
 *
***************************************************************************/
SpStatus_t SpProfileCreateSeqRecord(SpProfile_t		pProfile,
			SpProfileSeqDescRecord_t	*pSeqRecord)
{
SpHeader_t	header;
SpTagValue_t	tagValue;
SpStatus_t	spStatus;

	/* Get the profiles header */
	spStatus = SpProfileGetHeader (pProfile, &header);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
 
	/* Copy the manufacturer, model, attributes and technology
	   fields into the sequence record */
	pSeqRecord->DeviceManufacturer = header.DeviceManufacturer;
	pSeqRecord->DeviceModel = header.DeviceModel;
	pSeqRecord->DeviceAttributes.hi = header.DeviceAttributes.hi;
	pSeqRecord->DeviceAttributes.lo = header.DeviceAttributes.lo;

	/* Get the technology tag*/
	spStatus = SpTagGetById(pProfile, 
				SpTagTechnology,
				&tagValue);
	if (SpStatSuccess != spStatus) 
		pSeqRecord->Technology = SpSigNone;
	else 
		pSeqRecord->Technology = tagValue.Data.Signature;

	/* Get the manufacturer description */
	spStatus = SpTagGetById(pProfile, 
				SpTagDeviceMfgDesc,
				&tagValue);
	if (SpStatSuccess != spStatus) {
		spStatus = SpStringToTextDesc("", &tagValue.Data.TextDesc);
		if (SpStatSuccess != spStatus) {
			return spStatus;
		}
	}
	pSeqRecord->DeviceManufacturerDesc = tagValue.Data.TextDesc;

	/* Get the model description */
	spStatus = SpTagGetById(pProfile, 
				SpTagDeviceModelDesc,
				&tagValue);
	if (SpStatSuccess != spStatus) {
		spStatus = SpStringToTextDesc("", &tagValue.Data.TextDesc);
		if (SpStatSuccess != spStatus) {
			return spStatus;
		}
	}
	pSeqRecord->DeviceModelDesc = tagValue.Data.TextDesc;

	return SpStatSuccess;
} /* SpProfileCreateSeqRecord */
Пример #2
0
/*--------------------------------------------------------------------
 * DESCRIPTION
 *	Generate Colorant and Response Curve tags for the specified
 *	Xform data.  This data is assumed to be a PT.
 *
 * AUTHOR
 * 	lsh
 *
 * DATE CREATED
 *	April 15, 1994
 *------------------------------------------------------------------*/
SpStatus_t KSPAPI SpXformCreateMatTags (
				SpProfile_t		Profile,
				KpInt32_t		DataSize,
				KpLargeBuffer_t	Data)
{
	SpStatus_t		Status;
	PTRefNum_t		RefNum;
	SpHeader_t		Hdr;
	KpInt32_t		SpDataType;

	Status = SpProfileGetHeader (Profile, &Hdr);
	if (SpStatSuccess != Status)
		return Status;

	if ((Hdr.Originator == SpSigOrgKodak1_Ver_0) ||
	    (Hdr.Originator == SpSigOrgKodak2_Ver_0)) {
		SpDataType = KCM_ICC_TYPE_0;
	}
	else {
		SpDataType = KCM_ICC_TYPE_1;
	}

	#if defined KCP_DIAG_LOG
	{KpChar_t	string[256];
	sprintf (string, "\nSpXformCreateMatTags\n Profile %x, DataSize %d, Data %x\n", Profile, DataSize, Data);
	kcpDiagLog (string); }
	#endif

	Status = SpXformLoadImp (Data, DataSize, 
			SpDataType, Hdr.DataColorSpace, Hdr.InterchangeColorSpace, &RefNum);

	if (SpStatSuccess != Status)
		return Status;

	Status = SpXformCreateMatTagsFromPT (Profile, RefNum);

	PTCheckOut (RefNum);

	return Status;
}
Пример #3
0
/***************************************************************************
 * FUNCTION NAME
 *      SpProfileCreateMLSeqRecord
 *
 * DESCRIPTION
 *      This function creates the Profile Sequence record for the
 * profile pointed to by pProfile.  The Profile Sequence record to 
 * build is pointed to by pSeqRecord.
 *
***************************************************************************/
SpStatus_t SpProfileCreateMLSeqRecord(SpProfile_t		pProfile,
			SpProfileSeqDescRecord2_t	*pSeqRecord)
{
SpHeader_t	header;
SpTagValue_t	tagValue;
SpStatus_t	spStatus;
KpChar_p	CString;
KpInt32_t	BufSize;

	/* Get the profiles header */
	spStatus = SpProfileGetHeader (pProfile, &header);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
 
	/* Copy the manufacturer, model, attributes and technology
	   fields into the sequence record */
	pSeqRecord->DeviceManufacturer = header.DeviceManufacturer;
	pSeqRecord->DeviceModel = header.DeviceModel;
	pSeqRecord->DeviceAttributes.hi = header.DeviceAttributes.hi;
	pSeqRecord->DeviceAttributes.lo = header.DeviceAttributes.lo;

	/* Get the technology tag*/
	spStatus = SpTagGetById(pProfile, 
				SpTagTechnology,
				&tagValue);
	if (SpStatSuccess != spStatus) 
		pSeqRecord->Technology = SpSigNone;
	else 
	{
		pSeqRecord->Technology = tagValue.Data.Signature;
		SpTagFree(&tagValue);
	}

	/* Get the manufacturer description */
	spStatus = SpTagGetById(pProfile, 
				SpTagDeviceMfgDesc,
				&tagValue);
	if (SpStatSuccess != spStatus) {
		spStatus = SpStringToMultiLang("", SpEnglish, SpUSA, &tagValue.Data.MultiLang);
		if (SpStatSuccess != spStatus) {
			return spStatus;
		}
	} else if (tagValue.TagType == Sp_AT_TextDesc)
	{
		BufSize = strlen(tagValue.Data.TextDesc.IsoStr) + 1;
		CString = (char *) allocBufferPtr (BufSize);
		spStatus = SpTagGetString(&tagValue, &BufSize, CString);
		SpTagFree(&tagValue);
		spStatus = SpStringToMultiLang(CString, SpEnglish, SpUSA, &tagValue.Data.MultiLang);
		freeBufferPtr(CString);
		if (SpStatSuccess != spStatus) 
			return spStatus;
	}

	pSeqRecord->DeviceManufacturerDesc.TagType = SpTypeMultiLanguage;
	pSeqRecord->DeviceManufacturerDesc.Reserved = 0;
	pSeqRecord->DeviceManufacturerDesc.MLDesc = tagValue.Data.MultiLang;

	/* Get the model description */
	spStatus = SpTagGetById(pProfile, 
				SpTagDeviceModelDesc,
				&tagValue);
	if (SpStatSuccess != spStatus) {
		spStatus = SpStringToMultiLang("", SpEnglish, SpUSA, &tagValue.Data.MultiLang);
		if (SpStatSuccess != spStatus) {
			return spStatus;
		}
	} else if (tagValue.TagType == Sp_AT_TextDesc)
	{
		BufSize = strlen(tagValue.Data.TextDesc.IsoStr) + 1;
		CString = (char *) allocBufferPtr (BufSize+1);
		spStatus = SpTagGetString(&tagValue, &BufSize, CString);
		SpTagFree(&tagValue);
		spStatus = SpStringToMultiLang(CString, SpEnglish, SpUSA, &tagValue.Data.MultiLang);
		freeBufferPtr(CString);
		if (SpStatSuccess != spStatus) 
			return spStatus;
	}

	pSeqRecord->DeviceModelDesc.TagType = SpTypeMultiLanguage;
	pSeqRecord->DeviceModelDesc.Reserved = 0;
	pSeqRecord->DeviceModelDesc.MLDesc = tagValue.Data.MultiLang;

	return SpStatSuccess;
} /* SpProfileCreateMLSeqRecord */
Пример #4
0
/***************************************************************************
 * FUNCTION NAME
 *      SpProfileSetLinkHeader
 *
 * DESCRIPTION
 *      This function sets the fields of the header of the device link
 * profile pointed to by pProfile.
 *

***************************************************************************/
SpStatus_t SpProfileSetLinkHeader(SpProfile_t	pProfile,
				  SpDevLinkPB_p	pDevLinkDesc)
{
SpHeader_t		header, tempHeader;
SpProfListEntry_p	pCurProfEntry;
SpStatus_t		spStatus;

	/*	Get the header from the profile */
	spStatus = SpProfileGetHeader(pProfile, &header);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
 
	/*	Set the class information to device link */
	header.DeviceClass = SpProfileClassLink;

	/* Set the device color spaces from the first profile
	   in the list */
	pCurProfEntry = pDevLinkDesc->pProfileList;
	spStatus = SpProfileGetHeader (pCurProfEntry->profile,
					&tempHeader);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
	if (SpTransTypeIn == pCurProfEntry->whichTransform) {
		header.DataColorSpace = 
			tempHeader.DataColorSpace;
	}
	else {
		header.DataColorSpace = 
			tempHeader.InterchangeColorSpace;
	}

	/* Set the connection color spaces from the last
	   profile in the list */
	pCurProfEntry = pDevLinkDesc->pProfileList +
				(pDevLinkDesc->numProfiles - 1);
	spStatus = SpProfileGetHeader(pCurProfEntry->profile,
					&tempHeader);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
	if (SpTransTypeOut == pCurProfEntry->whichTransform) {
		header.InterchangeColorSpace = 
			tempHeader.DataColorSpace;
	} else {
		header.InterchangeColorSpace = 
			tempHeader.InterchangeColorSpace;
	}

	/* Set the Device Manufacturer to "KODK" 
	   and the Device Model to "unkn" */
	header.DeviceManufacturer = SpSigMfgKodak;
	header.DeviceModel = SpSigNone;
	header.Originator  = SpSigOrgKodak;

	/*	Write the updated header back to the profile */
	spStatus = SpProfileSetHeader(pProfile, &header);

	return spStatus;
 
} /* SpProfileSetLinkHeader */
Пример #5
0
/*--------------------------------------------------------------------
 * DESCRIPTION
 *	Order the list of profiles by newest creation date
 *
 * AUTHOR
 * 	doro
 *
 * DATE CREATED
 *	December 15, 1995
 *------------------------------------------------------------------*/
SpStatus_t KSPAPI SpProfileOrderList(
			SpProfile_t	*profileList,
			KpInt32_t	foundCount)
{
   KpInt32_t	Date, *DateList;
   KpInt32_t	Time, *TimeList;
   SpHeader_t	PfHeader;
   KpHandle_t	DateHandle, TimeHandle;
   int		i, j, z;
   SpStatus_t	Status;
   SpProfile_t	profileToMove;

   if (foundCount < 2)
      return SpStatSuccess;

   if ((DateHandle = allocBufferHandle(foundCount*sizeof(KpInt32_t))) ==
       (KpHandle_t)NULL)
      return SpStatMemory;

   if ((DateList = (KpInt32_t *)lockBuffer(DateHandle)) ==
       (KpInt32_t *)NULL)
   {
      freeBuffer(DateHandle);
      return SpStatBadBuffer;
   }

   if ((TimeHandle = allocBufferHandle(foundCount*sizeof(KpInt32_t))) ==
       (KpHandle_t)NULL)
   {
      freeBuffer(DateHandle);
      return SpStatMemory;
   }
   if ((TimeList = (KpInt32_t *)lockBuffer(TimeHandle)) ==
       (KpInt32_t *)NULL)
   {
      freeBuffer(DateHandle);
      freeBuffer(TimeHandle);
      return SpStatBadBuffer;
   }

   Status = SpProfileGetHeader (profileList[0], &PfHeader);
   Date = 366*PfHeader.DateTime.Year +
           31*PfHeader.DateTime.Month +
              PfHeader.DateTime.Day;
   Time = 3600*PfHeader.DateTime.Hour +
            60*PfHeader.DateTime.Minute +
               PfHeader.DateTime.Second;

   /* Save First Profile's date */
   DateList[0] = Date;
   TimeList[0] = Time;
 
   for (i = 1; i < foundCount; i++)
   {
      /* Get testable version of Time and Date */
      Status = SpProfileGetHeader (profileList[i], &PfHeader);
      Date = 366*PfHeader.DateTime.Year +
              31*PfHeader.DateTime.Month +
                 PfHeader.DateTime.Day;
      Time = 3600*PfHeader.DateTime.Hour +
               60*PfHeader.DateTime.Minute +
                  PfHeader.DateTime.Second;
 
      /* Save in case no move required */
      DateList[i] = Date;
      TimeList[i] = Time;
 
      /* Loop thru those before */
      for (j = 0; j < i; j++)
      {
         /* Test for created before a previous entry */
         if ((Date  > DateList[j]) ||
            ((Date == DateList[j]) && (Time > TimeList[j])))
         {
            /* Save the profile o finterest */
            profileToMove = profileList[i];
            /* Move the older profiles back */
            for (z = i; z > j; z--)
            {
               DateList[z]    = DateList[z-1];
               TimeList[z]    = TimeList[z-1];
               profileList[z] = profileList[z-1];
            }
            /* Put the Profile of interest into its spot */
            DateList[j]    = Date;
            TimeList[j]    = Time;
            profileList[j] = profileToMove;
            /* Check the next one on the complete list (i) */
            break;
         }
      }
   }
 
   freeBuffer(DateHandle);
   freeBuffer(TimeHandle);
   return SpStatSuccess;
}