示例#1
0
/*--------------------------------------------------------------------
 * DESCRIPTION
 *	Return the Tag from the profile.
 *	If the tag is MultiLang return Ascii
 *
 * AUTHOR
 * 	doro
 *
 * DATE CREATED
 *	October 23, 1995
 *------------------------------------------------------------------*/
SpStatus_t KSPAPI SpProfileLoadTag(
    char                   *Filename,
    SpFileProps_t          *Props,
    SpTagId_t               TagId,
    SpTagValue_t            FAR *Value)
{
    SpStatus_t      Status = SpStatSuccess;
    SpTagType_t		TagType;
    SpUnicodeInfo_t	StringInfo;
    KpInt32_t		StringLength;
    KpChar_p		Text;
    KpInt16_t		Language = 0;
    KpInt16_t		Country = 0;

    Status = SpProfileLoadTagEx(Filename, Props,TagId,Value);
    if (SpStatSuccess == Status)
    {
        if (Sp_AT_MultiLanguage == Value->TagType)
        {
            StringInfo = Value->Data.MultiLang.StringInfo[0];
            StringLength = StringInfo.StringLength + 1;
            Text = SpMalloc (StringLength);

            SpTagGetType(SPICCVER23, TagId, &TagType);
            if (Sp_AT_Text == TagType)
            {
                Status = MultiLangToMLString(Value, &Language, &Country,
                                             &StringLength, Text);
                SpFreeMultiLang(&Value->Data.MultiLang);
                Value->TagType = TagType;
                Value->Data.Text = Text;
            }
            else if (Sp_AT_TextDesc == TagType)
            {
                Status = MultiLangToMLString(Value, &Language, &Country,
                                             &StringLength, Text);
                SpFreeMultiLang(&Value->Data.MultiLang);
                Status = SpStringToTextDesc(Text, &Value->Data.TextDesc);
                Value->TagType = TagType;
                SpFree (Text);
            } else {
                SpFree (Text);	/* what's going on? something must be wrong! */
            }
        }
    }
    return (Status);
}
示例#2
0
SpStatus_t KSPAPI SpProfileMakeDeviceLinkEx(SpCallerId_t	callerId,
				   SpDevLinkPB_p	pDevLinkDesc,
				   KpUInt32_t		ProfileVersion,
				   SpProfile_t		FAR *pProfile)
{
 
SpStatus_t	spStatus;
KpInt32_t	eachXform, badXform, LutType;
SpXform_t	*aXform;
KpBool_t	madeXform = KPFALSE;
 
	/*	Create a new empty profile      */
	spStatus = SpProfileCreateEx (callerId, SP_ICC_TYPE_0, ProfileVersion, pProfile);
	if (SpStatSuccess != spStatus) {
		return spStatus;
	}
 
	/*	Fill in the header information  */
	spStatus = SpProfileSetLinkHeader (*pProfile, pDevLinkDesc);
	if (SpStatSuccess != spStatus) {
		SpProfileFree (pProfile);
		return spStatus;
	}
 
	if (pDevLinkDesc->xform == NULL)
	{
		if (pDevLinkDesc->numProfiles < 2)
		{
			SpProfileFree (pProfile);
			return SpStatIncompatibleArguments;
		}

		aXform = SpMalloc(sizeof(SpXform_t) * pDevLinkDesc->numProfiles);

		if (aXform == NULL)
		{
			SpProfileFree (pProfile);
			return SpStatMemory;
		}

		for (eachXform = 0; 
		     eachXform < pDevLinkDesc->numProfiles;
		     eachXform++)
		{
			aXform[eachXform] = NULL;
			spStatus = SpXformGet(
				pDevLinkDesc->pProfileList[eachXform].profile,
				pDevLinkDesc->pProfileList[eachXform].whichRender,
				pDevLinkDesc->pProfileList[eachXform].whichTransform,
				&aXform[eachXform]);

			if ((SpStatSuccess != spStatus) &&
			    (SpStatXformIsPerceptual != spStatus) &&
			    (SpStatXformIsColormetric != spStatus) &&
			    (SpStatXformIsSaturation != spStatus))
			{
				for (eachXform--; eachXform >= 0; eachXform--)
					SpXformFree (&aXform[eachXform]);
				SpFree ((void *) aXform);
				SpProfileFree (pProfile);
				return spStatus;
			}
		}
		spStatus = SpCombineXforms(pDevLinkDesc->numProfiles,
					   aXform, &pDevLinkDesc->xform, 
					   &badXform, NULL, NULL);
		madeXform = KPTRUE;

		for (eachXform = 0; 
		     	    eachXform < pDevLinkDesc->numProfiles;
		     	    eachXform++)
			SpXformFree (&aXform[eachXform]);

		SpFree ((void *) aXform);

		if (SpStatSuccess != spStatus) {
			SpXformFree (&pDevLinkDesc->xform);
			SpProfileFree (pProfile);
			return spStatus;
		}
	}

	/*	Add the transform to the profile        */
	if (ProfileVersion < SPICCVER40)
	{
		LutType = SP_ICC_MFT1;
		if (pDevLinkDesc->lutSize == 16)
			LutType = SP_ICC_MFT2;
	} else
	{
		LutType = SP_ICC_MAB1;
		if (pDevLinkDesc->lutSize == 16)
			LutType = SP_ICC_MAB2;
	}
	spStatus = SpXformSet(	*pProfile,
				LutType,
				SpTransRenderPerceptual,
				SpTransTypeIn,
				pDevLinkDesc->xform);

	/*	Only free the device link transform if it was made by this function	*/
	if (madeXform) {
		SpXformFree (&pDevLinkDesc->xform);
	}

	if (SpStatSuccess != spStatus) {
		SpProfileFree (pProfile);
		return spStatus;
	}

	/*	Add the Profile Description Tag */
	if (ProfileVersion < SPICCVER40)
	{
		spStatus = SpProfileSetLinkDesc(*pProfile, pDevLinkDesc);
	} else
	{
		spStatus = SpProfileSetLinkMLDesc(*pProfile, pDevLinkDesc);
	}
	if (SpStatSuccess != spStatus) {
		SpProfileFree (pProfile);
		return spStatus;
	}

	/*	Add the Profile Sequence Description Tag */
	if (ProfileVersion < SPICCVER40)
	{
		spStatus = SpProfileSetLinkSeqDesc(*pProfile, pDevLinkDesc);
	} else
	{
		spStatus = SpProfileSetLinkMLSeqDesc(*pProfile, pDevLinkDesc);
	}
	if (SpStatSuccess != spStatus) {
		SpProfileFree (pProfile);
		return spStatus;
	}
 
 
	return SpStatSuccess;
} /* SpProfileMakeDeviceLinkEx */