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

memlink.c File Reference

#include "General.h"
#include "MemLink.h"
#include <time.h>

Go to the source code of this file.

Defines

#define CMHelperICC2int16Const(a, b)   (*((UINT16 *)(a))) = (UINT16)(b);
#define CMHelperICC2int32Const(a, b)   (*((UINT32 *)(a))) = (UINT32)(b);
#define Round(a)   (((a)>0.)?((a)+.5):((a)-.5))
#define MyTagCount   9
#define MyTagCountLink   5
#define LINK_BUFFER_MAX   3000

Functions

CMError MyAdd_NL_Header (UINT32 theSize, icHeader *linkHeader, UINT32 aIntent, UINT32 aClass, UINT32 aColorSpace, UINT32 aConnectionSpace)
CMError MyAdd_NL_HeaderMS (UINT32 theSize, icHeader *linkHeader, unsigned long aIntent, icColorSpaceSignature sCS, icColorSpaceSignature dCS)
CMError MyAdd_NL_DescriptionTag (LHTextDescriptionType *descPtr, unsigned char *theText)
CMError MyAdd_NL_ColorantTag (icXYZType *descPtr, MyXYZNumber *aColor)
CMError MyAdd_NL_CurveTag (icCurveType *descPtr, unsigned short Gamma)
CMError MyAdd_NL_CopyrightTag (unsigned char *copyrightText, LHTextType *aLHTextType)
CMError Fill_mft1_InputTable (Ptr theElut, icLut8 *lutPtr, CMMModelPtr modelData)
CMError Fill_mft1_OutputTable (Ptr theAlut, icLut8 *lutPtr, long offset, CMMModelPtr modelData)
CMError Fill_mft2_InputTable (Ptr theElut, icLut16 *lutPtr, CMMModelPtr modelData)
CMError Fill_mft2_OutputTable (Ptr theAlut, icLut16 *lutPtr, long offset, CMMModelPtr modelData)
CMError Fill_mft2_ColorTable (Ptr theClut, icLut16 *lutPtr, long offset, long count)
CMError MyAdd_NL_AToB0Tag_mft1 (CMMModelPtr cw, icLut8Type *lutPtr, long colorLutSize)
UINT32 GetSizes (CMMModelPtr cw, UINT32 *clutSize)
CMError MyAdd_NL_AToB0Tag_mft2 (CMMModelPtr cw, icLut16Type *lutPtr, long colorLutSize)
CMError MyGetColorSpaces (CMConcatProfileSet *profileSet, UINT32 *sCS, UINT32 *dCS)
CMError MyAdd_NL_SequenceDescTag (CMConcatProfileSet *profileSet, icProfileSequenceDescType *pSeqPtr, long *aSize)
MyXYZNumber MakeXYZNumber (MyXYZNumber *x)
void MakeMyDoubleXYZ (MyXYZNumber *x, MyDoubleXYZ *ret)
Boolean doubMatrixInvert (double inpMat[3][3], double outMat[3][3])
void TransposeMatrix (double inpMat[3][3])
double GetMatrixedVal (double m[3][3], long color, MyDoubleXYZ *aXYZ)
void NormalizeColor (MyXYZNumber *r, MyXYZNumber *g, MyXYZNumber *b, MyDoubleXYZ *Illuminant, MyXYZNumber *resR, MyXYZNumber *resG, MyXYZNumber *resB)
void NormalizeWithWhiteAdaption (MyXYZNumber *r, MyXYZNumber *g, MyXYZNumber *b, MyDoubleXYZ *Illuminant, MyXYZNumber *resR, MyXYZNumber *resG, MyXYZNumber *resB)
CMError DeviceLinkFill (CMMModelPtr cw, CMConcatProfileSet *profileSet, icProfile **theProf, unsigned long aIntent)


Define Documentation

#define CMHelperICC2int16Const a,
 )     (*((UINT16 *)(a))) = (UINT16)(b);
 

Definition at line 41 of file lh_core/memlink.c.

Referenced by Fill_mft2_ColorTable(), Fill_mft2_InputTable(), Fill_mft2_OutputTable(), and MyAdd_NL_AToB0Tag_mft2().

#define CMHelperICC2int32Const a,
 )     (*((UINT32 *)(a))) = (UINT32)(b);
 

Definition at line 43 of file lh_core/memlink.c.

Referenced by DeviceLinkFill(), MyAdd_NL_AToB0Tag_mft1(), MyAdd_NL_AToB0Tag_mft2(), MyAdd_NL_ColorantTag(), MyAdd_NL_CopyrightTag(), MyAdd_NL_CurveTag(), MyAdd_NL_DescriptionTag(), MyAdd_NL_Header(), and MyAdd_NL_SequenceDescTag().

#define LINK_BUFFER_MAX   3000
 

Definition at line 1279 of file lh_core/memlink.c.

Referenced by DeviceLinkFill().

#define MyTagCount   9
 

Definition at line 941 of file lh_core/memlink.c.

Referenced by DeviceLinkFill().

#define MyTagCountLink   5
 

Definition at line 1278 of file lh_core/memlink.c.

Referenced by DeviceLinkFill().

#define Round  )     (((a)>0.)?((a)+.5):((a)-.5))
 

Definition at line 863 of file lh_core/memlink.c.


Function Documentation

CMError DeviceLinkFill CMMModelPtr  cw,
CMConcatProfileSet profileSet,
icProfile **  theProf,
unsigned long  aIntent
 

Definition at line 1281 of file lh_core/memlink.c.

