Beispiel #1
0
/*--------------------------------------------------------------------
 * DESCRIPTION
 *	Create a duplicate of an existing transform.
 *
 * AUTHOR
 * 	gbp
 *
 * DATE Modified
 *	25 Jan 99
 *------------------------------------------------------------------*/
SpStatus_t KSPAPI SpXformDuplicate (
				SpXform_t 	srcXform, 
				SpXform_t	FAR *dupXform)
{
	SpStatus_t		Status;
	PTRefNum_t		srcRefNum, dupRefNum;
	PTErr_t			PTStat;

	*dupXform = NULL;

/* Get the PTRefNum for the transform */
	Status = SpXformGetRefNum (srcXform, &srcRefNum);
	if (SpStatSuccess != Status) {
		return Status;
	}

/* duplicate it by using PTCombine */
	PTStat = PTCombine (0, srcRefNum, NULL, &dupRefNum);
	if (KCP_SUCCESS != PTStat) {
		return (SpStatusFromPTErr(PTStat));
	}

/* build an SpXform_t from the RefNum */
	if (SpStatSuccess == Status)
		Status = SpXformFromPTRefNumImp (dupRefNum, dupXform);

/* free PT if SpXform_t not created */
	if (SpStatSuccess != Status)
		PTCheckOut (dupRefNum);

	#if defined KCP_DIAG_LOG
	{KpChar_t	string[256];
	sprintf (string, "\nSpXformFromBufferDT\n *dupXform %x\n",*dupXform);
	kcpDiagLog (string); }
	#endif

	return Status;
}
Beispiel #2
0
PTErr_t
	PTChain (	PTRefNum_t	PTRefNum)
{
chainState_p	cS;
PTErr_t			PTErr, PTErr1;
KpHandle_t		PTData;
PTRefNum_t		PTRefNum1 = NULL, PTRefNum2 = NULL;
KpInt32_t		mode;
fut_p			fut = NULL;
KpChar_t		auxPTName[30];

	PTErr = getChainState (&cS);
	if (PTErr != KCP_SUCCESS)	return PTErr;

	if (cS->chainLength == 0) {
		PTErr = KCP_NO_CHAININIT;
		goto GetOut;
	}
	
	if (cS->chainIndex >= cS->chainLength) {
		PTErr = KCP_EXCESS_PTCHAIN;
		goto GetOut;
	}

	if (cS->chainDef[cS->chainIndex] != PTRefNum) {
		PTErr = KCP_INVAL_PT_SEQ;
		goto GetOut;
	}

	PTErr = PTGetPTInfo (PTRefNum, NULL, NULL, (PTAddr_p*)&PTData);	
	if (PTErr != KCP_PT_ACTIVE) {
		goto GetOut;	
	}

	mode = cS->compMode & PT_COMBINE_TYPE;
	
	if (cS->currentPT == 0) {	/* first PT in chain? */
		KpInt32_t	srcFormat;

		srcFormat = PTGetSrcFormat (PTRefNum);		/* get original format */

		/* we hard coded this rule just for pts and not for profiles */
		if ((srcFormat == PTTYPE_FUTF) && (cS->iComp == KCM_CHAIN_CLASS_CMYK)) {
			if (cS->oComp == KCM_CHAIN_CLASS_MON_RGB) {
				strcpy (auxPTName, "CP10i");
			}
			else {
				strcpy (auxPTName, "CP05");
			}

			PTErr = loadAuxPT (auxPTName, cS->inSense, &PTRefNum1);	/* get the aux PT */
			if (PTErr != KCP_SUCCESS) {
				goto GetOut;
			}

			PTRefNum2 = PTRefNum;
		}
		else {
			PTRefNum1 = PTRefNum;	/* first PT in chain */
			PTRefNum2 = NULL;
		}
	}
	else {
		KpInt32_t	OutSpace, InSpace;

		OutSpace = getIntAttrDef (cS->currentPT, KCM_SPACE_OUT);
		InSpace = getIntAttrDef (PTRefNum, KCM_SPACE_IN);
	
				/* if the color spaces are not the same, and */
		if ((OutSpace != InSpace)  &&
				/* neither color space is unknown, and */
			(OutSpace != KCM_UNKNOWN) && (InSpace != KCM_UNKNOWN) &&
				/* this is a profile composition, then */
			((mode == PT_COMBINE_PF_8) || (mode == PT_COMBINE_PF_16) || (mode == PT_COMBINE_PF)) &&
				/* both color spaces must be ICC PCS */
			(((OutSpace != KCM_CIE_LAB) && (OutSpace != KCM_CIE_XYZ)) ||
			 ((InSpace != KCM_CIE_LAB) && (InSpace != KCM_CIE_XYZ)))) {

			PTErr = KCP_OUTSPACE_INSPACE_ERR;	/* that's not allowed */
			goto GetOut;
		}
					
		PTRefNum1 = cS->currentPT;	/* set up composition */
		PTRefNum2 = PTRefNum;
	}

	/* finally, compose the PTs */
	PTErr = PTCombine (cS->compMode, PTRefNum1, PTRefNum2, &cS->currentPT);

	if (PTRefNum1 != PTRefNum) {
		PTErr1 = PTCheckOut (PTRefNum1);	/* free the internal PT */
		if (PTErr1 != KCP_SUCCESS) {
			PTErr = PTErr1;				/* return actual error */
			goto GetOut;
		}
	}

	if (mode == PT_COMBINE_SERIAL) {
		makeSerial (cS->currentPT);		/* it's a serial PT */
	}

	cS->chainIndex++;		/* next PT */
	
GetOut:
	if (PTErr == KCP_SUCCESS) {
		putChainState (cS);			/* save chain state */
	}
	else {
		clearChain (cS);			/* abort PT chaining */
	}

	return PTErr;
}