00239 {
00240
BOOL Ret;
00241
CHANDLE cp;
00242 HGLOBAL hCP;
00243 HGLOBAL hBuffer;
00244
MEMPTR lpBuffer;
00245 OFSTRUCT OfStruct;
00246 HFILE hOutput;
00247
DWORD cbSize;
00248
CSIG ColorSpace;
00249
00250
if( !
LoadCP32( (LPCSTR) FileName, &hCP, (
LPCHANDLE) &cp) )
00251 {
00252
return;
00253 }
00254
switch (InpDrvClrSp)
00255 {
00256
case 0:
break;
00257
case 1: InpDrvClrSp =
icSigGrayData;
break;
00258
case 3: InpDrvClrSp =
icSigRgbData;
break;
00259
case 4: InpDrvClrSp =
icSigCmykData;
break;
00260
default: InpDrvClrSp = 0;
break;
00261 }
00262
00263
00264
if (CSAType == 405)
00265 {
00266 Ret =
GetPS2ColorSpaceArray(cp, Intent, InpDrvClrSp, NULL, &cbSize, AllowBinary);
00267
if (Ret)
00268 {
00269
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00270
return;
00271 Ret =
GetPS2ColorSpaceArray(cp, Intent, InpDrvClrSp, lpBuffer, &cbSize, AllowBinary);
00272
00273 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00274 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00275 _lclose(hOutput);
00276
00277
MemFree(hBuffer);
00278 }
00279 }
00280
00281
else if (CSAType == 406)
00282 {
00283 Ret =
GetPS2ColorSpaceArray(cp, Intent, icSigRgbData, NULL, &cbSize, AllowBinary);
00284
if (Ret)
00285 {
00286
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00287
return;
00288 Ret =
GetPS2ColorSpaceArray(cp, Intent, icSigRgbData, lpBuffer, &cbSize, AllowBinary);
00289
00290 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00291 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00292 _lclose(hOutput);
00293
00294
MemFree(hBuffer);
00295 }
00296 }
00297
#if 0
00298
else if (CSAType == 406)
00299 {
00300 Ret =
GetPS2CSA_ABC( cp, NULL, &cbSize, InpDrvClrSp, AllowBinary);
00301
if (Ret)
00302 {
00303
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00304
return;
00305 Ret =
GetPS2CSA_ABC( cp, lpBuffer, &cbSize, InpDrvClrSp, AllowBinary);
00306
00307 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00308 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00309 _lclose(hOutput);
00310
00311
MemFree(hBuffer);
00312 }
00313
00314 }
00315
else if ((CSAType == 407) &&
00316 (
GetCPDevSpace(cp, (
LPCSIG) &ColorSpace)))
00317 {
00318
if (ColorSpace ==
icSigRgbData)
00319 Ret =
GetPS2CSA_DEFG_Intent(cp, NULL, &cbSize,
00320 InpDrvClrSp, Intent, TYPE_CIEBASEDDEF, AllowBinary);
00321
else if (ColorSpace ==
icSigCmykData)
00322 Ret =
GetPS2CSA_DEFG_Intent(cp, NULL, &cbSize,
00323 InpDrvClrSp, Intent, TYPE_CIEBASEDDEFG, AllowBinary);
00324
if (Ret)
00325 {
00326
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00327
return;
00328
if (ColorSpace ==
icSigRgbData)
00329 Ret =
GetPS2CSA_DEFG_Intent(cp, lpBuffer, &cbSize,
00330 InpDrvClrSp, Intent, TYPE_CIEBASEDDEF, AllowBinary);
00331
else if (ColorSpace ==
icSigCmykData)
00332 Ret =
GetPS2CSA_DEFG_Intent(cp, lpBuffer, &cbSize,
00333 InpDrvClrSp, Intent, TYPE_CIEBASEDDEFG, AllowBinary);
00334 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00335 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00336 _lclose(hOutput);
00337
00338
MemFree(hBuffer);
00339 }
00340
00341 }
00342
#endif
00343
FreeCP(hCP);
00344
if (!Ret)
00345 MessageBox(
GetFocus(),
"No CRD created.", NULL, MB_OK );
00346
return;
00347 }