01285 { 01286 CMError err = unimpErr; 01287 OSErr aOSerr = unimpErr; 01288 #ifdef __MWERKS__ 01289 unsigned char theText[] = "\pDeviceLink profile "; 01290 char copyrightText[] = "\p�1996 by Heidelberger Druckmaschinen AG U.J.K."; 01291 #elif __IS_MSDOS 01292 char theText[] = "\030DeviceLink profile "; 01293 char copyrightText[] = "\060�1996 by Heidelberger Druckmaschinen AG U.J.K."; 01294 #else 01295 char theText[] = "\030DeviceLink profile "; 01296 char copyrightText[] = "\060�1996 by Heidelberger Druckmaschinen AG U.J.K."; 01297 #endif 01298 icProfile *aProf=0; 01299 long theTagTabSize; 01300 long theHeaderSize; 01301 long theDescSize; 01302 long theMediaSize; 01303 long theSequenceDescSize; 01304 long theA2B0Size; 01305 long theCopyRightSize; 01306 long currentSize=0; 01307 long theTotalSize=0; 01308 icTag aTag; 01309 UINT32 sCS,dCS,clutSize; 01310 Ptr aPtr=0; 01311 01312 MyDoubleXYZ D50XYZ = { 0.9642, 1.0000, 0.8249 }; 01313 MyXYZNumber D50 = { (unsigned long)(0.9642 * 65536), (unsigned long)(1.0000 * 65536), (unsigned long)(0.8249 * 65536)}; 01314 theHeaderSize = sizeof(icHeader); 01315 theDescSize = sizeof(OSType) /* type descriptor */ 01316 + sizeof(unsigned long) /* reserved */ 01317 + sizeof(unsigned long) /* ASCII length */ 01318 + theText[0] /* ASCII profile description */ 01319 + sizeof(unsigned long) /* Unicode code */ 01320 + sizeof(unsigned long) /* Unicode character count */ 01321 + sizeof(unsigned short) /* Macintosh script code */ 01322 + sizeof(unsigned char) /* Macintosh string length */ 01323 + 67 /* Macintosh string */ 01324 ; 01325 theCopyRightSize = sizeof(OSType) /* type descriptor */ 01326 + sizeof(unsigned long) /* reserved */ 01327 + copyrightText[0] /* ASCII profile description */ 01328 ; 01329 theMediaSize = sizeof( icXYZType );; 01330 01331 theTagTabSize = MyTagCountLink * sizeof( icTag ) + sizeof( unsigned long ); 01332 01333 *theProf = 0; 01334 01335 if( cw->hasNamedColorProf != NoNamedColorProfile ){ 01336 err = cmProfileError; 01337 goto CleanupAndExit; 01338 } 01339 err = MyGetColorSpaces( profileSet, &sCS, &dCS ); 01340 if (err) 01341 goto CleanupAndExit; 01342 01343 aProf = (icProfile *)SmartNewPtrClear( LINK_BUFFER_MAX, &aOSerr ); 01344 err = aOSerr; 01345 if (err) 01346 goto CleanupAndExit; 01347 01348 err = MyAdd_NL_Header(theTotalSize, (icHeader*)((Ptr)aProf+currentSize), aIntent, icSigLinkClass, sCS, dCS ); 01349 if (err) 01350 goto CleanupAndExit; 01351 01352 /*----------------------------------------------------------------------------------------- cmProfileDescriptionTag */ 01353 currentSize = theHeaderSize + theTagTabSize; 01354 CMHelperICC2int32Const(&(aProf->tagList.count ), MyTagCountLink); 01355 01356 CMHelperICC2int32Const(&(aTag.sig ), icSigProfileDescriptionTag); 01357 CMHelperICC2int32Const(&(aTag.offset ), currentSize); 01358 CMHelperICC2int32Const(&(aTag.size ), theDescSize); 01359 aProf->tagList.tags[0] = aTag; 01360 err =MyAdd_NL_DescriptionTag ( (LHTextDescriptionType *)((Ptr)aProf+currentSize), (unsigned char *)theText ); 01361 if (err) 01362 goto CleanupAndExit; 01363 currentSize += theDescSize; 01364 currentSize = ( currentSize + 3 ) & ~ 3; 01365 01366 CMHelperICC2int32Const(&(aTag.sig ), icSigMediaWhitePointTag); 01367 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 01368 CMHelperICC2int32Const(&(aTag.size ), theMediaSize); 01369 aProf->tagList.tags[1] = aTag; 01370 MyAdd_NL_ColorantTag((icXYZType *)((Ptr)aProf+currentSize), &D50); 01371 currentSize += theMediaSize; 01372 currentSize = ( currentSize + 3 ) & ~ 3; 01373 01374 CMHelperICC2int32Const(&(aTag.sig ), icSigCopyrightTag); 01375 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 01376 CMHelperICC2int32Const(&(aTag.size ), theCopyRightSize); 01377 aProf->tagList.tags[2] = aTag; 01378 err = MyAdd_NL_CopyrightTag( (unsigned char *)copyrightText, (LHTextType *)((Ptr)aProf+currentSize)); 01379 if (err) 01380 goto CleanupAndExit; 01381 currentSize += theCopyRightSize; 01382 currentSize = ( currentSize + 3 ) & ~ 3; 01383 01384 err = MyAdd_NL_SequenceDescTag( profileSet, (icProfileSequenceDescType *)((Ptr)aProf+currentSize), &theSequenceDescSize ); 01385 CMHelperICC2int32Const(&(aTag.sig ), icSigProfileSequenceDescTag); 01386 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 01387 CMHelperICC2int32Const(&(aTag.size ), theSequenceDescSize); 01388 aProf->tagList.tags[3] = aTag; 01389 currentSize += theSequenceDescSize; 01390 currentSize = ( currentSize + 3 ) & ~ 3; 01391 01392 theA2B0Size = GetSizes( (CMMModelPtr)cw, &clutSize ); 01393 01394 CMHelperICC2int32Const(&(aTag.sig ), icSigAToB0Tag); 01395 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 01396 CMHelperICC2int32Const(&(aTag.size ), theA2B0Size); 01397 aProf->tagList.tags[4] = aTag; 01398 01399 #if __IS_MSDOS 01400 aPtr = GlobalAllocPtr( GHND, theA2B0Size+currentSize ); 01401 if( aPtr == 0 ){ 01402 err = GetLastError(); 01403 goto CleanupAndExit; 01404 } 01405 #else 01406 aPtr = SmartNewPtr( theA2B0Size+currentSize, &aOSerr ); 01407 err = aOSerr; 01408 if( err ){ 01409 goto CleanupAndExit; 01410 } 01411 #endif 01412 01413 01414 if ( cw->lutParam.colorLutWordSize == 8 ) 01415 err = MyAdd_NL_AToB0Tag_mft1( (CMMModelPtr)cw, (icLut8Type *)(aPtr+currentSize), clutSize ); 01416 else 01417 err = MyAdd_NL_AToB0Tag_mft2( (CMMModelPtr)cw, (icLut16Type *)(aPtr+currentSize), clutSize ); 01418 01419 if (err) 01420 goto CleanupAndExit; 01421 01422 BlockMove( (Ptr)aProf, aPtr, currentSize ); 01423 aProf = (icProfile *)DisposeIfPtr( (Ptr)aProf ); 01424 01425 CMHelperICC2int32Const( aPtr, theA2B0Size+currentSize ); 01426 01427 *theProf = (icProfile *)aPtr; 01428 #ifdef WRITE_PROFILE 01429 WriteProf( "DeviceLinkFill.pf", (icProfile *)aPtr, theA2B0Size+currentSize ); 01430 #endif 01431 return noErr; 01432 01433 CleanupAndExit: 01434 *theProf = (icProfile *)DisposeIfPtr( (Ptr)aProf ); 01435 #if __IS_MSDOS 01436 if( aPtr )GlobalFreePtr( aPtr ); 01437 #else 01438 aPtr = DisposeIfPtr( (Ptr)aPtr ); 01439 #endif 01440 return err; 01441 }

Boolean doubMatrixInvert double  inpMat[3][3],
double  outMat[3][3]
 

Definition at line 389 of file lh_core/fragment.c.

00390 { 00391 double detm, hilf1, hilf2, hilf3, hilf4, hilf5, hilf6; 00392 double *a; 00393 Boolean success = TRUE; 00394 #ifdef DEBUG_OUTPUT 00395 CMError err=noErr; 00396 #endif 00397 LH_START_PROC("doubMatrixInvert") 00398 a = (double *)MatHin; 00399 00400 hilf1 = a[0] * a[4]; 00401 hilf2 = a[1] * a[5]; 00402 hilf3 = a[2] * a[3]; 00403 hilf4 = a[2] * a[4]; 00404 hilf5 = a[1] * a[3]; 00405 hilf6 = a[0] * a[5]; 00406 00407 detm = hilf1 * a[8] + hilf2 * a[6] 00408 + hilf3 * a[7] - hilf4 * a[6] 00409 - hilf5 * a[8] - hilf6 * a[7]; 00410 00411 /* if(fabs(detm) < 1.E-9) */ 00412 if ( (detm < 1.E-9) && (detm > -1.E-9) ) 00413 success = FALSE; 00414 else 00415 { 00416 detm = 1. / detm; 00417 00418 MatRueck[0][0] = (a[4] * a[8] - a[5] * a[7]) * detm; 00419 MatRueck[0][1] = (a[7] * a[2] - a[8] * a[1]) * detm; 00420 MatRueck[0][2] = (hilf2 - hilf4 ) * detm; 00421 00422 MatRueck[1][0] = (a[5] * a[6] - a[3] * a[8]) * detm; 00423 MatRueck[1][1] = (a[8] * a[0] - a[6] * a[2]) * detm; 00424 MatRueck[1][2] = (hilf3 - hilf6 ) * detm; 00425 00426 MatRueck[2][0] = (a[3] * a[7] - a[4] * a[6]) * detm; 00427 MatRueck[2][1] = (a[6] * a[1] - a[7] * a[0]) * detm; 00428 MatRueck[2][2] = (hilf1 - hilf5 ) * detm; 00429 } 00430 00431 LH_END_PROC("doubMatrixInvert") 00432 return(success); 00433 }

CMError Fill_mft1_InputTable Ptr  theElut,
icLut8 lutPtr,
CMMModelPtr  modelData
 

Definition at line 281 of file lh_core/memlink.c.

References icLut8::clutPoints, CMError, icLut8::data, icLut8::inputChan, kCMMNewLinkProfile, noErr, OSErr, and UINT8.

00284 { 00285 OSErr err = noErr; 00286 long i; 00287 long j; 00288 unsigned long factor; 00289 unsigned long round; 00290 unsigned long shift; 00291 unsigned long ulAux; 00292 unsigned short *wordElut = (unsigned short*)theElut; 00293 unsigned long newScale = 255; 00294 unsigned long oldScale = ((1U<< modelData->lutParam.inputLutWordSize) * (lutPtr->clutPoints-1)) / lutPtr->clutPoints; 00295 00296 if( modelData->currentCall == kCMMNewLinkProfile ){ 00297 oldScale = 1<< modelData->lutParam.inputLutWordSize; 00298 } 00299 factor = (newScale << 24) / oldScale; 00300 round = (1<<(24-1))-1; 00301 shift = 24; 00302 00303 ulAux = ~( (1<< (32-modelData->lutParam.inputLutWordSize))-1); 00304 while (factor & ulAux ) /* stay within 16 bits to prevent product overflow */ 00305 { 00306 factor >>= 1; 00307 round >>= 1; 00308 shift -= 1; 00309 } 00310 00311 for (i=0; i<(long)lutPtr->inputChan; i++) 00312 { 00313 for (j=0; j< 256; j++) 00314 { 00315 ulAux = ((unsigned long)*wordElut * factor + round) >> shift; 00316 lutPtr->data[i * 256 + j] = (UINT8)(ulAux ); 00317 wordElut++; 00318 } 00319 } 00320 return err; 00321 }

CMError Fill_mft1_OutputTable Ptr  theAlut,
icLut8 lutPtr,
long  offset,
CMMModelPtr  modelData
 

Definition at line 346 of file lh_core/memlink.c.

References CMError, icLut8::data, noErr, OSErr, icLut8::outputChan, and UINT8.

00350 { 00351 OSErr err = noErr; 00352 long i; 00353 long j; 00354 UINT8* byteAlut = (UINT8*)theAlut; 00355 long numOfAlutEntries = modelData->lutParam.outputLutEntryCount; 00356 00357 for (i=0; i<(long)lutPtr->outputChan; i++) 00358 { 00359 for (j=0; j<256; j++) 00360 { 00361 byteAlut = (UINT8*)theAlut + (j * (numOfAlutEntries-1)) / 255 ; 00362 lutPtr->data[offset + i * 256 + j] = *byteAlut; 00363 } 00364 theAlut += numOfAlutEntries; 00365 } 00366 return err; 00367 }

CMError Fill_mft2_ColorTable Ptr  theClut,
icLut16 lutPtr,
long  offset,
long  count
 

Definition at line 502 of file lh_core/memlink.c.

References CMError, CMHelperICC2int16Const, icLut16::data, noErr, OSErr, and UINT16.

00506 { 00507 OSErr err = noErr; 00508 long i; 00509 UINT16* wordClut = (UINT16*)theClut; 00510 UINT16* wordData = (UINT16*)lutPtr->data + offset; 00511 00512 for ( i=0; i<count; i++) 00513 { 00514 CMHelperICC2int16Const( wordData, *wordClut ); 00515 wordData++; 00516 wordClut++; 00517 } 00518 return err; 00519 }

CMError Fill_mft2_InputTable Ptr  theElut,
icLut16 lutPtr,
CMMModelPtr  modelData
 

Definition at line 389 of file lh_core/memlink.c.

References CMError, CMHelperICC2int16Const, icLut16::data, icLut16::inputChan, icLut16::inputEnt, kCMMNewLinkProfile, noErr, OSErr, and UINT16.

00392 { 00393 OSErr err = noErr; 00394 unsigned long factor; 00395 unsigned long round; 00396 unsigned long shift; 00397 unsigned long ulAux; 00398 long i; 00399 long j; 00400 UINT16* wordElut = (UINT16*)theElut; 00401 UINT16* wordData = (UINT16*)lutPtr->data; 00402 unsigned long newScale = 65535; 00403 00404 unsigned long oldScale = ( (1<<modelData->lutParam.inputLutWordSize) * (modelData->lutParam.colorLutGridPoints-1)) / modelData->lutParam.colorLutGridPoints; 00405 00406 if( modelData->currentCall == kCMMNewLinkProfile ){ 00407 oldScale = 1<< modelData->lutParam.inputLutWordSize; 00408 } 00409 factor = (newScale << 15) / oldScale; 00410 round = (1<<(15-1))-1; 00411 shift = 15; 00412 00413 while (factor & 0xFFFF0000) /* stay within 16 bits to prevent product overflow */ 00414 { 00415 factor >>= 1; 00416 round >>= 1; 00417 shift -= 1; 00418 } 00419 00420 for (i=0; i<(long)lutPtr->inputChan; i++) 00421 { 00422 for (j=0; j< (long)lutPtr->inputEnt; j++) 00423 { 00424 ulAux = ((unsigned long)*wordElut * factor + round) >> shift; 00425 CMHelperICC2int16Const( wordData, ulAux ); 00426 wordData++; 00427 wordElut++; 00428 } 00429 } 00430 return err; 00431 }

CMError Fill_mft2_OutputTable Ptr  theAlut,
icLut16 lutPtr,
long  offset,
CMMModelPtr  modelData
 

Definition at line 455 of file lh_core/memlink.c.

References CMError, CMHelperICC2int16Const, icLut16::data, noErr, OSErr, icLut16::outputChan, icLut16::outputEnt, and UINT16.

00459 { 00460 OSErr err = noErr; 00461 long i; 00462 long j; 00463 UINT16* wordAlut = (UINT16*)theAlut; 00464 UINT16* wordData = (UINT16*)lutPtr->data + offset; 00465 00466 modelData = modelData; 00467 for (i=0; i<(long)lutPtr->outputChan; i++) 00468 { 00469 for (j=0; j<(long)lutPtr->outputEnt; j++) 00470 { 00471 CMHelperICC2int16Const( wordData, *wordAlut ); 00472 wordData++; 00473 wordAlut++; 00474 } 00475 } 00476 return err; 00477 }

double GetMatrixedVal double  m[3][3],
long  color,
MyDoubleXYZ aXYZ
 

Definition at line 866 of file lh_core/memlink.c.

References MyDoubleXYZ::X, MyDoubleXYZ::Y, and MyDoubleXYZ::Z.

00867 { 00868 double tmp; 00869 tmp = m[color][0] * aXYZ->X; 00870 tmp+= m[color][1] * aXYZ->Y; 00871 tmp+= m[color][2] * aXYZ->Z; 00872 return tmp; 00873 }

UINT32 GetSizes CMMModelPtr  cw,
UINT32 clutSize
 

Definition at line 579 of file lh_core/memlink.c.

References Fixed, icUInt16Number, LOCK_DATA, OSType, SINT32, UINT16, UINT32, UINT8, and UNLOCK_DATA.

00580 { 00581 UINT16 inputChannels; 00582 UINT16 outputChannels; 00583 UINT16 gridPoints; 00584 SINT32 colorLutSize; 00585 UINT32 i,theSize; 00586 00587 LOCK_DATA(cw->lutParam.inputLut); 00588 LOCK_DATA(cw->lutParam.colorLut); 00589 LOCK_DATA(cw->lutParam.outputLut); 00590 00591 inputChannels = (UINT16)cw->lutParam.colorLutInDim; 00592 outputChannels = (UINT16)cw->lutParam.colorLutOutDim; 00593 gridPoints = (UINT16)cw->lutParam.colorLutGridPoints; 00594 00595 colorLutSize = outputChannels; 00596 for(i = 0; i < inputChannels; i++) 00597 colorLutSize *= gridPoints; 00598 00599 if ( cw->lutParam.colorLutWordSize != 8){ 00600 theSize = sizeof(OSType) + sizeof(UINT32) + (4 * sizeof(UINT8)) + (9 * sizeof(Fixed)) /* typeDescriptor...matrix */ 00601 + 2 * sizeof(icUInt16Number) /* inputLutEntryCount outputLutEntryCount*/ 00602 + (inputChannels * cw->lutParam.inputLutEntryCount * sizeof(UINT16)) /* inputTable */ 00603 + (outputChannels * cw->lutParam.outputLutEntryCount * sizeof(UINT16)) /* CLUT */ 00604 + colorLutSize * sizeof(UINT16); /* outputTable */ 00605 } 00606 else{ 00607 theSize = sizeof(OSType) + sizeof(UINT32) + (4 * sizeof(UINT8)) + (9 * sizeof(Fixed)) /* typeDescriptor...matrix */ 00608 + (inputChannels * 256 * sizeof(UINT8)) /* inputTable */ 00609 + (outputChannels * 256 * sizeof(UINT8)) /* CLUT */ 00610 + colorLutSize; /* outputTable */ 00611 } 00612 *clutSize = colorLutSize; 00613 UNLOCK_DATA(cw->lutParam.inputLut); 00614 UNLOCK_DATA(cw->lutParam.colorLut); 00615 UNLOCK_DATA(cw->lutParam.outputLut); 00616 return theSize; 00617 }

void MakeMyDoubleXYZ MyXYZNumber x,
MyDoubleXYZ ret
 

Definition at line 841 of file lh_core/memlink.c.

References icXYZNumber::X, MyDoubleXYZ::X, icXYZNumber::Y, MyDoubleXYZ::Y, icXYZNumber::Z, and MyDoubleXYZ::Z.

00842 { 00843 ret->X = x->X/(double)(1<<30); 00844 ret->Y = x->Y/(double)(1<<30); 00845 ret->Z = x->Z/(double)(1<<30); 00846 }

MyXYZNumber MakeXYZNumber MyXYZNumber x  ) 
 

Definition at line 831 of file lh_core/memlink.c.

References icXYZNumber::X, icXYZNumber::Y, and icXYZNumber::Z.

00832 { 00833 MyXYZNumber ret; 00834 ret.X = x->X>>14; 00835 ret.Y = x->Y>>14; 00836 ret.Z = x->Z>>14; 00837 return ret; 00838 }

CMError MyAdd_NL_AToB0Tag_mft1 CMMModelPtr  cw,
icLut8Type lutPtr,
long  colorLutSize
 

Definition at line 521 of file lh_core/memlink.c.

00522 { 00523 CMError err; 00524 icLut8 *tempLutPtr; 00525 long offset; 00526 UINT16 inputChannels; 00527 UINT16 outputChannels; 00528 UINT16 gridPoints; 00529 00530 LH_START_PROC("Add_NL_AToB0Tag_mft1") 00531 00532 LOCK_DATA(cw->lutParam.inputLut); 00533 LOCK_DATA(cw->lutParam.colorLut); 00534 LOCK_DATA(cw->lutParam.outputLut); 00535 00536 inputChannels = (UINT16)cw->lutParam.colorLutInDim; 00537 outputChannels = (UINT16)cw->lutParam.colorLutOutDim; 00538 gridPoints = (UINT16)cw->lutParam.colorLutGridPoints; 00539 00540 tempLutPtr = &lutPtr->lut; 00541 CMHelperICC2int32Const(&(lutPtr->base ), icSigLut8Type); 00542 CMHelperICC2int32Const((OSType*)&(lutPtr->base )+1, 0); 00543 tempLutPtr->inputChan = (UINT8)inputChannels; 00544 tempLutPtr->outputChan = (UINT8)outputChannels; 00545 tempLutPtr->clutPoints = (UINT8)gridPoints; 00546 tempLutPtr->e00 = tempLutPtr->e01 = tempLutPtr->e02 = 0; 00547 tempLutPtr->e10 = tempLutPtr->e11 = tempLutPtr->e12 = 0; 00548 tempLutPtr->e20 = tempLutPtr->e21 = tempLutPtr->e22 = 0; 00549 CMHelperICC2int32Const(&(tempLutPtr->e00 ), 0x10000); 00550 CMHelperICC2int32Const(&(tempLutPtr->e11 ), 0x10000); 00551 CMHelperICC2int32Const(&(tempLutPtr->e22 ), 0x10000); 00552 00553 err = Fill_mft1_InputTable((Ptr)DATA_2_PTR(cw->lutParam.inputLut), tempLutPtr, cw); 00554 if (err) 00555 goto CleanupAndExit; 00556 00557 offset = 256 * inputChannels; 00558 BlockMoveData( DATA_2_PTR(cw->lutParam.colorLut), & tempLutPtr->data[0] + offset, colorLutSize); 00559 00560 offset = offset + colorLutSize; 00561 err = Fill_mft1_OutputTable((Ptr)DATA_2_PTR(cw->lutParam.outputLut), tempLutPtr, offset, cw); 00562 if (err) 00563 goto CleanupAndExit; 00564 00565 CleanupAndExit: 00566 00567 #ifdef DEBUG_OUTPUT 00568 if ( err ) 00569 DebugPrint("� MyAdd_NL_AToB0Tag_mft1-Error: result = %d\n",err); 00570 #endif 00571 UNLOCK_DATA(cw->lutParam.inputLut); 00572 UNLOCK_DATA(cw->lutParam.colorLut); 00573 UNLOCK_DATA(cw->lutParam.outputLut); 00574 LH_END_PROC("Add_NL_AToB0Tag_mft1") 00575 return err; 00576 }

CMError MyAdd_NL_AToB0Tag_mft2 CMMModelPtr  cw,
icLut16Type lutPtr,
long  colorLutSize
 

Definition at line 619 of file lh_core/memlink.c.

00620 { 00621 CMError err; 00622 icLut16 *tempLutPtr; 00623 long offset; 00624 UINT16 inputChannels; 00625 UINT16 outputChannels; 00626 UINT16 gridPoints; 00627 00628 LH_START_PROC("Add_NL_AToB0Tag_mft2") 00629 00630 LOCK_DATA(cw->lutParam.inputLut); 00631 LOCK_DATA(cw->lutParam.colorLut); 00632 LOCK_DATA(cw->lutParam.outputLut); 00633 00634 inputChannels = (UINT16)cw->lutParam.colorLutInDim; 00635 outputChannels = (UINT16)cw->lutParam.colorLutOutDim; 00636 gridPoints = (UINT16)cw->lutParam.colorLutGridPoints; 00637 00638 tempLutPtr = &lutPtr->lut; 00639 CMHelperICC2int32Const(&(lutPtr->base ), icSigLut16Type); 00640 CMHelperICC2int32Const((OSType*)&(lutPtr->base )+1, 0); 00641 tempLutPtr->inputChan = (UINT8)inputChannels; 00642 tempLutPtr->outputChan = (UINT8)outputChannels; 00643 tempLutPtr->clutPoints = (UINT8)((gridPoints>255)?255:gridPoints); 00644 tempLutPtr->e00 = tempLutPtr->e01 = tempLutPtr->e02 = 0; 00645 tempLutPtr->e10 = tempLutPtr->e11 = tempLutPtr->e12 = 0; 00646 tempLutPtr->e20 = tempLutPtr->e21 = tempLutPtr->e22 = 0; 00647 CMHelperICC2int32Const(&(tempLutPtr->e00 ), 0x10000); 00648 CMHelperICC2int32Const(&(tempLutPtr->e11 ), 0x10000); 00649 CMHelperICC2int32Const(&(tempLutPtr->e22 ), 0x10000); 00650 00651 tempLutPtr->inputEnt = (UINT16)cw->lutParam.inputLutEntryCount; 00652 tempLutPtr->outputEnt = (UINT16)cw->lutParam.outputLutEntryCount; 00653 err = Fill_mft2_InputTable((Ptr)DATA_2_PTR(cw->lutParam.inputLut), tempLutPtr, cw); 00654 if (err) 00655 goto CleanupAndExit; 00656 00657 offset = cw->lutParam.inputLutEntryCount * inputChannels; 00658 Fill_mft2_ColorTable( (Ptr)DATA_2_PTR(cw->lutParam.colorLut), tempLutPtr, offset, colorLutSize); 00659 00660 offset = offset + colorLutSize; 00661 err = Fill_mft2_OutputTable((Ptr)DATA_2_PTR(cw->lutParam.outputLut), tempLutPtr, offset, cw); 00662 if (err) 00663 goto CleanupAndExit; 00664 00665 CMHelperICC2int16Const(&(tempLutPtr->inputEnt ), (UINT16)cw->lutParam.inputLutEntryCount); 00666 CMHelperICC2int16Const(&(tempLutPtr->outputEnt ), (UINT16)cw->lutParam.outputLutEntryCount); 00667 00668 CleanupAndExit: 00669 00670 #ifdef DEBUG_OUTPUT 00671 if ( err ) 00672 DebugPrint("� MyAdd_NL_AToB0Tag_mft2-Error: result = %d\n",err); 00673 #endif 00674 UNLOCK_DATA(cw->lutParam.inputLut); 00675 UNLOCK_DATA(cw->lutParam.colorLut); 00676 UNLOCK_DATA(cw->lutParam.outputLut); 00677 LH_END_PROC("Add_NL_AToB0Tag_mft2") 00678 return err; 00679 }

CMError MyAdd_NL_ColorantTag icXYZType descPtr,
MyXYZNumber aColor
 

Definition at line 222 of file lh_core/memlink.c.

00223 { 00224 OSErr err = noErr; 00225 00226 CMHelperICC2int32Const(&(descPtr->base ), icSigXYZType); 00227 CMHelperICC2int32Const((OSType*)&(descPtr->base )+1, 0); 00228 CMHelperICC2int32(&(descPtr->data.data[0].X ), &aColor->X); 00229 CMHelperICC2int32(&(descPtr->data.data[0].Y ), &aColor->Y); 00230 CMHelperICC2int32(&(descPtr->data.data[0].Z ), &aColor->Z); 00231 return err; 00232 }

CMError MyAdd_NL_CopyrightTag unsigned char *  copyrightText,
LHTextType aLHTextType
 

Definition at line 245 of file lh_core/memlink.c.

00246 { 00247 OSErr err=noErr; 00248 00249 copyrightText[copyrightText[0]] = 0x00; 00250 CMHelperICC2int32Const(&(aLHTextType->base ), icSigTextType); 00251 CMHelperICC2int32Const((OSType*)&(aLHTextType->base )+1, 0); 00252 BlockMove(&copyrightText[1], &aLHTextType->text[0], copyrightText[0]); 00253 00254 #ifdef DEBUG_OUTPUT 00255 if ( err && DebugCheck(kThisFile, kDebugErrorInfo) ) 00256 DebugPrint("� MyAdd_NL_CopyrightTag-Error: result = %d\n",err); 00257 #endif 00258 return err; 00259 }

CMError MyAdd_NL_CurveTag icCurveType descPtr,
unsigned short  Gamma
 

Definition at line 234 of file lh_core/memlink.c.

00235 { 00236 OSErr err = noErr; 00237 00238 CMHelperICC2int32Const(&(descPtr->base ), icSigCurveType); 00239 CMHelperICC2int32Const((OSType*)&(descPtr->base )+1, 0); 00240 CMHelperICC2int32Const(&(descPtr->curve.count ), 1); 00241 CMHelperICC2int16(&(descPtr->curve.data[0] ), &Gamma ); 00242 return err; 00243 }

CMError MyAdd_NL_DescriptionTag LHTextDescriptionType descPtr,
unsigned char *  theText
 

Definition at line 178 of file lh_core/memlink.c.

00179 { 00180 Ptr thePtr; 00181 OSErr err = noErr; 00182 00183 theText[theText[0]] = 0x00; 00184 00185 /*descPtr = (LHTextDescriptionType*)NewPtrClear( theSize ); */ 00186 if (descPtr == 0) 00187 return -1; 00188 00189 /*------------------------------------------------------------------------ ASCII */ 00190 CMHelperICC2int32Const(&(descPtr->typeDescriptor ), icSigTextDescriptionType); 00191 CMHelperICC2int32Const(&(descPtr->reserved ), 0); 00192 CMHelperICC2int32Const(&(descPtr->ASCIICount ), (long)theText[0]); 00193 thePtr = (Ptr) &descPtr->ASCIIName[0]; 00194 BlockMove(&theText[1], thePtr, theText[0]); 00195 thePtr += theText[0]; 00196 00197 /*------------------------------------------------------------------------ Unicode */ 00199 /*thePtr+=sizeof(unsigned long); */ 00200 *thePtr++ = 0; 00201 *thePtr++ = 0; 00202 *thePtr++ = 0; 00203 *thePtr++ = 0; 00205 /*thePtr+=sizeof(unsigned long); */ 00206 *thePtr++ = 0; 00207 *thePtr++ = 0; 00208 *thePtr++ = 0; 00209 *thePtr++ = 0; 00210 /*BlockMove(&theText[1], thePtr, theText[0]); //Unicode string */ 00211 /*thePtr += theText[0]; */ 00212 00213 /*------------------------------------------------------------------------ Macintosh */ 00216 *thePtr++ = 0; 00217 *thePtr++ = 0; 00218 BlockMove(&theText[0], thePtr, theText[0]+1); 00219 return err; 00220 }

CMError MyAdd_NL_Header UINT32  theSize,
icHeader linkHeader,
UINT32  aIntent,
UINT32  aClass,
UINT32  aColorSpace,
UINT32  aConnectionSpace
 

Definition at line 53 of file lh_core/memlink.c.

00055 { 00056 OSErr err = noErr; 00057 #if ! __IS_MSDOS 00058 unsigned long secs; 00059 #endif 00060 DateTimeRec datetimeRec; 00061 /*icHeader linkHeader; */ 00062 00063 #if __IS_MSDOS 00064 SYSTEMTIME aSystemTime; 00065 GetLocalTime( (SYSTEMTIME *)&aSystemTime); 00066 datetimeRec.year = aSystemTime.wYear; datetimeRec.month = aSystemTime.wMonth; 00067 datetimeRec.day = aSystemTime.wDay; datetimeRec.hour = aSystemTime.wHour; 00068 datetimeRec.minute = aSystemTime.wMinute; datetimeRec.second = aSystemTime.wSecond; 00069 #else 00070 #if __IS_MAC 00071 GetDateTime(&secs); 00072 SecondsToDate(secs, &datetimeRec);/* Secs2Date (link.*)=(.*); CMHelperICC2int32(\&(\1),\2); */ 00073 #else 00074 struct tm* loctime; 00075 time_t long_time; 00076 time( &long_time ); /* Get time as long integer. */ 00077 loctime = localtime(&long_time); 00078 datetimeRec.year = loctime->tm_year; datetimeRec.month = loctime->tm_mon+1; 00079 datetimeRec.day = loctime->tm_mday; datetimeRec.hour = loctime->tm_hour; 00080 datetimeRec.minute = loctime->tm_min; datetimeRec.second = loctime->tm_sec; 00081 #endif 00082 #endif 00083 00084 CMHelperICC2int32Const(&(linkHeader->size ), theSize); /* This is the total size of the CMProfileRef */ 00085 CMHelperICC2int32Const(&(linkHeader->cmmId ), 'Win '); /* CMM signature, Registered with ICC consortium */ 00086 CMHelperICC2int32Const(&(linkHeader->version ), icVersionNumber); /* Version of CMProfile format */ 00087 CMHelperICC2int32Const(&(linkHeader->deviceClass ), aClass); /* input, display, output, devicelink, abstract, or color conversion profile type */ 00088 00089 CMHelperICC2int32Const(&(linkHeader->colorSpace ), aColorSpace); /* color space of data = dataColorSpace of first profile*/ 00090 00091 CMHelperICC2int32Const(&(linkHeader->pcs ), aConnectionSpace); /* profile connection color space = dataColorSpace of last profile*/ 00092 00093 CMHelperICC2int16(&(linkHeader->date.year ), &datetimeRec.year); /* date and time of profile creation */ 00094 CMHelperICC2int16(&(linkHeader->date.month ), &datetimeRec.month); 00095 CMHelperICC2int16(&(linkHeader->date.day ), &datetimeRec.day); 00096 CMHelperICC2int16(&(linkHeader->date.hours ), &datetimeRec.hour); 00097 CMHelperICC2int16(&(linkHeader->date.minutes ), &datetimeRec.minute); 00098 CMHelperICC2int16(&(linkHeader->date.seconds ), &datetimeRec.second); 00099 CMHelperICC2int32Const(&(linkHeader->magic ), icMagicNumber); /* 'acsp' constant ICC file ID */ 00100 CMHelperICC2int32Const(&(linkHeader->platform ), icSigMicrosoft); /* primary profile platform, Registered with ICC consortium */ 00101 CMHelperICC2int32Const(&(linkHeader->flags ), 0); /* profile flags */ 00102 CMHelperICC2int32Const(&(linkHeader->manufacturer ), icSigMicrosoft); /* Registered with ICC consortium */ 00103 CMHelperICC2int32Const(&(linkHeader->model ), 0); /* Registered with ICC consortium */ 00104 CMHelperICC2int32Const(&(linkHeader->attributes[0] ), 0); /* Attributes like paper type */ 00105 CMHelperICC2int32Const(&(linkHeader->attributes[1] ), 0); 00106 CMHelperICC2int32Const(&(linkHeader->renderingIntent ), aIntent ); /* preferred rendering intent of tagged object */ 00107 CMHelperICC2int32Const(&(linkHeader->illuminant.X ), 0.9642 * 65536); /* profile illuminant */ 00108 CMHelperICC2int32Const(&(linkHeader->illuminant.Y ), 1.0000 * 65536); 00109 CMHelperICC2int32Const(&(linkHeader->illuminant.Z ), 0.8249 * 65536); 00110 CMHelperICC2int32Const(&(linkHeader->creator ), 'UJK '); 00111 00112 return err; 00113 }

CMError MyAdd_NL_HeaderMS UINT32  theSize,
icHeader linkHeader,
unsigned long  aIntent,
icColorSpaceSignature  sCS,
icColorSpaceSignature  dCS
 

Definition at line 116 of file lh_core/memlink.c.

References icHeader::attributes, CMError, icHeader::cmmId, icHeader::colorSpace, icHeader::creator, icHeader::date, icDateTimeNumber::day, DateTimeRec::day, icHeader::deviceClass, icHeader::flags, GetDateTime(), DateTimeRec::hour, icDateTimeNumber::hours, icMagicNumber, icSigLinkClass, icSigMicrosoft, icVersionNumber, icHeader::illuminant, icHeader::magic, icHeader::manufacturer, DateTimeRec::minute, icDateTimeNumber::minutes, icHeader::model, icDateTimeNumber::month, DateTimeRec::month, noErr, OSErr, icHeader::pcs, icHeader::platform, icHeader::renderingIntent, DateTimeRec::second, icDateTimeNumber::seconds, SecondsToDate(), icHeader::size, icHeader::version, icXYZNumber::X, icXYZNumber::Y, icDateTimeNumber::year, DateTimeRec::year, and icXYZNumber::Z.

00117 { 00118 OSErr err = noErr; 00119 #if ! __IS_MSDOS 00120 unsigned long secs; 00121 #endif 00122 DateTimeRec datetimeRec; 00123 /*icHeader linkHeader; */ 00124 00125 #if __IS_MSDOS 00126 SYSTEMTIME aSystemTime; 00127 GetLocalTime( (SYSTEMTIME *)&aSystemTime); 00128 datetimeRec.year = aSystemTime.wYear; datetimeRec.month = aSystemTime.wMonth; 00129 datetimeRec.day = aSystemTime.wDay; datetimeRec.hour = aSystemTime.wHour; 00130 datetimeRec.minute = aSystemTime.wMinute; datetimeRec.second = aSystemTime.wSecond; 00131 #else 00132 #if __IS_MAC 00133 GetDateTime(&secs); 00134 SecondsToDate(secs, &datetimeRec);/* Secs2Date (link.*)=(.*); CMHelperICC2int32(\&(\1),\2); */ 00135 #else 00136 struct tm* loctime; 00137 time_t long_time; 00138 time( &long_time ); /* Get time as long integer. */ 00139 loctime = localtime(&long_time); 00140 datetimeRec.year = loctime->tm_year; datetimeRec.month = loctime->tm_mon+1; 00141 datetimeRec.day = loctime->tm_mday; datetimeRec.hour = loctime->tm_hour; 00142 datetimeRec.minute = loctime->tm_min; datetimeRec.second = loctime->tm_sec; 00143 #endif 00144 #endif 00145 00146 00147 linkHeader->size = theSize; /* This is the total size of the CMProfileRef */ 00148 linkHeader->cmmId = 'Win '; /* CMM signature, Registered with ICC consortium */ 00149 linkHeader->version = icVersionNumber; /* Version of CMProfile format */ 00150 linkHeader->deviceClass = icSigLinkClass; /* input, display, output, devicelink, abstract, or color conversion profile type */ 00151 00152 linkHeader->colorSpace = sCS; /* color space of data = dataColorSpace of first profile*/ 00153 00154 linkHeader->pcs = dCS; /* profile connection color space = dataColorSpace of last profile*/ 00155 00156 linkHeader->date.year = datetimeRec.year; /* date and time of profile creation */ 00157 linkHeader->date.month = datetimeRec.month; 00158 linkHeader->date.day = datetimeRec.day; 00159 linkHeader->date.hours = datetimeRec.hour; 00160 linkHeader->date.minutes = datetimeRec.minute; 00161 linkHeader->date.seconds = datetimeRec.second; 00162 linkHeader->magic = icMagicNumber; /* 'acsp' constant ICC file ID */ 00163 linkHeader->platform = icSigMicrosoft; /* primary profile platform, Registered with ICC consortium */ 00164 linkHeader->flags = 0; /* profile flags */ 00165 linkHeader->manufacturer = icSigMicrosoft; /* Registered with ICC consortium */ 00166 linkHeader->model = 0; /* Registered with ICC consortium */ 00167 linkHeader->attributes[0] = 0; /* Attributes like paper type */ 00168 linkHeader->attributes[1] = 0; 00169 linkHeader->renderingIntent = aIntent ; /* preferred rendering intent of tagged object */ 00170 linkHeader->illuminant.X = (long)(0.9642 * 65536); /* profile illuminant */ 00171 linkHeader->illuminant.Y = (long)(1.0000 * 65536); 00172 linkHeader->illuminant.Z = (long)(0.8249 * 65536); 00173 linkHeader->creator = 'UJK '; 00174 00175 return err; 00176 }

CMError MyAdd_NL_SequenceDescTag CMConcatProfileSet profileSet,
icProfileSequenceDescType pSeqPtr,
long *  aSize
 

Definition at line 724 of file lh_core/memlink.c.

00727 { 00728 CMError err; 00729 OSErr aOSerr; 00730 /*icProfileSequenceDescType* pSeqPtr = nil;*/ 00731 Ptr thePtr = nil; 00732 icHeader profHeader; 00733 SINT32 loop; 00734 OSType technology; 00735 UINT32 elementSize; 00736 icSignatureType theSignature; 00737 icTextDescriptionType* descPtr = nil; 00738 char descPtrNull[90]={0}; 00739 00740 LH_START_PROC("MyAdd_NL_SequenceDescTag") 00741 00742 CMHelperICC2int32Const(&(((icTextDescriptionType*)descPtrNull)->base ), icSigTextDescriptionType ); 00743 CMHelperICC2int32Const(((OSType*)&((icTextDescriptionType*)descPtrNull)->base )+1, 0); 00744 CMHelperICC2int32Const(&(((icTextDescriptionType*)descPtrNull)->desc.count ), 1 ); 00745 /*pSeqPtr = (icProfileSequenceDescType*)SmartNewPtrClear(5000, &aOSerr); 00746 err = aOSerr; 00747 if (err) 00748 goto CleanupAndExit;*/ 00749 CMHelperICC2int32Const(&(pSeqPtr->base ), icSigProfileSequenceDescType); 00750 CMHelperICC2int32Const((OSType*)&(pSeqPtr->base )+1, 0); 00751 CMHelperICC2int32Const(&(pSeqPtr->desc.count ), profileSet->count ); 00752 thePtr = (Ptr)( (SIZE_T)&(pSeqPtr->desc.count) + sizeof(SINT32) ) ; 00753 00754 for (loop = 0; loop < (SINT32)profileSet->count; loop++) 00755 { 00756 err = CMGetProfileHeader(profileSet->profileSet[loop], (CMCoreProfileHeader *)&profHeader); 00757 if (err) 00758 goto CleanupAndExit; 00759 CMHelperICC2int32Const(thePtr, profHeader.manufacturer); 00760 thePtr += sizeof(OSType); 00761 CMHelperICC2int32Const(thePtr, profHeader.model); 00762 thePtr += sizeof(OSType); 00763 CMHelperICC2int32Const(thePtr, profHeader.attributes[0]); 00764 thePtr += sizeof(UINT32); 00765 CMHelperICC2int32Const(thePtr, profHeader.attributes[1]); 00766 thePtr += sizeof(UINT32); 00767 00768 /* ----------------------------------------------------------------- icSigTechnologyTag */ 00769 technology = 0; 00770 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigTechnologyTag, &elementSize, nil) == noErr) 00771 { 00772 if (elementSize == sizeof(icSigTechnologyTag)) 00773 { 00774 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigTechnologyTag, &elementSize, &theSignature) == noErr) 00775 technology = theSignature.signature; 00776 } 00777 } 00778 *((OSType*)thePtr) = technology; /* signature */ 00779 thePtr += sizeof(OSType); 00780 00781 /* ----------------------------------------------------------------- icSigDeviceMfgDescTag */ 00782 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigDeviceMfgDescTag, &elementSize, nil) == noErr) 00783 { 00784 descPtr = (icTextDescriptionType*)SmartNewPtr(elementSize,&aOSerr); 00785 err = aOSerr; 00786 if (err) 00787 goto CleanupAndExit; 00788 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigDeviceMfgDescTag, &elementSize, descPtr) == noErr) 00789 { 00790 BlockMoveData( descPtr, thePtr, elementSize); 00791 thePtr += elementSize; 00792 } 00793 descPtr = (icTextDescriptionType*)DisposeIfPtr((Ptr)descPtr); 00794 } else 00795 { 00796 BlockMoveData( descPtrNull, thePtr, sizeof(descPtrNull)); 00797 thePtr += sizeof(descPtrNull); 00798 } 00799 /* ----------------------------------------------------------------- icSigDeviceModelDescTag */ 00800 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigDeviceModelDescTag, &elementSize, nil) == noErr) 00801 { 00802 descPtr = (icTextDescriptionType*)SmartNewPtr(elementSize,&aOSerr); 00803 err = aOSerr; 00804 if (err) 00805 goto CleanupAndExit; 00806 if ( CMGetProfileElement(profileSet->profileSet[loop], icSigDeviceModelDescTag, &elementSize, descPtr) == noErr) 00807 { 00808 BlockMoveData( descPtr, thePtr, elementSize); 00809 thePtr += elementSize; 00810 } 00811 descPtr = (icTextDescriptionType*)DisposeIfPtr((Ptr)descPtr); 00812 } else 00813 { 00814 BlockMoveData( descPtrNull, thePtr, sizeof(descPtrNull)); 00815 thePtr += sizeof(descPtrNull); 00816 } 00817 /* ----------------------------------------------------------------- */ 00818 } 00819 00820 //Sundown safe truncation 00821 *aSize = (LONG)((ULONG_PTR)thePtr - (ULONG_PTR)pSeqPtr); 00822 00823 CleanupAndExit: 00824 descPtr = (icTextDescriptionType*)DisposeIfPtr((Ptr)descPtr); 00825 LH_END_PROC("MyAdd_NL_SequenceDescTag") 00826 return err; 00827 }

