test: w98/lh_open/pi_color.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# pi_color.c File Reference

`#include "General.h"`
`#include "PI_Color.h"`
`#include "PI_CMM.h"`
`#include "MemLink.h"`

Go to the source code of this file.

## Functions

CMError | LHColorWorldOpen (Ptr *storage)
CMError | LHColorWorldClose (Ptr storage)
CMError | CWNewColorWorld (CMWorldRef *storage, CMProfileRef srcProfile, CMProfileRef dstProfile)
CMError | CWConcatColorWorld (CMWorldRef *storage, CMConcatProfileSet *profileSet)
CMError | CWConcatColorWorld4MS (CMWorldRef *storage, CMConcatProfileSet *profileSet, UINT32 *aIntentArr, UINT32 nIntents, UINT32 dwFlags)
CMError | CWLinkColorWorld (CMWorldRef *storage, CMConcatProfileSet *profileSet)
void | CWDisposeColorWorld (CMWorldRef storage)
void | CMSetLookupOnlyMode (CMWorldRef Storage, PI_Boolean Mode)
void | CMFullColorRemains (CMWorldRef Storage, long ColorMask)
CMError | CWCreateLink4MS (CMWorldRef storage, CMConcatProfileSet *profileSet, UINT32 aIntent, icProfile **theLinkProfile)

## Function Documentation

void CMFullColorRemains | ( | CMWorldRef | Storage,
|  | long | ColorMask
| ) |

Definition at line 393 of file w98/lh_open/pi_color.c.

References CMMModelPtr, CMLutParam::colorLut, CMLutParam::colorLutGridPoints, CMLutParam::colorLutInDim, CMLutParam::colorLutOutDim, CMLutParam::colorLutWordSize, DATA_2_PTR, LOCK_DATA, Size, and UNLOCK_DATA.

    00395 {
    00396         CMMModelPtr             aPtr;
    00397         CMLutParamPtr   lutParamPtr;
    00398         long Address,Size,i,j;
    00399
    00400         if( Storage == 0 )return;
    00401         LOCK_DATA( Storage );
    00402         aPtr = (CMMModelPtr)(DATA_2_PTR(        Storage ));
    00403         lutParamPtr = &aPtr->lutParam;
    00404
    00405         Size = lutParamPtr->colorLutWordSize / 8;
    00406         if( !(lutParamPtr->colorLutInDim == 4 && lutParamPtr->colorLutOutDim == 4 ))return;
    00407
    00408         for( i=0; i<4; i++ ){
    00409                 if( (ColorMask & (1<<i)) == 0 ) continue;
    00410                 Address = lutParamPtr->colorLutGridPoints - 1;
    00411                 for( j=3-i+1; j<4; j++ )Address *= lutParamPtr->colorLutGridPoints;
    00412                 Address = Address * lutParamPtr->colorLutOutDim;
    00413                 for( j=0; j<4; j++){
    00414                         if( i == j ){
    00415                                 if( Size == 1 ){
    00416                                         *( ((unsigned char*)lutParamPtr->colorLut)+Address+3-j ) = (unsigned char)255;
    00417                                 }
    00418                                 else{
    00419                                         *( ((unsigned short*)lutParamPtr->colorLut)+Address+3-j ) = (unsigned short)65535;
    00420                                 }
    00421                         }
    00422                         else{
    00423                                 if( Size == 1 ){
    00424                                         *( ((unsigned char*)lutParamPtr->colorLut)+Address+3-j ) = (unsigned char)0;
    00425                                 }
    00426                                 else{
    00427                                         *( ((unsigned short*)lutParamPtr->colorLut)+Address+3-j ) = (unsigned short)0;
    00428                                 }
    00429                         }
    00430                 }
    00431         }
    00432         UNLOCK_DATA( Storage );
    00433         return;
    00434 }

void CMSetLookupOnlyMode | ( | CMWorldRef | Storage,
|  | PI_Boolean | Mode
| ) |

Definition at line 380 of file w98/lh_open/pi_color.c.

References CMMModelPtr, DATA_2_PTR, LOCK_DATA, and UNLOCK_DATA.

    00382 {
    00383         CMMModelPtr             aPtr;
    00384
    00385         if( Storage == 0 )return;
    00386         LOCK_DATA( Storage );
    00387         aPtr = (CMMModelPtr)(DATA_2_PTR(        Storage ));
    00388         aPtr->lookup = Mode;
    00389         UNLOCK_DATA( Storage );
    00390         return;
    00391 }

CMError CWConcatColorWorld | ( | CMWorldRef * | storage,
|  | CMConcatProfileSet * | profileSet
| ) |

Definition at line 209 of file w98/lh_open/pi_color.c.

