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 w98/lh_core/memlink.c.

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

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

#define LINK_BUFFER_MAX   3000
 

Definition at line 1280 of file w98/lh_core/memlink.c.

#define MyTagCount   9
 

Definition at line 942 of file w98/lh_core/memlink.c.

#define MyTagCountLink   5
 

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

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

Definition at line 864 of file w98/lh_core/memlink.c.


Function Documentation

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

Definition at line 1282 of file w98/lh_core/memlink.c.

References BlockMove(), CMError, CMHelperICC2int32Const, CMMModelPtr, cmProfileError, icTagList::count, DisposeIfPtr(), GetSizes(), icSigAToB0Tag, icSigCopyrightTag, icSigLinkClass, icSigMediaWhitePointTag, icSigProfileDescriptionTag, icSigProfileSequenceDescTag, LINK_BUFFER_MAX, MyAdd_NL_AToB0Tag_mft1(), MyAdd_NL_AToB0Tag_mft2(), MyAdd_NL_ColorantTag(), MyAdd_NL_CopyrightTag(), MyAdd_NL_DescriptionTag(), MyAdd_NL_Header(), MyAdd_NL_SequenceDescTag(), MyGetColorSpaces(), MyTagCountLink, noErr, NoNamedColorProfile, icTag::offset, OSErr, OSType, Ptr, icTag::sig, icTag::size, SmartNewPtr(), SmartNewPtrClear(), icProfile::tagList, icTagList::tags, UINT32, unimpErr, and WriteProf().

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

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

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

References Boolean, CMError, FALSE, LH_END_PROC, LH_START_PROC, noErr, and TRUE.

Referenced by CombiMatrix(), Extract_TRC_Matrix(), MakeGamut16or32ForMonitor(), and NormalizeWithWhiteAdaption().

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
 

Referenced by MyAdd_NL_AToB0Tag_mft1().

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

Referenced by MyAdd_NL_AToB0Tag_mft1().

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

Referenced by MyAdd_NL_AToB0Tag_mft2().

CMError Fill_mft2_InputTable Ptr  theElut,
icLut16 lutPtr,
CMMModelPtr  modelData
 

Referenced by MyAdd_NL_AToB0Tag_mft2().

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

Referenced by MyAdd_NL_AToB0Tag_mft2().

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

Referenced by NormalizeWithWhiteAdaption().

UINT32 GetSizes CMMModelPtr  cw,
UINT32 clutSize
 

void MakeMyDoubleXYZ MyXYZNumber x,
MyDoubleXYZ ret
 

MyXYZNumber MakeXYZNumber MyXYZNumber x  ) 
 

CMError MyAdd_NL_AToB0Tag_mft1 CMMModelPtr  cw,
icLut8Type lutPtr,
long  colorLutSize
 

Definition at line 522 of file w98/lh_core/memlink.c.

References icLut8Type::base, BlockMoveData, icLut8::clutPoints, CMError, CMHelperICC2int32Const, icLut8::data, DATA_2_PTR, DebugPrint, icLut8::e00, icLut8::e01, icLut8::e02, icLut8::e10, icLut8::e11, icLut8::e12, icLut8::e20, icLut8::e21, icLut8::e22, Fill_mft1_InputTable(), Fill_mft1_OutputTable(), icSigLut8Type, icLut8::inputChan, LH_END_PROC, LH_START_PROC, LOCK_DATA, icLut8Type::lut, OSType, icLut8::outputChan, Ptr, UINT16, UINT8, and UNLOCK_DATA.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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

CMError MyAdd_NL_AToB0Tag_mft2 CMMModelPtr  cw,
icLut16Type lutPtr,
long  colorLutSize
 

Definition at line 620 of file w98/lh_core/memlink.c.

References icLut16Type::base, icLut16::clutPoints, CMError, CMHelperICC2int16Const, CMHelperICC2int32Const, DATA_2_PTR, DebugPrint, icLut16::e00, icLut16::e01, icLut16::e02, icLut16::e10, icLut16::e11, icLut16::e12, icLut16::e20, icLut16::e21, icLut16::e22, Fill_mft2_ColorTable(), Fill_mft2_InputTable(), Fill_mft2_OutputTable(), icSigLut16Type, icLut16::inputChan, icLut16::inputEnt, LH_END_PROC, LH_START_PROC, LOCK_DATA, icLut16Type::lut, OSType, icLut16::outputChan, icLut16::outputEnt, Ptr, UINT16, UINT8, and UNLOCK_DATA.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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

CMError MyAdd_NL_ColorantTag icXYZType descPtr,
MyXYZNumber aColor
 

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

References icXYZType::base, CMError, CMHelperICC2int32, CMHelperICC2int32Const, icXYZArray::data, icXYZType::data, icSigXYZType, MyXYZNumber, noErr, OSErr, OSType, icXYZNumber::X, icXYZNumber::Y, and icXYZNumber::Z.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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 w98/lh_core/memlink.c.

References LHTextType::base, BlockMove(), CMError, CMHelperICC2int32Const, DebugPrint, icSigTextType, noErr, OSErr, OSType, and LHTextType::text.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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 w98/lh_core/memlink.c.

References icCurveType::base, CMError, CMHelperICC2int16, CMHelperICC2int32Const, icCurve::count, icCurveType::curve, icCurve::data, icSigCurveType, noErr, OSErr, and OSType.

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 w98/lh_core/memlink.c.

References LHTextDescriptionType::ASCIICount, LHTextDescriptionType::ASCIIName, BlockMove(), CMError, CMHelperICC2int32Const, icSigTextDescriptionType, noErr, OSErr, Ptr, LHTextDescriptionType::reserved, and LHTextDescriptionType::typeDescriptor.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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 w98/lh_core/memlink.c.

References icHeader::attributes, CMError, CMHelperICC2int16, CMHelperICC2int32Const, icHeader::cmmId, icHeader::colorSpace, icHeader::creator, icHeader::date, icDateTimeNumber::day, DateTimeRec::day, icHeader::deviceClass, icHeader::flags, GetDateTime(), DateTimeRec::hour, icDateTimeNumber::hours, icMagicNumber, 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.

Referenced by DeviceLinkFill().

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
 

CMError MyAdd_NL_SequenceDescTag CMConcatProfileSet profileSet,
icProfileSequenceDescType pSeqPtr,
long *  aSize
 

Definition at line 725 of file w98/lh_core/memlink.c.

References icHeader::attributes, icProfileSequenceDescType::base, BlockMoveData, CMError, CMGetProfileElement(), CMGetProfileHeader(), CMHelperICC2int32Const, icProfileSequenceDesc::count, CMConcatProfileSet::count, icProfileSequenceDescType::desc, DisposeIfPtr(), icSigDeviceMfgDescTag, icSigDeviceModelDescTag, icSigProfileSequenceDescType, icSigTechnologyTag, icSigTextDescriptionType, LH_END_PROC, LH_START_PROC, icHeader::manufacturer, icHeader::model, nil, noErr, OSErr, OSType, CMConcatProfileSet::profileSet, Ptr, icSignatureType::signature, SINT32, SmartNewPtr(), and UINT32.

Referenced by DeviceLinkFill(), and MyNewDeviceLinkFill().

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

CMError MyGetColorSpaces CMConcatProfileSet profileSet,
UINT32 sCS,
UINT32 dCS
 

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
 

void TransposeMatrix double  inpMat[3][3]  ) 
 

Referenced by NormalizeWithWhiteAdaption().


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