CMError MyGetColorSpaces CMConcatProfileSet profileSet,
UINT32 sCS,
UINT32 dCS
 

Definition at line 684 of file lh_core/memlink.c.

References CMError, CMGetProfileHeader(), icHeader::colorSpace, CMConcatProfileSet::count, LH_END_PROC, LH_START_PROC, and CMConcatProfileSet::profileSet.

00687 { 00688 CMError err; 00689 icHeader profHeader; 00690 00691 LH_START_PROC("MyGetColorSpaces") 00692 00693 err = CMGetProfileHeader(profileSet->profileSet[0], (CMCoreProfileHeader *)&profHeader); 00694 if (err) 00695 goto CleanupAndExit; 00696 *sCS = profHeader.colorSpace; 00697 00698 err = CMGetProfileHeader(profileSet->profileSet[profileSet->count-1], (CMCoreProfileHeader *)&profHeader); 00699 if (err) 00700 goto CleanupAndExit; 00701 *dCS = profHeader.colorSpace; 00702 00703 CleanupAndExit: 00704 LH_END_PROC("MyAdd_NL_SequenceDescTag") 00705 return err; 00706 }

void NormalizeColor MyXYZNumber r,
MyXYZNumber g,
MyXYZNumber b,
MyDoubleXYZ Illuminant,
MyXYZNumber resR,
MyXYZNumber resG,
MyXYZNumber resB
 