References CMError, CMMConcatInitPrivate(), CMMModelPtr, CMWorldRef, LHColorWorldClose(), LHColorWorldOpen(), and Ptr.

    00211 {
    00212     Ptr                 myStorage;
    00213     CMError     err;
    00214
    00215     err = LHColorWorldOpen(&myStorage);
    00216
    00217     if ( !err )
    00218     {
    00219         ((CMMModelPtr)myStorage)->aIntentArr    = 0;
    00220                 ((CMMModelPtr)myStorage)->dwFlags               = 0xffffffff;
    00221         err = CMMConcatInitPrivate  ((CMMModelPtr)myStorage, profileSet );
    00222     }
    00223
    00224
    00225     if ( !err )
    00226     {
    00227                 *storage = (CMWorldRef)myStorage;
    00228     }
    00229         else{
    00230                 *storage = (CMWorldRef)0;
    00231                 LHColorWorldClose( myStorage );
    00232         }
    00233
    00234     return err;
    00235 }

CMError CWConcatColorWorld4MS | ( | CMWorldRef * | storage,
|  | CMConcatProfileSet * | profileSet,
|  | UINT32 * | aIntentArr,
|  | UINT32 | nIntents,
|  | UINT32 | dwFlags
| ) |

Definition at line 283 of file w98/lh_open/pi_color.c.

References CMError, CMMConcatInitPrivate(), CMMModelPtr, CMWorldRef, DeviceLinkFill(), dwFlags, LHColorWorldClose(), LHColorWorldOpen(), Ptr, and WriteProf().

Referenced by CMCreateMultiProfileTransformInternal().

    00289 {
    00290     Ptr                 myStorage;
    00291     CMError     err;
    00292 #if WRITE_PROFILE
    00293         icProfile *theLinkProfile;
    00294         long l;
    00295 #endif
    00296
    00297     err = LHColorWorldOpen(&myStorage);
    00298
    00299     if ( !err )
    00300     {
    00301                 ((CMMModelPtr)myStorage)->aIntentArr    = aIntentArr;
    00302         ((CMMModelPtr)myStorage)->nIntents              = nIntents;
    00303         ((CMMModelPtr)myStorage)->dwFlags               = dwFlags;
    00304                 err = CMMConcatInitPrivate  ((CMMModelPtr)myStorage, profileSet );
    00305     }
    00306
    00307
    00308     if ( !err )
    00309     {
    00310                 *storage = (CMWorldRef)myStorage;
    00311     }
    00312         else{
    00313                 *storage = (CMWorldRef)0;
    00314                 LHColorWorldClose( myStorage );
    00315         }
    00316
    00317 #if WRITE_PROFILE
    00318         err = DeviceLinkFill( (CMMModelPtr)myStorage, profileSet, &theLinkProfile, 0 );
    00319         if( !err ){
    00320                 l = *(unsigned long *)theLinkProfile;
    00321                 SwapLong(&l);
    00322                 WriteProf( "test", theLinkProfile, l );
    00323         }
    00324 #endif
    00325     return err;
    00326 }

CMError CWCreateLink4MS | ( | CMWorldRef | storage,
|  | CMConcatProfileSet * | profileSet,
|  | UINT32 | aIntent,
|  | icProfile ** | theLinkProfile
| ) |

Definition at line 436 of file w98/lh_open/pi_color.c.

References CMError, CMMModelPtr, and DeviceLinkFill().

    00440 {
    00441     CMError     err;
    00442
    00443         *theLinkProfile = 0;
    00444
    00445         err = DeviceLinkFill( (CMMModelPtr)storage, profileSet, theLinkProfile, aIntent );
    00446
    00447         return err;
    00448 }

void CWDisposeColorWorld | ( | CMWorldRef | storage | ) |

Definition at line 375 of file w98/lh_open/pi_color.c.

References LHColorWorldClose(), and Ptr.

Referenced by CMCreateDeviceLinkProfile(), CMCreateTransformExtInternal(), and CMDeleteTransform().

    00376 {
    00377     LHColorWorldClose ( (Ptr)storage );
    00378 }

CMError CWLinkColorWorld | ( | CMWorldRef * | storage,
|  | CMConcatProfileSet * | profileSet
| ) |

Definition at line 329 of file w98/lh_open/pi_color.c.

