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)
01316 +
sizeof(
unsigned long)
01317 +
sizeof(
unsigned long)
01318 + theText[0]
01319 +
sizeof(
unsigned long)
01320 +
sizeof(
unsigned long)
01321 +
sizeof(
unsigned short)
01322 +
sizeof(
unsigned char)
01323 + 67
01324 ;
01325 theCopyRightSize =
sizeof(
OSType)
01326 +
sizeof(
unsigned long)
01327 + copyrightText[0]
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
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 }