00086 {
00087
CMError err =
unimpErr;
00088
OSErr aOSerr =
unimpErr;
00089
#ifdef __MWERKS__
00090
unsigned char theText[] =
"\pLogColorSpProfile�";
00091
#else
00092
char theText[] =
"\024DeviceLinkProfile ";
00093
#endif
00094
char copyrightText[] =
"\060�1996 by Heidelberger Druckmaschinen AG U.J.K.";
00095
Ptr aPtr=0;
00096
long theHeaderSize;
00097
long theDescSize;
00098
long theMediaSize;
00099
long theCopyRightSize;
00100
long currentSize=0;
00101
long theTotalSize=0;
00102
long theSequenceDescSize = 0;
00103
long theA2B0Size;
00104
unsigned long aIntent;
00105
UINT32 sCS,dCS,clutSize;
00106
OSErr aOSErr;
00107
00108
00109
MyDoubleXYZ D50XYZ = { 0.9642, 1.0000, 0.8249 };
00110
icXYZNumber D50 = { (
unsigned long)(D50XYZ.
X * 65536), (
unsigned long)(D50XYZ.
Y * 65536), (
unsigned long)(D50XYZ.
Z * 65536)};
00111 theHeaderSize =
sizeof(
icHeader);
00112
00113 theDescSize =
sizeof(
OSType)
00114 +
sizeof(
unsigned long)
00115 +
sizeof(
unsigned long)
00116 + theText[0]
00117 +
sizeof(
unsigned long)
00118 +
sizeof(
unsigned long)
00119 +
sizeof(
unsigned short)
00120 +
sizeof(
unsigned char)
00121 + 67
00122 ;
00123 theCopyRightSize =
sizeof(
OSType)
00124 +
sizeof(
unsigned long)
00125 + copyrightText[0]
00126 ;
00127 theMediaSize =
sizeof(
icXYZType );;
00128
00129 aPtr =
SmartNewPtrClear( 5000, &aOSerr );
00130 err = aOSerr;
00131
if (err)
00132
goto CleanupAndExit;
00133
00134 aIntent = 0;
00135
00136 err =
MyGetColorSpaces( profileSet, &sCS, &dCS );
00137
if (err)
00138
goto CleanupAndExit;
00139
00140 err =
MyAdd_NL_HeaderMS(theHeaderSize+4, (
icHeader*)aPtr, aIntent, sCS, dCS );
00141
if (err)
00142
goto CleanupAndExit;
00143
00144 err =
SetColorProfileHeader( aHProf, (PPROFILEHEADER)aPtr);
00145
if (!err){
00146 err = GetLastError();
00147
goto CleanupAndExit;
00148 }
00149
00150 err =
MyAdd_NL_DescriptionTag ( (
LHTextDescriptionType *)aPtr, (
unsigned char *)theText );
00151
if (err)
00152
goto CleanupAndExit;
00153 err =
SetColorProfileElementSize( aHProf, icSigProfileDescriptionTag, theDescSize );
00154
if (!err){
00155 err = GetLastError();
00156
goto CleanupAndExit;
00157 }
00158 err =
SetColorProfileElement( aHProf, icSigProfileDescriptionTag, 0, (DWORD *)&theDescSize, aPtr );
00159
if (!err){
00160 err = GetLastError();
00161
goto CleanupAndExit;
00162 }
00163
00164 err =
MyAdd_NL_ColorantTag((
icXYZType *)aPtr, &D50);
00165
if (err)
00166
goto CleanupAndExit;
00167
00168 err =
SetColorProfileElementSize( aHProf, icSigMediaWhitePointTag, theMediaSize );
00169
if (!err){
00170 err = GetLastError();
00171
goto CleanupAndExit;
00172 }
00173 err =
SetColorProfileElement( aHProf, icSigMediaWhitePointTag, 0, (DWORD *)&theMediaSize, aPtr );
00174
if (!err){
00175 err = GetLastError();
00176
goto CleanupAndExit;
00177 }
00178
00179 err =
MyAdd_NL_CopyrightTag( (
unsigned char *)copyrightText, (
LHTextType *)aPtr);
00180
if (err)
00181
goto CleanupAndExit;
00182 err =
SetColorProfileElementSize( aHProf, icSigCopyrightTag, theCopyRightSize );
00183
if (!err){
00184 err = GetLastError();
00185
goto CleanupAndExit;
00186 }
00187 err =
SetColorProfileElement( aHProf, icSigCopyrightTag, 0, (DWORD *)&theCopyRightSize, aPtr );
00188
if (!err){
00189 err = GetLastError();
00190
goto CleanupAndExit;
00191 }
00192
00193 err =
MyAdd_NL_SequenceDescTag( profileSet, (
icProfileSequenceDescType *)aPtr, &theSequenceDescSize );
00194
if (err)
00195
goto CleanupAndExit;
00196 err =
SetColorProfileElementSize( aHProf, icSigProfileSequenceDescTag, theSequenceDescSize );
00197
if (!err){
00198 err = GetLastError();
00199
goto CleanupAndExit;
00200 }
00201 err =
SetColorProfileElement( aHProf, icSigProfileSequenceDescTag, 0, (DWORD *)&theSequenceDescSize, aPtr );
00202
if (!err){
00203 err = GetLastError();
00204
goto CleanupAndExit;
00205 }
00206
00207 aPtr =
DisposeIfPtr( aPtr );
00208
00209 theA2B0Size =
GetSizes( (CMMModelPtr)cw, &clutSize );
00210
00211 aPtr =
SmartNewPtr( theA2B0Size, &aOSErr );
00212 err = aOSErr;
00213
if (err)
00214
goto CleanupAndExit;
00215
00216
if ( ((
CMMModelPtr)cw)->lutParam.colorLutWordSize == 8)
00217 err =
MyAdd_NL_AToB0Tag_mft1( (CMMModelPtr)cw, (
icLut8Type *)aPtr, clutSize );
00218
else
00219 err =
MyAdd_NL_AToB0Tag_mft2( (CMMModelPtr)cw, (
icLut16Type *)aPtr, clutSize );
00220
00221
if (err)
00222
goto CleanupAndExit;
00223
00224
00225 err =
SetColorProfileElementSize( aHProf, icSigAToB0Tag, theA2B0Size );
00226
if (!err){
00227 err = GetLastError();
00228
goto CleanupAndExit;
00229 }
00230 err =
SetColorProfileElement( aHProf, icSigAToB0Tag, 0, (DWORD *)&theA2B0Size, aPtr );
00231
if (!err){
00232 err = GetLastError();
00233
goto CleanupAndExit;
00234 }
00235
00236 err =
noErr;
00237
00238 CleanupAndExit:
00239
CloseColorProfile( aHProf );
00240 aPtr =
DisposeIfPtr( aPtr );
00241
return err;
00242 }