00042 {
00043         
CMError                 err = 
unimpErr;
00044         
OSErr                   aOSerr = 
unimpErr;
00045 
#ifdef __MWERKS__
00046 
        unsigned char                   theText[] = 
"\pDeviceLink profile  ";
00047 
#else
00048 
      char                      theText[] = 
"\026DeviceLink profile   ";
00049 
#endif
00050 
      char      copyrightText[] = 
"\037©1996 by Linotype-Hell  U.J.K.";
00051         
icProfile               *aProf=0;
00052         
long                    theTagTabSize;
00053         
long                    theHeaderSize;
00054         
long                    theDescSize;
00055         
long                    theMediaSize;
00056         
long                    theSequenceDescSize;
00057         
long                    theA2B0Size;
00058         
long                    theCopyRightSize;
00059         
long                    currentSize=0;
00060         
long                    theTotalSize=0;
00061         
icTag                   aTag;
00062         
UINT32                  sCS,dCS,clutSize;
00063         
Ptr                             aPtr=0;
00064 
00065         
MyDoubleXYZ D50XYZ = { 0.9642, 1.0000, 0.8249 };
00066         
icXYZNumber D50 = { (
unsigned long)(D50XYZ.
X * 65536), (
unsigned long)(D50XYZ.
Y * 65536), (
unsigned long)(D50XYZ.
Z * 65536)};
00067         theHeaderSize = 
sizeof(
icHeader);
00068         theDescSize   =                                                                           
sizeof(
OSType)                        
00069                                                                                                                 + 
sizeof(
unsigned long)         
00070                                                                                                                 + 
sizeof(
unsigned long)         
00071                                                                                                                 + theText[0]                            
00072                                                                                                                 + 
sizeof(
unsigned long)         
00073                                                                                                                 + 
sizeof(
unsigned long)         
00074                                                                                                                 + 
sizeof(
unsigned short)        
00075                                                                                                                 + 
sizeof(
unsigned char)         
00076                                                                                                                 + 67                                            
00077                                                                                                                 ;
00078         theCopyRightSize   =                                                              
sizeof(
OSType)                        
00079                                                                                                                 + 
sizeof(
unsigned long)         
00080                                                                                                                 + copyrightText[0]                      
00081                                                                                                                 ;
00082         theMediaSize = 
sizeof( 
icXYZType );;
00083 
00084         theTagTabSize = 
MyTagCount * 
sizeof( 
icTag ) + 
sizeof( 
unsigned long );
00085         
00086         *theProf = 0;
00087         
00088         
if( ((
CMMModelPtr)cw)->hasNamedColorProf != 
NoNamedColorProfile ){
00089                 err = 
cmProfileError;
00090                 
goto CleanupAndExit;
00091         }
00092         err = 
MyGetColorSpaces( profileSet, &sCS, &dCS );
00093         
if (err)
00094                 
goto CleanupAndExit;
00095                 
00096         aProf = (
icProfile *)
SmartNewPtrClear( LINK_BUFFER_MAX, &aOSerr );
00097         err = aOSerr;
00098         
if (err)
00099                 
goto CleanupAndExit;
00100 
00101         err = 
MyAdd_NL_Header(theTotalSize, (
icHeader*)((Ptr)aProf+currentSize), aIntent, icSigLinkClass, sCS, dCS );
00102         
if (err)
00103                 
goto CleanupAndExit;
00104                 
00105         
00106         currentSize = theHeaderSize + theTagTabSize;
00107         
CMHelperICC2int32Const(&(aProf->
tagList.
count ), MyTagCount);
00108 
00109         
CMHelperICC2int32Const(&(aTag.
sig ), icSigProfileDescriptionTag);
00110         
CMHelperICC2int32Const(&(aTag.
offset ), currentSize);
00111         
CMHelperICC2int32Const(&(aTag.
size ), theDescSize);
00112         aProf->
tagList.
tags[0] = aTag;
00113         err =
MyAdd_NL_DescriptionTag    ( (CMTextDescriptionType *)((Ptr)aProf+currentSize), (
unsigned char *)theText );
00114         
if (err)
00115                 
goto CleanupAndExit;  
00116         currentSize += theDescSize;
00117         currentSize = ( currentSize + 3 ) & ~ 3;
00118 
00119         
CMHelperICC2int32Const(&(aTag.
sig ), icSigMediaWhitePointTag);
00120         
CMHelperICC2int32Const(&(aTag.
offset ), currentSize );
00121         
CMHelperICC2int32Const(&(aTag.
size ), theMediaSize);
00122         aProf->
tagList.
tags[1] = aTag;
00123         
MyAdd_NL_ColorantTag((
icXYZType *)((Ptr)aProf+currentSize), &D50);
00124         currentSize += theMediaSize;
00125         currentSize = ( currentSize + 3 ) & ~ 3;
00126 
00127         
CMHelperICC2int32Const(&(aTag.
sig ), icSigCopyrightTag);
00128         
CMHelperICC2int32Const(&(aTag.
offset ), currentSize );
00129         
CMHelperICC2int32Const(&(aTag.
size ), theCopyRightSize);
00130         aProf->
tagList.
tags[2] = aTag;
00131         err = 
MyAdd_NL_CopyrightTag( (
unsigned char *)copyrightText, (CMTextType *)((Ptr)aProf+currentSize));
00132         
if (err)
00133                 
goto CleanupAndExit;
00134         currentSize += theCopyRightSize;
00135         currentSize = ( currentSize + 3 ) & ~ 3;
00136                 
00137         err = 
MyAdd_NL_SequenceDescTag( profileSet, (
icProfileSequenceDescType *)((Ptr)aProf+currentSize), &theSequenceDescSize );
00138         
CMHelperICC2int32Const(&(aTag.
sig ), icSigProfileSequenceDescTag);
00139         
CMHelperICC2int32Const(&(aTag.
offset ), currentSize );
00140         
CMHelperICC2int32Const(&(aTag.
size ), theSequenceDescSize);
00141         aProf->
tagList.
tags[3] = aTag;
00142         currentSize += theSequenceDescSize;
00143         currentSize = ( currentSize + 3 ) & ~ 3;
00144 
00145     theA2B0Size = 
GetSizes( (CMMModelPtr)cw, &clutSize );
00146 
00147         
CMHelperICC2int32Const(&(aTag.
sig ), icSigAToB0Tag);
00148         
CMHelperICC2int32Const(&(aTag.
offset ), currentSize );
00149         
CMHelperICC2int32Const(&(aTag.
size ), theA2B0Size);
00150         aProf->
tagList.
tags[4] = aTag;
00151 
00152         
00153 
00154 
00155 
00156 
00157         aPtr = GlobalAllocPtr( GHND, theA2B0Size+currentSize );
00158 
00159         
if( aPtr == 0 ){
00160                 err = GetLastError();
00161                 
goto CleanupAndExit;
00162         }
00163 
00164         
if ( ((
CMMModelPtr)cw)->lutParam.colorLutWordSize == 8 )
00165         err = 
MyAdd_NL_AToB0Tag_mft1( (CMMModelPtr)cw, (
icLut8Type *)(aPtr+currentSize), clutSize );
00166     
else
00167         err = 
MyAdd_NL_AToB0Tag_mft2( (CMMModelPtr)cw, (
icLut16Type *)(aPtr+currentSize), clutSize );
00168 
00169         
if (err)
00170                 
goto CleanupAndExit;
00171 
00172         
BlockMove( (Ptr)aProf, aPtr, currentSize );
00173         aProf = (
icProfile *)
DisposeIfPtr( (Ptr)aProf );
00174 
00175         
CMHelperICC2int32Const( aPtr, theA2B0Size+currentSize );
00176 
00177         *theProf = (
icProfile *)aPtr;
00178 
#ifdef WRITE_PROFILE
00179 
        WriteProf( 
"DeviceLinkFill.pf", (
icProfile *)aPtr, theA2B0Size+currentSize );
00180 
#endif
00181 
        return noErr;
00182         
00183 CleanupAndExit:
00184         *theProf = (
icProfile *)
DisposeIfPtr( (Ptr)aProf );
00185         
if( aPtr )GlobalFreePtr( aPtr );
00186         
return err;
00187 }