/* 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); }
/* gridDimValid determines whether the grid table dimensions are valid * for the format specified. If the dimensions are not valid then the * function attempts to create a * PT with the correct size grid tables. If it is successful the * PTRefNum of the resized PT is returned in the location pointed to by * resizePTRefNumP. If resizing is not required the value returned in * the location pointed to by resizePTRefNumP is 0. * * NOTE: If this function creates a resized PT, that PT is checked in. * it is the responsibility of the calling function to check out * that PT. */ static PTErr_t gridDimValid ( PTType_t format, PTRefNum_t PTRefNum, PTRefNum_p resizePTRefNumP) { KpHandle_t PTData; KpInt32_t inputChans, outputChans, LUTDimensions, dummy = 0; fut_p fut; PTErr_t retVal, error = KCP_SUCCESS; /* Assume no resizing */ if (NULL != resizePTRefNumP) { *resizePTRefNumP = 0; } /* Convert the PTRefNum to a fut */ PTData = getPTData (PTRefNum); fut = fut_lock_fut (PTData); if (fut == FUT_NULL) { return KCP_PTERR_2; } if ( ! IS_FUT (fut) ) { /* check for valid fut */ retVal = KCP_NOT_FUT; goto GetOut; } switch (format ) { #if !defined KCP_ICC_ONLY case PTTYPE_FUTF: /* may want to check if any of the grid dimensions exceed the max grid dimension, but for now accept any size */ break; #endif case PTTYPE_MAB1: case PTTYPE_MAB2: case PTTYPE_MBA1: case PTTYPE_MBA2: /* may want to check if any of the grid dimensions exceed the max grid dimension, but for now accept any size */ break; case PTTYPE_MFT1: case PTTYPE_MFT2: case PTTYPE_MFT2_VER_0: /* The grid dimensions must all be the same. If they are not then attempt to build a grid table where all the dimensions are the same. */ retVal = (PTErr_t) fut_mfutInfo (fut, &LUTDimensions, &inputChans, &outputChans, format, &dummy, &dummy, &dummy); if (1 != retVal) { if (-2 != retVal) { retVal = KCP_INVAL_GRID_DIM; goto GetOut; } else { KpInt32_t i1, newGridDims[FUT_NICHAN]; fut_p futresized; for (i1 = 0; i1 < FUT_NICHAN; i1++) { /* define new grid sizes */ newGridDims[i1] = LUTDimensions; } futresized = fut_resize (fut, newGridDims); /* resize the fut */ if (futresized == NULL) { retVal = KCP_NO_MEMORY; goto GetOut; } if (futresized == fut) { /* should not happen, probably fut_mfutInfo() error */ retVal = KCP_SYSERR_3; goto GetOut; } if (fut_to_mft (futresized) != 1) { /* convert to reference tables */ retVal = KCP_INCON_PT; goto GetOut; } retVal = fut2PT (&futresized, -1, -1, PTTYPE_CALCULATED, resizePTRefNumP); /* make into PT */ if (retVal == KCP_SUCCESS) { retVal = copyAllAttr (PTRefNum, *resizePTRefNumP); /* Copy all attributes to new PT */ if (retVal != KCP_SUCCESS) { PTCheckOut (*resizePTRefNumP); goto GetOut; } } } } break; default: retVal = KCP_INVAL_PTTYPE; } retVal = KCP_SUCCESS; GetOut: fut_unlock_fut (fut); return retVal; }