References CMError, CMMConcatInitPrivate(), CMMModelPtr, CMWorldRef, kCMMNewLinkProfile, LHColorWorldClose(), LHColorWorldOpen(), and Ptr.

    00331 {
    00332     Ptr                 myStorage;
    00333     CMError     err;
    00334
    00335     err = LHColorWorldOpen(&myStorage);
    00336
    00337         if ( !err )
    00338     {
    00339                 ((CMMModelPtr)myStorage)->currentCall   = kCMMNewLinkProfile;
    00340                 ((CMMModelPtr)myStorage)->aIntentArr    = 0;
    00341                 ((CMMModelPtr)myStorage)->dwFlags               = 0xffffffff;
    00342                 err = CMMConcatInitPrivate  ((CMMModelPtr)myStorage, profileSet );
    00343     }
    00344
    00345
    00346     if ( !err )
    00347     {
    00348                 *storage = (CMWorldRef)myStorage;
    00349     }
    00350         else{
    00351                 *storage = (CMWorldRef)0;
    00352                 LHColorWorldClose( myStorage );
    00353         }
    00354
    00355     return err;
    00356 }

CMError CWNewColorWorld | ( | CMWorldRef * | storage,
|  | CMProfileRef | srcProfile,
|  | CMProfileRef | dstProfile
| ) |

Definition at line 141 of file w98/lh_open/pi_color.c.

References CMError, CMMInitPrivate(), CMMModelPtr, CMWorldRef, LHColorWorldClose(), LHColorWorldOpen(), and Ptr.

    00144 {
    00145     Ptr                 myStorage;
    00146     CMError     err;
    00147
    00148 #ifdef DEBUG_OUTPUT
    00149     /*printf("vor LHColorWorldOpen\n");*/
    00150 #endif
    00151     err = LHColorWorldOpen(&myStorage);
    00152 #ifdef DEBUG_OUTPUT
    00153     /*printf("nach LHColorWorldOpen: err = %d\n", err);*/
    00154 #endif
    00155     if ( !err )
    00156     {
    00157         ((CMMModelPtr)myStorage)->aIntentArr    = 0;
    00158                 ((CMMModelPtr)myStorage)->dwFlags               = 0xffffffff;
    00159         err =  CMMInitPrivate((CMMModelPtr)myStorage,
    00160                                srcProfile,
    00161                                dstProfile);
    00162 #ifdef DEBUG_OUTPUT
    00163     /*printf("nach NCMMInitPrivate: err = %d\n", err);*/
    00164 #endif
    00165     }
    00166
    00167
    00168     if ( !err )
    00169     {
    00170                 *storage = (CMWorldRef)myStorage;
    00171     }
    00172         else{
    00173                 *storage = (CMWorldRef)0;
    00174                 LHColorWorldClose( myStorage );
    00175         }
    00176
    00177     return err;
    00178 }

CMError LHColorWorldClose | ( | Ptr | storage | ) |

Definition at line 88 of file w98/lh_open/pi_color.c.

References CMError, CMMModelPtr, DISPOSE_IF_DATA, DisposeIfPtr(), and noErr.

Referenced by CWConcatColorWorld(), CWConcatColorWorld4MS(), CWDisposeColorWorld(), CWLinkColorWorld(), and CWNewColorWorld().

    00089 {
    00090     CMMModelPtr  modelData = (CMMModelPtr)storage;
    00091
    00092     if (storage)
    00093     {
    00094                 DISPOSE_IF_DATA((modelData)->lutParam.inputLut);
    00095                 DISPOSE_IF_DATA((modelData)->lutParam.outputLut);
    00096                 DISPOSE_IF_DATA((modelData)->lutParam.colorLut);
    00097
    00098                 DISPOSE_IF_DATA((modelData)->gamutLutParam.inputLut);
    00099                 DISPOSE_IF_DATA((modelData)->gamutLutParam.outputLut);
    00100                 DISPOSE_IF_DATA((modelData)->gamutLutParam.colorLut);
    00101
    00102                 DISPOSE_IF_DATA((modelData)->theNamedColorTagData);
    00103 #if     __IS_MAC
    00104                 DisposeIfHandle((modelData)->Monet);
    00105 #endif
    00106
    00107                 DisposeIfPtr(storage);
    00108     }
    00109     return( noErr );
    00110 }

CMError LHColorWorldOpen | ( | Ptr * | storage | ) |

Definition at line 55 of file w98/lh_open/pi_color.c.

References CMError, OSErr, Ptr, and SmartNewPtrClear().

Referenced by CWConcatColorWorld(), CWConcatColorWorld4MS(), CWLinkColorWorld(), and CWNewColorWorld().

    00056 {
    00057     Ptr                             myStorage;
    00058     OSErr               err;
    00059
    00060     myStorage = (Ptr)SmartNewPtrClear( sizeof( CMMModelData ) , &err);
    00061     if (err)
    00062         goto CleanupAndExit;
    00063     else
    00064     {
    00065         *storage = myStorage;
    00066     }
    00067
    00068 CleanupAndExit:
    00069     return err;
    00070 }