Exemplo n.º 1
0
/* use PTRefNum1 and PTRefNum2 to propagate attributes to PTRefNumR */
PTErr_t ComposeAttr(PTRefNum_t	PTRefNum1,
					PTRefNum_t	PTRefNum2,
					KpInt32_t	mode,
					PTRefNum_t	PTRefNumR)
{
PTErr_t		PTErr;
KpInt32_t	inspace, outspace;

	/* get output color space of 1st PT */
	PTErr = getIntAttr (PTRefNum1, KCM_SPACE_OUT, KCP_NO_MAX_INTATTR, &outspace);
	if (PTErr == KCP_SUCCESS) {

		/* get input color space of 2nd PT */
		PTErr = getIntAttr (PTRefNum2, KCM_SPACE_IN, KCP_NO_MAX_INTATTR, &inspace);
		if (PTErr == KCP_SUCCESS) {
			if ((outspace == KCM_UNKNOWN) && (inspace != KCM_UNKNOWN)) {
				PTErr = copyAllAttr (PTRefNum2, PTRefNumR);
				return (PTErr);
			}

			if ((outspace != KCM_UNKNOWN) && (inspace == KCM_UNKNOWN)) {
				PTErr = copyAllAttr (PTRefNum1, PTRefNumR);
				return (PTErr);
			}
		}
	}

/* propagate "input" attributes */
	PTErr = moveAttrList (PTRefNum1, 0, propRule02, 0, PTRefNumR);

/* propagate "output" attributes */
	if (PTErr == KCP_SUCCESS)
		PTErr = moveAttrList (PTRefNum2, 0, propRule03, 0, PTRefNumR);

/* generate "constant" attributes */
	if (PTErr == KCP_SUCCESS)
		PTErr = generateAttr (PTRefNumR);

/* if composition mode is input set input attribute to "is linearized" */
	if ((PTErr == KCP_SUCCESS) && (mode == PT_COMBINE_ITBL))
		PTErr = setLinearized (PTRefNumR, KCM_DEVICE_LINEARIZED_IN);

/* if composition mode is output set output attribute to "is linearized" */
	if ((PTErr == KCP_SUCCESS) && (mode == PT_COMBINE_OTBL))
		PTErr = setLinearized (PTRefNumR, KCM_DEVICE_LINEARIZED_OUT);

/* Set KCM_EFFECT_TYPE attribute */
	if (PTErr == KCP_SUCCESS)
		PTErr = setEFFECTstate (PTRefNum1, PTRefNum2, PTRefNumR);

/* propagate "input" attributes, 2nd PT is backup */
	if (PTErr == KCP_SUCCESS)
		PTErr = moveAttrList (PTRefNum1, PTRefNum2, propRule11, 0, PTRefNumR);

/* propagate "simulate" attributes */
	if (PTErr == KCP_SUCCESS)
		PTErr = moveAttrList (PTRefNum2, PTRefNum1, propRule13, 1, PTRefNumR);

	return (PTErr);
}
Exemplo n.º 2
0
/* use PTRefNum1 and PTRefNum2 to propagate attributes to PTRefNumR */
PTErr_t ComposeAttrFut(	PTRefNum_t PTRefNum1,
						PTRefNum_t PTRefNum2,
						PTRefNum_t PTRefNumR)
{
PTErr_t	errnum = KCP_SUCCESS;
KpInt8_t	strInSpace[KCM_MAX_ATTRIB_VALUE_LENGTH+1];
KpInt8_t	strOutSpace[KCM_MAX_ATTRIB_VALUE_LENGTH+1];
KpInt32_t	inspace, outspace, attrSize;

	/* get 1st PT */
	attrSize = KCM_MAX_ATTRIB_VALUE_LENGTH;
	errnum = PTGetAttribute(PTRefNum1, KCM_SPACE_OUT, &attrSize, strOutSpace);
	if (errnum == KCP_SUCCESS) {
		outspace = KpAtoi(strOutSpace);

		/* get 2nd PT */
		attrSize = KCM_MAX_ATTRIB_VALUE_LENGTH;
		errnum = PTGetAttribute(PTRefNum2, KCM_SPACE_IN, &attrSize, strInSpace);

		if (errnum == KCP_SUCCESS) {
			inspace = KpAtoi(strInSpace);

			if ((outspace == KCM_UNKNOWN) && (inspace != KCM_UNKNOWN)) {
				errnum = moveAttrList (PTRefNum2, 0, propIAttrF, 0, PTRefNumR);
				if (errnum == KCP_SUCCESS) {		
					errnum = moveAttrList (PTRefNum2, 0, propOAttrF, 0, PTRefNumR);
				}
				return (errnum);
			}
			else {
				if ((outspace != KCM_UNKNOWN) && (inspace == KCM_UNKNOWN)) {
					errnum = moveAttrList (PTRefNum1, 0, propIAttrF, 0, PTRefNumR);
					if (errnum == KCP_SUCCESS) {		
						errnum = moveAttrList (PTRefNum1, 0, propOAttrF, 0, PTRefNumR);
					}
					return (errnum);
				}
			}
		}
	}

	errnum = moveAttrList (PTRefNum1, 0, propIAttrF, 0, PTRefNumR);	/* propagate "input" attributes */
	
	if (errnum == KCP_SUCCESS) {
		errnum = moveAttrList (PTRefNum2, 0, propOAttrF, 0, PTRefNumR);	/* propagate "output" attributes */
	}

	return (errnum);
}