Definition at line 876 of file lh_core/memlink.c.

References g(), MakeMyDoubleXYZ(), Round, icXYZNumber::X, MyDoubleXYZ::X, icXYZNumber::Y, MyDoubleXYZ::Y, icXYZNumber::Z, and MyDoubleXYZ::Z.

00877 { 00878 double factorX,factorY,factorZ; 00879 double inMat[3][3]; 00880 00881 MakeMyDoubleXYZ( r, (MyDoubleXYZ*)&inMat[0][0] ); 00882 MakeMyDoubleXYZ( g, (MyDoubleXYZ*)&inMat[1][0] ); 00883 MakeMyDoubleXYZ( b, (MyDoubleXYZ*)&inMat[2][0] ); 00884 00885 factorX = inMat[0][0] + inMat[1][0] + inMat[2][0]; 00886 factorY = inMat[0][1] + inMat[1][1] + inMat[2][1]; 00887 factorZ = inMat[0][2] + inMat[1][2] + inMat[2][2]; 00888 00889 factorX = Illuminant->X / factorX * 65536; 00890 factorY = Illuminant->Y / factorY * 65536; 00891 factorZ = Illuminant->Z / factorZ * 65536; 00892 00893 resR->X = (long)Round(inMat[0][0] * factorX); /* red primary */ 00894 resR->Y = (long)Round(inMat[0][1] * factorY); 00895 resR->Z = (long)Round(inMat[0][2] * factorZ); 00896 resG->X = (long)Round(inMat[1][0] * factorX); /* green primary */ 00897 resG->Y = (long)Round(inMat[1][1] * factorY); 00898 resG->Z = (long)Round(inMat[1][2] * factorZ); 00899 resB->X = (long)Round(inMat[2][0] * factorX); /* blue primary */ 00900 resB->Y = (long)Round(inMat[2][1] * factorY); 00901 resB->Z = (long)Round(inMat[2][2] * factorZ); 00902 }

