00001
#include "generic.h"
00002
00003
#pragma optimize("",off)
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
void
00025 CreateINTENTControl(
00026 LPSTR FileName,
00027 LPSTR SaveFileName,
00028 DWORD Inter_Intent)
00029 {
00030
BOOL Ret;
00031
CHANDLE cp;
00032 HGLOBAL hCP;
00033 HGLOBAL hBuffer;
00034
MEMPTR lpBuffer;
00035 OFSTRUCT OfStruct;
00036 HFILE hOutput;
00037
DWORD cbSize;
00038
CSIG Intent;
00039
00040
if( !
LoadCP32( (LPCSTR)
FileName, &hCP, (
LPCHANDLE) &cp) )
00041 {
00042
return;
00043 }
00044
00045
switch (Inter_Intent)
00046 {
00047
case 0:
Intent =
icPerceptual;
break;
00048
case 1:
Intent =
icRelativeColorimetric;
break;
00049
case 2:
Intent =
icSaturation;
break;
00050
case 3:
Intent =
icAbsoluteColorimetric;
break;
00051
default:
return;
00052 }
00053
00054 Ret =
GetPS2ColorRenderingIntent(cp,
Intent,
NULL, &cbSize);
00055
if (Ret)
00056 {
00057
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00058
return;
00059 Ret =
GetPS2ColorRenderingIntent(cp,
Intent, lpBuffer, &cbSize);
00060 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00061 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00062 _lclose(hOutput);
00063
MemFree(hBuffer);
00064 }
00065
FreeCP(hCP);
00066
00067
if (!Ret)
00068 MessageBox(
GetFocus(),
"No PS2 Intent created.",
NULL, MB_OK );
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
void
00091 CreateCRDControl(
00092 LPSTR FileName,
00093 LPSTR SaveFileName,
00094 DWORD Inter_Intent,
00095 BOOL AllowBinary)
00096 {
00097
BOOL Ret;
00098
CHANDLE cp;
00099 HGLOBAL hCP;
00100 HGLOBAL hBuffer;
00101
MEMPTR lpBuffer;
00102 OFSTRUCT OfStruct;
00103 HFILE hOutput;
00104
DWORD cbSize;
00105
CSIG Intent;
00106
00107
if( !
LoadCP32( (LPCSTR)
FileName, &hCP, (
LPCHANDLE) &cp) )
00108 {
00109
return;
00110 }
00111
00112
switch (Inter_Intent)
00113 {
00114
case 0:
Intent =
icPerceptual;
break;
00115
case 1:
Intent =
icRelativeColorimetric;
break;
00116
case 2:
Intent =
icSaturation;
break;
00117
case 3:
Intent =
icAbsoluteColorimetric;
break;
00118
default:
return;
00119 }
00120
00121 Ret =
GetPS2ColorRenderingDictionary(cp,
Intent,
NULL, &cbSize,
AllowBinary);
00122
if (Ret)
00123 {
00124
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00125
return;
00126 Ret =
GetPS2ColorRenderingDictionary(cp,
Intent, lpBuffer, &cbSize,
AllowBinary);
00127 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00128 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00129 _lclose(hOutput);
00130
MemFree(hBuffer);
00131 }
00132
FreeCP(hCP);
00133
00134
if (!Ret)
00135 MessageBox(
GetFocus(),
"No CRD created.",
NULL, MB_OK );
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
void
00158 CreateProfCRDControl(
00159 LPSTR DevProfile,
00160 LPSTR TargetProfile,
00161 LPSTR SaveFileName,
00162 DWORD Inter_Intent,
00163 BOOL AllowBinary)
00164 {
00165
BOOL Ret;
00166
CHANDLE cpDev, cpTar;
00167 HGLOBAL hDevCP = 0, hTarCP = 0;
00168 HGLOBAL hBuffer;
00169
MEMPTR lpBuffer;
00170 OFSTRUCT OfStruct;
00171 HFILE hOutput;
00172
DWORD cbSize;
00173
CSIG Intent;
00174
00175
LoadCP32( (LPCSTR) DevProfile, &hDevCP, (
LPCHANDLE) &cpDev);
00176
LoadCP32( (LPCSTR)
TargetProfile, &hTarCP, (
LPCHANDLE) &cpTar);
00177
00178
if (!hDevCP || !hTarCP)
00179 {
00180
if (hDevCP)
FreeCP(hDevCP);
00181
if (hTarCP)
FreeCP(hTarCP);
00182
return;
00183 }
00184
00185
switch (Inter_Intent)
00186 {
00187
case 0:
Intent =
icPerceptual;
break;
00188
case 1:
Intent =
icRelativeColorimetric;
break;
00189
case 2:
Intent =
icSaturation;
break;
00190
case 3:
Intent =
icAbsoluteColorimetric;
break;
00191
default:
return;
00192 }
00193
00194 Ret =
GetPS2PreviewColorRenderingDictionary(cpDev, cpTar,
Intent,
NULL, &cbSize,
AllowBinary);
00195
if (Ret)
00196 {
00197
if (!
MemAlloc(cbSize, &hBuffer, &lpBuffer))
00198
return;
00199 Ret =
GetPS2PreviewColorRenderingDictionary(cpDev, cpTar,
Intent, lpBuffer, &cbSize,
AllowBinary);
00200 hOutput = OpenFile(SaveFileName, &OfStruct, OF_CREATE);
00201 cbSize = _lwrite(hOutput, lpBuffer, cbSize);
00202 _lclose(hOutput);
00203
MemFree(hBuffer);
00204 }
00205
FreeCP(hDevCP);
00206
FreeCP(hTarCP);
00207
00208
if (!Ret)
00209 MessageBox(
GetFocus(),
"No CRD created.",
NULL, MB_OK );
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
void
00232 ColorSpaceControl(
00233 LPSTR FileName,
00234 LPSTR SaveFileName,
00235 DWORD InpDrvClrSp,
00236 DWORD Intent,
00237 WORD CSAType,
00238 BOOL AllowBinary)
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 }