void NormalizeWithWhiteAdaption MyXYZNumber r,
MyXYZNumber g,
MyXYZNumber b,
MyDoubleXYZ Illuminant,
MyXYZNumber resR,
MyXYZNumber resG,
MyXYZNumber resB
 

Definition at line 905 of file lh_core/memlink.c.

References doubMatrixInvert(), g(), GetMatrixedVal(), MakeMyDoubleXYZ(), Round, TransposeMatrix(), icXYZNumber::X, icXYZNumber::Y, and icXYZNumber::Z.

00906 { 00907 double factorR,factorG,factorB; 00908 double inMat[3][3]; 00909 double outMat[3][3]; 00910 00911 MakeMyDoubleXYZ( r, (MyDoubleXYZ*)&inMat[0][0] ); 00912 MakeMyDoubleXYZ( g, (MyDoubleXYZ*)&inMat[1][0] ); 00913 MakeMyDoubleXYZ( b, (MyDoubleXYZ*)&inMat[2][0] ); 00914 00915 if( !doubMatrixInvert(inMat, outMat) ) 00916 { 00917 return ; 00918 } 00919 00920 TransposeMatrix( outMat ); 00921 00922 factorR = GetMatrixedVal( outMat, 0, Illuminant )*65536; 00923 factorG = GetMatrixedVal( outMat, 1, Illuminant )*65536; 00924 factorB = GetMatrixedVal( outMat, 2, Illuminant )*65536; 00925 00926 resR->X = (long)Round(inMat[0][0] * factorR); /* red primary */ 00927 resR->Y = (long)Round(inMat[0][1] * factorR); 00928 resR->Z = (long)Round(inMat[0][2] * factorR); 00929 resG->X = (long)Round(inMat[1][0] * factorG); /* green primary */ 00930 resG->Y = (long)Round(inMat[1][1] * factorG); 00931 resG->Z = (long)Round(inMat[1][2] * factorG); 00932 resB->X = (long)Round(inMat[2][0] * factorB); /* blue primary */ 00933 resB->Y = (long)Round(inMat[2][1] * factorB); 00934 resB->Z = (long)Round(inMat[2][2] * factorB); 00935 }

void TransposeMatrix double  inpMat[3][3]  ) 
 

Definition at line 850 of file lh_core/memlink.c.

00851 { 00852 long i,j; 00853 double sav; 00854 for( i=0; i< 3; i++ ){ 00855 for( j=i+1; j< 3; j++ ){ 00856 sav = inpMat[i][j]; 00857 inpMat[i][j] = inpMat[j][i]; 00858 inpMat[j][i] = sav; 00859 } 00860 } 00861 00862 }


Generated on Sat May 15 19:44:37 2004 for test by doxygen 1.3.7