Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

getcsa.c

Go to the documentation of this file.
00001 #include "generic.h" 00002 #include "icmstr.h" 00003 00004 //#pragma code_seg(_ICMSEG) 00005 00006 static char *DecodeABCLab[] = {"50 mul 16 add 116 div ", 00007 "128 mul 128 sub 500 div", 00008 "128 mul 128 sub 200 div"}; 00009 00010 #pragma optimize("",off) 00011 00012 /**************************************************************************/ 00013 00014 SINT CreateColSpArray (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary); 00015 SINT CreateColSpProc (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary); 00016 SINT CreateFloatString (CHANDLE cp, MEMPTR lpMem, CSIG CPTag); 00017 static SINT SendCSABWPoint(MEMPTR lpMem, CSIG Intent, 00018 LPSFLOAT IlluminantWP, LPSFLOAT MediaWP); 00019 static void GetMediaWP(CHANDLE cp, CSIG InputIntent, 00020 LPSFLOAT IlluminantWP, LPSFLOAT MediaWP); 00021 00022 /*************************************************************************** 00023 * GetDevideRGB 00024 * function: 00025 * this is the function which creates the DeviceRGB ColorSpace (CS) 00026 * prototype: 00027 * BOOL EXTERN GetDeviceRGB( 00028 * MEMPTR lpMem, 00029 * BOOL AllowBinary) 00030 * parameters: 00031 * lpMem -- Pointer to the memory block 00032 * AllowBinary -- 1: binary CS allowed, 0: only ascii CS allowed. 00033 * returns: 00034 * returns: 00035 * BOOL -- TRUE if the function was successful, 00036 * FALSE otherwise. 00037 ***************************************************************************/ 00038 static BOOL 00039 GetDeviceRGB ( 00040 MEMPTR lpMem, 00041 LPDWORD lpcbSize, 00042 DWORD InpDrvClrSp) 00043 { 00044 MEMPTR lpOldMem = lpMem; 00045 if ((InpDrvClrSp != icSigRgbData) && 00046 (InpDrvClrSp != icSigDefData) && 00047 (InpDrvClrSp != 0)) 00048 return FALSE; 00049 00050 if (lpMem == NULL) 00051 { 00052 *lpcbSize = lstrlen (DeviceRGBTag) + 8; 00053 return (TRUE); 00054 } 00055 lpMem += WriteObject (lpMem, NewLine); 00056 lpMem += WriteObject (lpMem, DeviceRGBTag); 00057 00058 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00059 return (TRUE); 00060 } 00061 /*************************************************************************** 00062 * GetDevideCMYK 00063 * function: 00064 * this is the function which creates the DeviceCMYK ColorSpace (CS) 00065 * prototype: 00066 * BOOL EXTERN GetDeviceCMYK( 00067 * MEMPTR lpMem, 00068 * BOOL AllowBinary) 00069 * parameters: 00070 * lpMem -- Pointer to the memory block 00071 * AllowBinary -- 1: binary CS allowed, 0: only ascii CS allowed. 00072 * returns: 00073 * returns: 00074 * BOOL -- TRUE if the function was successful, 00075 * FALSE otherwise. 00076 ***************************************************************************/ 00077 00078 static BOOL 00079 GetDeviceCMYK ( 00080 MEMPTR lpMem, 00081 LPDWORD lpcbSize, 00082 DWORD InpDrvClrSp) 00083 { 00084 MEMPTR lpOldMem = lpMem; 00085 if ((InpDrvClrSp != icSigCmykData) && 00086 (InpDrvClrSp != 0)) 00087 return FALSE; 00088 if (lpMem == NULL) 00089 { 00090 *lpcbSize = lstrlen (DeviceCMYKTag) + 8; 00091 return (TRUE); 00092 } 00093 lpMem += WriteObject (lpMem, NewLine); 00094 lpMem += WriteObject (lpMem, DeviceCMYKTag); 00095 00096 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00097 return (TRUE); 00098 00099 } 00100 /*************************************************************************** 00101 * GetDeviceGray 00102 ***************************************************************************/ 00103 00104 static BOOL 00105 GetDeviceGray ( 00106 MEMPTR lpMem, 00107 LPDWORD lpcbSize, 00108 DWORD InpDrvClrSp) 00109 { 00110 MEMPTR lpOldMem = lpMem; 00111 if ((InpDrvClrSp == icSigRgbData) || 00112 (InpDrvClrSp == icSigDefData) || 00113 (InpDrvClrSp == 0)) 00114 { 00115 if (lpMem == NULL) 00116 { 00117 *lpcbSize = lstrlen (DeviceRGBTag) + 8; 00118 return (TRUE); 00119 } 00120 lpMem += WriteObject (lpMem, NewLine); 00121 lpMem += WriteObject (lpMem, DeviceRGBTag); 00122 00123 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00124 return (TRUE); 00125 } else if (InpDrvClrSp == icSigGrayData) 00126 { 00127 if (lpMem == NULL) 00128 { 00129 *lpcbSize = lstrlen (DeviceGrayTag) + 8; 00130 return (TRUE); 00131 } 00132 lpMem += WriteObject (lpMem, NewLine); 00133 lpMem += WriteObject (lpMem, DeviceGrayTag); 00134 00135 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00136 return (TRUE); 00137 } 00138 } 00139 /*************************************************************************** 00140 * GetPublicArrayName 00141 ***************************************************************************/ 00142 00143 SINT 00144 GetPublicArrayName (CHANDLE cp, CSIG IntentSig, MEMPTR PublicArrayName) 00145 { 00146 MEMPTR OldPtr; 00147 OldPtr = PublicArrayName; 00148 PublicArrayName[0] = 0; 00149 MemCopy (PublicArrayName, (MEMPTR) & IntentSig, sizeof (CSIG)); 00150 PublicArrayName += sizeof (CSIG); 00151 PublicArrayName[0] = 0; 00152 return (PublicArrayName - OldPtr); 00153 } 00154 00155 static SINT SendCSABWPoint(MEMPTR lpMem, CSIG Intent, 00156 LPSFLOAT IlluminantWP, LPSFLOAT MediaWP) 00157 { 00158 SINT i; 00159 MEMPTR lpOldMem = lpMem; 00160 00161 //********** /BlackPoint 00162 lpMem += WriteObject (lpMem, NewLine); 00163 lpMem += WriteObject (lpMem, BlackPointTag); 00164 lpMem += WriteObject (lpMem, BlackPoint); 00165 00166 //********** /WhitePoint 00167 lpMem += WriteObject (lpMem, NewLine); 00168 lpMem += WriteObject (lpMem, WhitePointTag); 00169 lpMem += WriteObject (lpMem, BeginArray); 00170 for (i = 0; i < 3; i++) 00171 { 00172 if (Intent == icAbsoluteColorimetric) 00173 { 00174 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00175 } 00176 else 00177 { 00178 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00179 } 00180 } 00181 lpMem += WriteObject (lpMem, EndArray); 00182 return (SINT)(lpMem - lpOldMem); 00183 } 00184 00185 static void GetMediaWP(CHANDLE cp, CSIG InputIntent, 00186 LPSFLOAT IlluminantWP, LPSFLOAT MediaWP) 00187 { 00188 if (InputIntent == icAbsoluteColorimetric) 00189 { 00190 if (!GetCPMediaWhitePoint (cp, (LPSFLOAT) & MediaWP)) // .. Media WhitePoint 00191 { 00192 MediaWP[0] = IlluminantWP[0]; 00193 MediaWP[1] = IlluminantWP[1]; 00194 MediaWP[2] = IlluminantWP[2]; 00195 } 00196 } 00197 } 00198 00199 SINT EnableGlobalDict(MEMPTR lpMem) 00200 { 00201 MEMPTR lpOldMem = lpMem; 00202 00203 lpMem += WriteObject (lpMem, NewLine); 00204 lpMem += WriteObject (lpMem, GlobalDictOp); 00205 lpMem += WriteObject (lpMem, BeginOp); 00206 00207 lpMem += WriteObject (lpMem, CurrentGlobalOp); 00208 lpMem += WriteObject (lpMem, TrueOp); 00209 lpMem += WriteObject (lpMem, SetGlobalOp); 00210 return (lpMem - lpOldMem); 00211 } 00212 00213 /*************************************************************************** 00214 * GetPS2CSA_DEFG 00215 * function: 00216 * this is the function which creates the CIEBasedDEF(G) ColorSpace (CS) 00217 * from the data supplied in the RGB or CMYK Input Profile. 00218 * prototype: 00219 * GetPS2CSA_DEFG( 00220 * CHANDLE cp, 00221 * MEMPTR lpMem, 00222 * LPDWORD lpcbSize, 00223 * int Type 00224 * BOOL AllowBinary) 00225 * parameters: 00226 * cp -- Color Profile handle 00227 * lpMem -- Pointer to the memory block. If this point is NULL, 00228 * require buffer size. 00229 * lpcbSize -- Size of the memory block 00230 * Type -- CieBasedDEF or CieBasedDEFG. 00231 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 00232 * returns: 00233 * BOOL -- TRUE if the function was successful, 00234 * FALSE otherwise. 00235 ***************************************************************************/ 00236 static BOOL 00237 GetPS2CSA_DEFG ( 00238 CHANDLE cp, 00239 MEMPTR lpMem, 00240 LPDWORD lpcbSize, 00241 CSIG InputIntent, 00242 SINT Index, 00243 int Type, 00244 BOOL AllowBinary) 00245 { 00246 CSIG PCS, LutTag; 00247 CSIG IntentSig; 00248 SFLOAT IlluminantWP[3]; 00249 SFLOAT MediaWP[3]; 00250 SINT nInputCh, nOutputCh, nGrids, SecondGrids; 00251 SINT nInputTable, nOutputTable, nNumbers; 00252 SINT i, j, k; 00253 MEMPTR lpTable; 00254 MEMPTR lpOldMem = lpMem; 00255 MEMPTR lpLut = NULL; 00256 MEMPTR lpLineStart; 00257 HGLOBAL hLut = 0; 00258 SINT LutSize; 00259 char PublicArrayName[TempBfSize]; 00260 // Check if we can generate the CS. 00261 // Required tags are: red, green and blue Colorants. 00262 // As for TRC tags - we are quite flexible here - if we cannot find the 00263 // required tag - we assume the linear responce 00264 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00265 (PCS != icSigLabData) && (PCS != icSigXYZData) || 00266 !GetCPTagSig (cp, Index, (LPCSIG) & IntentSig)) 00267 { 00268 return (FALSE); 00269 } 00270 if (!GetCPElementType (cp, Index, (LPCSIG) & LutTag) || 00271 ((LutTag != icSigLut8Type) && (LutTag != icSigLut16Type)) || 00272 !GetCPElementSize (cp, Index, (LPSINT) & LutSize) || 00273 !MemAlloc (LutSize, (HGLOBAL FAR *) &hLut, (LPMEMPTR) & lpLut) || 00274 !GetCPElement (cp, Index, lpLut, LutSize)) 00275 { 00276 if (0 != hLut) 00277 { 00278 MemFree (hLut); 00279 } 00280 return (FALSE); 00281 } 00282 // Estimate the memory size required to hold CS 00283 00284 GetCLUTinfo(LutTag, lpLut, &nInputCh, &nOutputCh, 00285 &nGrids, &nInputTable, &nOutputTable, &i); 00286 00287 // Level 2 printers support only tri-component CIEBasedABC input, 00288 // but can have either 3 or 4 output channels. 00289 if (!(nOutputCh == 3) || 00290 !((nInputCh == 3) && (Type == TYPE_CIEBASEDDEF)) && 00291 !((nInputCh == 4) && (Type == TYPE_CIEBASEDDEFG))) 00292 { 00293 SetCPLastError (CP_POSTSCRIPT_ERR); 00294 MemFree (hLut); 00295 return (FALSE); 00296 } 00297 if (lpMem == NULL) // This is a size request 00298 { 00299 if (Type == TYPE_CIEBASEDDEFG) 00300 *lpcbSize = nOutputCh * nGrids * nGrids * nGrids * nGrids * 2; // LUT HEX bytes 00301 else 00302 *lpcbSize = nOutputCh * nGrids * nGrids * nGrids * 2; // LUT HEX bytes 00303 00304 *lpcbSize = *lpcbSize + 00305 nInputCh * nInputTable * 6 + 00306 nOutputCh * nOutputTable * 6 + // Number of INT bytes 00307 nInputCh * (lstrlen (IndexArray) + 00308 lstrlen (StartClip) + 00309 lstrlen (EndClip)) + 00310 nOutputCh * (lstrlen (IndexArray) + 00311 lstrlen (StartClip) + 00312 lstrlen (EndClip)) + 00313 4096; // + other PS stuff 00314 00315 00316 return (TRUE); 00317 } 00318 // Get info about Illuminant White Point from the header 00319 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00320 00321 // Support absolute whitePoint 00322 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00323 00324 //*********** Testing CieBasedDEFG support 00325 lpMem += WriteObject (lpMem, NewLine); 00326 lpMem += WriteObject (lpMem, TestingDEFG); 00327 lpMem += WriteObject (lpMem, NewLine); 00328 lpMem += WriteObject (lpMem, SupportDEFG_S); 00329 00330 //*********** Creating global data 00331 GetPublicArrayName (cp, IntentSig, PublicArrayName); 00332 lpMem += WriteObject (lpMem, NewLine); 00333 if (Type == TYPE_CIEBASEDDEFG) 00334 lpMem += WriteObject (lpMem, CieBasedDEFGBegin); 00335 else 00336 lpMem += WriteObject (lpMem, CieBasedDEFBegin); 00337 00338 lpMem += EnableGlobalDict(lpMem); 00339 00340 lpMem += CreateInputArray (lpMem, nInputCh, nInputTable, 00341 (MEMPTR) PublicArrayName, LutTag, lpLut, AllowBinary, NULL); 00342 00343 if (Type == TYPE_CIEBASEDDEFG) 00344 { 00345 i = nInputTable * nInputCh + 00346 nGrids * nGrids * nGrids * nGrids * nOutputCh; 00347 } else 00348 { 00349 i = nInputTable * nInputCh + 00350 nGrids * nGrids * nGrids * nOutputCh; 00351 } 00352 lpMem += CreateOutputArray (lpMem, nOutputCh, nOutputTable, i, 00353 (MEMPTR) PublicArrayName, LutTag, lpLut, AllowBinary, NULL); 00354 00355 lpMem += WriteObject (lpMem, NewLine); 00356 lpMem += WriteObject (lpMem, SetGlobalOp); 00357 lpMem += WriteObject (lpMem, EndOp); 00358 00359 //*********** Start creating the ColorSpace 00360 lpMem += WriteObject (lpMem, NewLine); 00361 lpMem += WriteObject (lpMem, BeginArray); // Begin array 00362 00363 //********** /CIEBasedDEF(G) 00364 if (Type == TYPE_CIEBASEDDEFG) 00365 lpMem += WriteObject (lpMem, CIEBasedDEFGTag); 00366 else 00367 lpMem += WriteObject (lpMem, CIEBasedDEFTag); 00368 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00369 00370 //********** Black/White Point 00371 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00372 00373 //********** /DecodeDEF(G) 00374 lpLineStart = lpMem; 00375 lpMem += WriteObject (lpMem, NewLine); 00376 if (Type == TYPE_CIEBASEDDEFG) 00377 lpMem += WriteObject (lpMem, DecodeDEFGTag); 00378 else 00379 lpMem += WriteObject (lpMem, DecodeDEFTag); 00380 00381 lpMem += WriteObject (lpMem, BeginArray); 00382 for (i = 0; i < nInputCh; i++) 00383 { 00384 lpLineStart = lpMem; 00385 lpMem += WriteObject (lpMem, NewLine); 00386 00387 lpMem += WriteObject (lpMem, BeginFunction); 00388 #if 0 00389 if (PCS == icSigLabData) 00390 { 00391 lpMem += WriteObject (lpMem, 00392 (0 == i) ? EncodeABCLab1 : EncodeABCLab2); 00393 } 00394 #endif 00395 lpMem += WriteObject (lpMem, StartClip); 00396 lpMem += WriteObject (lpMem, InputArray); 00397 lpMem += WriteObjectN (lpMem, (MEMPTR) PublicArrayName, lstrlen (PublicArrayName)); 00398 lpMem += WriteInt (lpMem, i); 00399 00400 if (!AllowBinary) // Output ASCII 00401 { 00402 lpMem += WriteObject (lpMem, IndexArray); 00403 } else 00404 { // Output BINARY 00405 if (LutTag == icSigLut8Type) 00406 { 00407 lpMem += WriteObject (lpMem, IndexArray); 00408 } else 00409 { 00410 lpMem += WriteObject (lpMem, IndexArray16b); 00411 } 00412 } 00413 lpMem += WriteObject (lpMem, (LutTag == icSigLut8Type) ? Scale8 : Scale16); 00414 lpMem += WriteObject (lpMem, EndClip); 00415 lpMem += WriteObject (lpMem, EndFunction); 00416 } 00417 lpMem += WriteObject (lpMem, EndArray); 00418 00419 //********** /Table 00420 lpMem += WriteObject (lpMem, NewLine); 00421 lpMem += WriteObject (lpMem, TableTag); 00422 lpMem += WriteObject (lpMem, BeginArray); 00423 00424 lpMem += WriteInt (lpMem, nGrids); // Send down Nh 00425 lpMem += WriteInt (lpMem, nGrids); // Send down Ni 00426 lpMem += WriteInt (lpMem, nGrids); // Send down Nj 00427 nNumbers = nGrids * nGrids * nOutputCh; 00428 SecondGrids = 1; 00429 if (Type == TYPE_CIEBASEDDEFG) 00430 { 00431 lpMem += WriteInt (lpMem, nGrids); // Send down Nk 00432 // nNumbers = nGrids * nGrids * nGrids * nOutputCh ; 00433 SecondGrids = nGrids; 00434 } 00435 lpMem += WriteObject (lpMem, NewLine); 00436 lpMem += WriteObject (lpMem, BeginArray); 00437 for (i = 0; i < nGrids; i++) // Nh strings should be sent 00438 { 00439 if (Type == TYPE_CIEBASEDDEFG) 00440 { 00441 lpMem += WriteObject (lpMem, NewLine); 00442 lpMem += WriteObject (lpMem, BeginArray); 00443 } 00444 for (k = 0; k < SecondGrids; k++) 00445 { 00446 lpLineStart = lpMem; 00447 lpMem += WriteObject (lpMem, NewLine); 00448 if (LutTag == icSigLut8Type) 00449 { 00450 lpTable = (MEMPTR) (((lpcpLut8Type) lpLut)->lut.data) + 00451 nInputTable * nInputCh + 00452 nNumbers * (i * SecondGrids + k); 00453 } else 00454 { 00455 lpTable = (MEMPTR) (((lpcpLut16Type) lpLut)->lut.data) + 00456 2 * nInputTable * nInputCh + 00457 2 * nNumbers * (i * SecondGrids + k); 00458 } 00459 00460 if (!AllowBinary) // Output ASCII 00461 { 00462 lpMem += WriteObject (lpMem, BeginString); 00463 if (LutTag == icSigLut8Type) 00464 lpMem += WriteHexBuffer (lpMem, lpTable, lpLineStart, nNumbers); 00465 else 00466 { 00467 for (j = 0; j < nNumbers; j++) 00468 { 00469 lpMem += WriteHex (lpMem, ui16toSINT (lpTable) / 256); 00470 lpTable += sizeof (icUInt16Number); 00471 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 00472 { 00473 lpLineStart = lpMem; 00474 lpMem += WriteObject (lpMem, NewLine); 00475 } 00476 } 00477 } 00478 lpMem += WriteObject (lpMem, EndString); 00479 } else 00480 { // Output BINARY 00481 lpMem += WriteStringToken (lpMem, 143, nNumbers); 00482 if (LutTag == icSigLut8Type) 00483 lpMem += WriteByteString (lpMem, lpTable, nNumbers); 00484 else 00485 lpMem += WriteInt2ByteString (lpMem, lpTable, nNumbers); 00486 } 00487 lpMem += WriteObject (lpMem, NewLine); 00488 } 00489 if (Type == TYPE_CIEBASEDDEFG) 00490 { 00491 lpMem += WriteObject (lpMem, EndArray); 00492 } 00493 } 00494 lpMem += WriteObject (lpMem, EndArray); 00495 lpMem += WriteObject (lpMem, EndArray); // End array 00496 00497 //********** /DecodeABC 00498 lpLineStart = lpMem; 00499 lpMem += WriteObject (lpMem, NewLine); 00500 lpMem += WriteObject (lpMem, DecodeABCTag); 00501 lpMem += WriteObject (lpMem, BeginArray); 00502 for (i = 0; i < nOutputCh; i++) 00503 { 00504 lpLineStart = lpMem; 00505 lpMem += WriteObject (lpMem, NewLine); 00506 00507 lpMem += WriteObject (lpMem, BeginFunction); 00508 lpMem += WriteObject (lpMem, Clip01); 00509 lpMem += WriteObject (lpMem, OutputArray); 00510 lpMem += WriteObjectN (lpMem, (MEMPTR) PublicArrayName, lstrlen (PublicArrayName)); 00511 lpMem += WriteInt (lpMem, i); 00512 00513 if (!AllowBinary) // Output ASCII CRD 00514 { 00515 lpMem += WriteObject (lpMem, NewLine); 00516 00517 if (LutTag == icSigLut8Type) 00518 { 00519 lpMem += WriteObject (lpMem, TFunction8XYZ); 00520 } else 00521 { 00522 lpMem += WriteObject (lpMem, IndexArray); 00523 lpMem += WriteObject (lpMem, Scale16XYZ); 00524 } 00525 } else 00526 { // Output BINARY CRD 00527 if (LutTag == icSigLut8Type) 00528 { 00529 lpMem += WriteObject (lpMem, TFunction8XYZ); 00530 } else 00531 { 00532 lpMem += WriteObject (lpMem, IndexArray16b); 00533 lpMem += WriteObject (lpMem, Scale16XYZ); 00534 } 00535 } 00536 00537 // Now, We get CieBasedXYZ output. Output range 0 --> 1.99997 00538 // If the connection space is absolute XYZ, We need to convert 00539 // from relative XYZ to absolute XYZ. 00540 if ((PCS == icSigXYZData) && 00541 (InputIntent == icAbsoluteColorimetric)) 00542 { 00543 lpMem += WriteFloat (lpMem, (double)MediaWP[i]/IlluminantWP[i]); 00544 lpMem += WriteObject (lpMem, MulOp); 00545 } 00546 // If the connection space is Lab, We need to convert XYZ to Lab. 00547 else if (PCS == icSigLabData) 00548 lpMem += WriteObject (lpMem, DecodeABCLab[i]); 00549 lpMem += WriteObject (lpMem, EndFunction); 00550 } 00551 lpMem += WriteObject (lpMem, EndArray); 00552 00553 if (PCS == icSigLabData) 00554 { 00555 //********** /MatrixABC 00556 lpMem += WriteObject (lpMem, NewLine); 00557 lpMem += WriteObject (lpMem, MatrixABCTag); 00558 lpMem += WriteObject (lpMem, MatrixABCLab); 00559 00560 //********** /DecodeLMN 00561 lpLineStart = lpMem; 00562 lpMem += WriteObject (lpMem, NewLine); 00563 lpMem += WriteObject (lpMem, DecodeLMNTag); 00564 lpMem += WriteObject (lpMem, BeginArray); 00565 for (i = 0; i < 3; i++) 00566 { 00567 lpLineStart = lpMem; 00568 lpMem += WriteObject (lpMem, NewLine); 00569 00570 lpMem += WriteObject (lpMem, BeginFunction); 00571 lpMem += WriteObject (lpMem, DecodeLMNLab); 00572 if (InputIntent == icAbsoluteColorimetric) 00573 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00574 else 00575 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00576 lpMem += WriteObject (lpMem, MulOp); 00577 lpMem += WriteObject (lpMem, EndFunction); 00578 } 00579 lpMem += WriteObject (lpMem, EndArray); 00580 } else 00581 { 00582 //********** /RangeLMN 00583 lpMem += WriteObject (lpMem, NewLine); 00584 lpMem += WriteObject (lpMem, RangeLMNTag); 00585 lpMem += WriteObject (lpMem, RangeLMN); 00586 } 00587 00588 //********** End dictionary definition 00589 lpMem += WriteObject (lpMem, NewLine); 00590 lpMem += WriteObject (lpMem, EndDict); 00591 lpMem += WriteObject (lpMem, EndArray); 00592 00593 lpMem += WriteObject (lpMem, NewLine); 00594 if (Type == TYPE_CIEBASEDDEFG) 00595 lpMem += WriteObject (lpMem, CieBasedDEFGEnd); 00596 else 00597 lpMem += WriteObject (lpMem, CieBasedDEFEnd); 00598 00599 lpMem += WriteObject (lpMem, NewLine); 00600 lpMem += WriteObject (lpMem, SupportDEFG_E); 00601 00602 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00603 00604 MemFree (hLut); 00605 return (TRUE); 00606 } 00607 00608 00609 /*************************************************************************** 00610 * GetPS2CSA_ABC 00611 * function: 00612 * this is the function which creates the CIEBasedABC ColorSpace (CS) 00613 * from the data supplied in the RGB Input Profile. 00614 * prototype: 00615 * GetPS2CSA_ABC( 00616 * CHANDLE cp, 00617 * MEMPTR lpMem, 00618 * LPDWORD lpcbSize, 00619 * BOOL AllowBinary) 00620 * parameters: 00621 * cp -- Color Profile handle 00622 * lpMem -- Pointer to the memory block. If this point is NULL, 00623 * require buffer size. 00624 * lpcbSize -- Size of the memory block 00625 * InputIntent -- 00626 * InpDrvClrSp -- 00627 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 00628 * returns: 00629 * BOOL -- TRUE if the function was successful, 00630 * FALSE otherwise. 00631 ***************************************************************************/ 00632 00633 BOOL 00634 GetPS2CSA_ABC (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, 00635 CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary) 00636 { 00637 CSIG PCS, Dev; 00638 SFLOAT IlluminantWP[3]; 00639 SFLOAT MediaWP[3]; 00640 00641 SINT i; 00642 MEMPTR lpOldMem = lpMem; 00643 SINT Ret = 0; 00644 // Check if we can generate the CS. 00645 // Required tags are: red, green and blue Colorants. 00646 // As for TRC tags - we are quite flexible here - if we cannot find the 00647 // required tag - we assume the linear responce 00648 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00649 !GetCPDevSpace (cp, (LPCSIG) & Dev) || 00650 (Dev != icSigRgbData) || 00651 !DoesCPTagExist (cp, icSigRedColorantTag) || 00652 !DoesCPTagExist (cp, icSigGreenColorantTag) || 00653 !DoesCPTagExist (cp, icSigBlueColorantTag) || 00654 !DoesCPTagExist (cp, icSigRedTRCTag) || 00655 !DoesCPTagExist (cp, icSigGreenTRCTag) || 00656 !DoesCPTagExist (cp, icSigBlueTRCTag)) 00657 { 00658 return (FALSE); 00659 } 00660 if ((InpDrvClrSp != icSigRgbData) && 00661 (InpDrvClrSp != icSigDefData) && 00662 (InpDrvClrSp != 0)) 00663 { 00664 return (FALSE); 00665 } 00666 // Estimate the memory size required to hold CS 00667 00668 if (lpMem == NULL) // This is a size request 00669 { 00670 *lpcbSize = 65530; 00671 return (TRUE); 00672 } 00673 // Get info about Illuminant White Point from the header 00674 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00675 00676 // Support absolute whitePoint 00677 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00678 00679 //*********** Creating global data 00680 lpMem += WriteObject (lpMem, NewLine); 00681 lpMem += WriteObject (lpMem, CieBasedABCBegin); 00682 00683 lpMem += EnableGlobalDict(lpMem); 00684 00685 lpMem += CreateColSpArray (cp, lpMem, icSigRedTRCTag, AllowBinary); 00686 lpMem += CreateColSpArray (cp, lpMem, icSigGreenTRCTag, AllowBinary); 00687 lpMem += CreateColSpArray (cp, lpMem, icSigBlueTRCTag, AllowBinary); 00688 00689 lpMem += WriteObject (lpMem, NewLine); 00690 lpMem += WriteObject (lpMem, SetGlobalOp); 00691 lpMem += WriteObject (lpMem, EndOp); 00692 00693 00694 //*********** Start creating the ColorSpace 00695 lpMem += WriteObject (lpMem, NewLine); 00696 lpMem += WriteObject (lpMem, BeginArray); // Begin array 00697 //********** /CIEBasedABC 00698 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00699 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00700 00701 //********** Black/White Point 00702 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00703 00704 //********** /DecodeABC 00705 lpMem += WriteObject (lpMem, NewLine); 00706 lpMem += WriteObject (lpMem, DecodeABCTag); 00707 lpMem += WriteObject (lpMem, BeginArray); 00708 00709 lpMem += WriteObject (lpMem, NewLine); 00710 lpMem += CreateColSpProc (cp, lpMem, icSigRedTRCTag, AllowBinary); 00711 lpMem += WriteObject (lpMem, NewLine); 00712 lpMem += CreateColSpProc (cp, lpMem, icSigGreenTRCTag, AllowBinary); 00713 lpMem += WriteObject (lpMem, NewLine); 00714 lpMem += CreateColSpProc (cp, lpMem, icSigBlueTRCTag, AllowBinary); 00715 lpMem += WriteObject (lpMem, EndArray); 00716 00717 //********** /MatrixABC 00718 lpMem += WriteObject (lpMem, NewLine); 00719 lpMem += WriteObject (lpMem, MatrixABCTag); 00720 lpMem += WriteObject (lpMem, BeginArray); 00721 00722 lpMem += CreateFloatString (cp, lpMem, icSigRedColorantTag); 00723 lpMem += CreateFloatString (cp, lpMem, icSigGreenColorantTag); 00724 lpMem += CreateFloatString (cp, lpMem, icSigBlueColorantTag); 00725 00726 lpMem += WriteObject (lpMem, EndArray); 00727 00728 //********** /RangeLMN 00729 lpMem += WriteObject (lpMem, NewLine); 00730 lpMem += WriteObject (lpMem, RangeLMNTag); 00731 lpMem += WriteObject (lpMem, RangeLMN); 00732 00733 //********** /DecodeLMN 00734 if (InputIntent == icAbsoluteColorimetric) 00735 { 00736 // Support absolute whitePoint 00737 lpMem += WriteObject (lpMem, NewLine); 00738 lpMem += WriteObject (lpMem, DecodeLMNTag); 00739 lpMem += WriteObject (lpMem, BeginArray); 00740 for (i = 0; i < 3; i ++) 00741 { 00742 lpMem += WriteObject (lpMem, BeginFunction); 00743 lpMem += WriteFloat (lpMem, (double)MediaWP[i]/IlluminantWP[i]); 00744 lpMem += WriteObject (lpMem, MulOp); 00745 lpMem += WriteObject (lpMem, EndFunction); 00746 } 00747 lpMem += WriteObject (lpMem, EndArray); 00748 } 00749 00750 //********** End dictionary definition 00751 lpMem += WriteObject (lpMem, NewLine); 00752 lpMem += WriteObject (lpMem, EndDict); 00753 lpMem += WriteObject (lpMem, EndArray); 00754 00755 lpMem += WriteObject (lpMem, NewLine); 00756 lpMem += WriteObject (lpMem, CieBasedABCEnd); 00757 *lpcbSize = (DWORD) ((lpMem - lpOldMem)); 00758 return (TRUE); 00759 } 00760 00761 /*************************************************************************** 00762 * GetPS2CSA_ABC_LAB 00763 * function: 00764 * this is the function which creates the CIEBasedABC ColorSpace (CS) 00765 * from the data supplied in the LAB Input Profile. 00766 * prototype: 00767 * GetPS2CSA_ABC( 00768 * CHANDLE cp, 00769 * MEMPTR lpMem, 00770 * LPDWORD lpcbSize, 00771 * BOOL AllowBinary) 00772 * parameters: 00773 * cp -- Color Profile handle 00774 * lpMem -- Pointer to the memory block. If this point is NULL, 00775 * require buffer size. 00776 * lpcbSize -- Size of the memory block 00777 * InputIntent -- 00778 * InpDrvClrSp -- 00779 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 00780 * returns: 00781 * BOOL -- TRUE if the function was successful, 00782 * FALSE otherwise. 00783 ***************************************************************************/ 00784 00785 BOOL 00786 GetPS2CSA_ABC_LAB (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, 00787 CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary) 00788 { 00789 CSIG PCS, Dev; 00790 SFLOAT IlluminantWP[3]; 00791 SFLOAT MediaWP[3]; 00792 00793 SINT i; 00794 MEMPTR lpOldMem = lpMem; 00795 SINT Ret = 0; 00796 // Check if we can generate the CS. 00797 // Required tags are: red, green and blue Colorants. 00798 // As for TRC tags - we are quite flexible here - if we cannot find the 00799 // required tag - we assume the linear responce 00800 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00801 !GetCPDevSpace (cp, (LPCSIG) & Dev) || 00802 (Dev != icSigLabData)) 00803 { 00804 return (FALSE); 00805 } 00806 if ((InpDrvClrSp != icSigLabData) && 00807 (InpDrvClrSp != icSigDefData) && 00808 (InpDrvClrSp != 0)) 00809 { 00810 return (FALSE); 00811 } 00812 // Estimate the memory size required to hold CS 00813 00814 if (lpMem == NULL) // This is a size request 00815 { 00816 *lpcbSize = 65530; 00817 return (TRUE); 00818 } 00819 // Get info about Illuminant White Point from the header 00820 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00821 00822 // Support absolute whitePoint 00823 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00824 00825 //*********** Start creating the ColorSpace 00826 lpMem += WriteObject (lpMem, NewLine); 00827 lpMem += WriteObject (lpMem, BeginArray); // Begin array 00828 00829 //********** /CIEBasedABC 00830 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00831 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00832 00833 //********** Black/White Point 00834 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00835 00836 //********** /RangeABC 00837 lpMem += WriteObject (lpMem, NewLine); 00838 lpMem += WriteObject (lpMem, RangeABCTag); 00839 lpMem += WriteObject (lpMem, RangeABC_Lab); 00840 00841 //********** /DecodeABC 00842 lpMem += WriteObject (lpMem, NewLine); 00843 lpMem += WriteObject (lpMem, DecodeABCTag); 00844 lpMem += WriteObject (lpMem, DecodeABCLab1); 00845 00846 //********** /MatrixABC 00847 lpMem += WriteObject (lpMem, NewLine); 00848 lpMem += WriteObject (lpMem, MatrixABCTag); 00849 lpMem += WriteObject (lpMem, MatrixABCLab); 00850 00851 //********** /DecodeLMN 00852 lpMem += WriteObject (lpMem, NewLine); 00853 lpMem += WriteObject (lpMem, DecodeLMNTag); 00854 lpMem += WriteObject (lpMem, BeginArray); 00855 for (i = 0; i < 3; i ++) 00856 { 00857 lpMem += WriteObject (lpMem, BeginFunction); 00858 lpMem += WriteObject (lpMem, DecodeLMNLab); 00859 if (InputIntent == icAbsoluteColorimetric) 00860 { 00861 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00862 } 00863 else 00864 { 00865 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00866 } 00867 lpMem += WriteObject (lpMem, MulOp); 00868 lpMem += WriteObject (lpMem, EndFunction); 00869 lpMem += WriteObject (lpMem, NewLine); 00870 } 00871 lpMem += WriteObject (lpMem, EndArray); 00872 00873 00874 //********** End dictionary definition 00875 lpMem += WriteObject (lpMem, NewLine); 00876 lpMem += WriteObject (lpMem, EndDict); 00877 lpMem += WriteObject (lpMem, EndArray); 00878 00879 lpMem += WriteObject (lpMem, NewLine); 00880 lpMem += WriteObject (lpMem, CieBasedABCEnd); 00881 *lpcbSize = (DWORD) ((lpMem - lpOldMem)); 00882 return (TRUE); 00883 } 00884 00885 /*************************************************************************** 00886 * GetPS2CSA_MONO_ABC 00887 * function: 00888 * this is the function which creates the CIEBasedABC ColorSpace (CS) 00889 * from the data supplied in the GRAY Input Profile. 00890 * prototype: 00891 * GetPS2CSA_MONO_ABC( 00892 * CHANDLE cp, 00893 * MEMPTR lpMem, 00894 * LPDWORD lpcbSize, 00895 * BOOL AllowBinary) 00896 * parameters: 00897 * cp -- Color Profile handle 00898 * lpMem -- Pointer to the memory block. If this point is NULL, 00899 * require buffer size. 00900 * lpcbSize -- Size of the memory block 00901 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 00902 * returns: 00903 * BOOL -- TRUE if the function was successful, 00904 * FALSE otherwise. 00905 ***************************************************************************/ 00906 00907 static BOOL 00908 GetPS2CSA_MONO_ABC (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, 00909 CSIG InputIntent, BOOL AllowBinary) 00910 { 00911 SINT nCount; 00912 CSIG Tag, PCS; 00913 SINT i, j, Index; 00914 MEMPTR lpTable; 00915 SFLOAT IlluminantWP[3]; 00916 SFLOAT MediaWP[3]; 00917 MEMPTR lpBuff = NULL; 00918 SINT MemSize = 0; 00919 MEMPTR lpOldMem = lpMem; 00920 HGLOBAL hBuff; 00921 MEMPTR lpLineStart; 00922 // Check if we can generate the CS 00923 if (!DoesCPTagExist (cp, icSigGrayTRCTag) || 00924 !GetCPTagIndex (cp, icSigGrayTRCTag, &Index) || 00925 !GetCPElementType (cp, Index, (LPCSIG) & Tag) || 00926 (Tag != icSigCurveType) || 00927 !GetCPConnSpace (cp, (LPCSIG) & PCS) || 00928 !GetCPElementSize (cp, Index, (LPSINT) & MemSize) || 00929 !MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & lpBuff) || 00930 !GetCPElement (cp, Index, lpBuff, MemSize)) 00931 { 00932 if (NULL != lpBuff) 00933 { 00934 MemFree (hBuff); 00935 } 00936 return (FALSE); 00937 } 00938 nCount = ui32toSINT (((lpcpCurveType) lpBuff)->curve.count); 00939 00940 // Estimate the memory size required to hold CS 00941 *lpcbSize = nCount * 6 + // Number of INT elements 00942 3 * (lstrlen (IndexArray) + 00943 lstrlen (StartClip) + 00944 lstrlen (EndClip)) + 00945 2048; // + other PS stuff 00946 if (lpMem == NULL) // This is a size request 00947 { 00948 MemFree (hBuff); 00949 return (TRUE); 00950 } 00951 // Get info about Illuminant White Point from the header 00952 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00953 00954 // Support absolute whitePoint 00955 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00956 00957 //*********** Start creating the ColorSpace 00958 lpMem += WriteObject (lpMem, NewLine); 00959 lpMem += WriteObject (lpMem, CieBasedABCBegin); 00960 00961 lpMem += WriteObject (lpMem, NewLine); 00962 lpMem += WriteObject (lpMem, BeginArray); // Begin array 00963 //********** /CIEBasedABC 00964 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00965 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00966 00967 //********** Black/White Point 00968 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00969 00970 //********** /DecodeABC 00971 lpMem += WriteObject (lpMem, NewLine); 00972 lpLineStart = lpMem; 00973 00974 if (nCount != 0) 00975 { 00976 lpMem += WriteObject (lpMem, DecodeABCTag); 00977 lpMem += WriteObject (lpMem, BeginArray); 00978 00979 lpMem += WriteObject (lpMem, BeginFunction); 00980 if (nCount == 1) // Gamma supplied in ui16 format 00981 { 00982 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 00983 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 00984 lpMem += WriteObject (lpMem, DecodeA3); 00985 } else 00986 { 00987 lpMem += WriteObject (lpMem, StartClip); 00988 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 00989 lpMem += WriteObject (lpMem, BeginArray); 00990 for (i = 0; i < nCount; i++) 00991 { 00992 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 00993 lpTable += sizeof (icUInt16Number); 00994 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 00995 { 00996 lpLineStart = lpMem; 00997 lpMem += WriteObject (lpMem, NewLine); 00998 } 00999 } 01000 lpMem += WriteObject (lpMem, EndArray); 01001 lpLineStart = lpMem; 01002 lpMem += WriteObject (lpMem, NewLine); 01003 01004 lpMem += WriteObject (lpMem, IndexArray); 01005 lpMem += WriteObject (lpMem, Scale16); 01006 lpMem += WriteObject (lpMem, EndClip); 01007 } 01008 lpMem += WriteObject (lpMem, EndFunction); 01009 lpMem += WriteObject (lpMem, DupOp); 01010 lpMem += WriteObject (lpMem, DupOp); 01011 lpMem += WriteObject (lpMem, EndArray); 01012 } 01013 //********** /MatrixABC 01014 lpMem += WriteObject (lpMem, NewLine); 01015 lpMem += WriteObject (lpMem, MatrixABCTag); 01016 lpMem += WriteObject (lpMem, BeginArray); 01017 for (i = 0; i < 3; i ++) 01018 { 01019 for (j = 0; j < 3; j++) 01020 { 01021 if (i != j) 01022 lpMem += WriteFloat (lpMem, (double)0); 01023 else 01024 { 01025 if (InputIntent == icAbsoluteColorimetric) 01026 lpMem += WriteFloat (lpMem, (double)MediaWP[i]); 01027 else 01028 lpMem += WriteFloat (lpMem, (double)IlluminantWP[i]); 01029 } 01030 } 01031 } 01032 lpMem += WriteObject (lpMem, EndArray); 01033 01034 //********** /RangeLMN 01035 lpMem += WriteObject (lpMem, NewLine); 01036 lpMem += WriteObject (lpMem, RangeLMNTag); 01037 lpMem += WriteObject (lpMem, RangeLMN); 01038 01039 01040 lpMem += WriteObject (lpMem, EndDict); // End dictionary definition 01041 lpMem += WriteObject (lpMem, EndArray); 01042 01043 MemFree (hBuff); 01044 01045 lpMem += WriteObject (lpMem, NewLine); 01046 lpMem += WriteObject (lpMem, CieBasedABCEnd); 01047 *lpcbSize = (DWORD) (lpMem - lpOldMem); 01048 return (TRUE); 01049 } 01050 /*************************************************************************** 01051 * GetPS2CSA_MONO_A 01052 * function: 01053 * this is the function which creates the CIEBasedA ColorSpace (CS) 01054 * from the data supplied in the GRAY Input Profile. 01055 * prototype: 01056 * GetPS2CSA_MONO_A( 01057 * CHANDLE cp, 01058 * MEMPTR lpMem, 01059 * LPDWORD lpcbSize, 01060 * BOOL AllowBinary) 01061 * parameters: 01062 * cp -- Color Profile handle 01063 * lpMem -- Pointer to the memory block. If this point is NULL, 01064 * require buffer size. 01065 * lpcbSize -- Size of the memory block 01066 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 01067 * returns: 01068 * BOOL -- TRUE if the function was successful, 01069 * FALSE otherwise. 01070 ***************************************************************************/ 01071 01072 static BOOL 01073 GetPS2CSA_MONO_A (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, 01074 CSIG InputIntent, BOOL AllowBinary) 01075 { 01076 SINT nCount; 01077 CSIG Tag, PCS; 01078 SINT i, Index; 01079 MEMPTR lpTable; 01080 SFLOAT IlluminantWP[3]; 01081 SFLOAT MediaWP[3]; 01082 MEMPTR lpBuff = NULL; 01083 SINT MemSize = 0; 01084 MEMPTR lpOldMem = lpMem; 01085 HGLOBAL hBuff; 01086 MEMPTR lpLineStart; 01087 // Check if we can generate the CS 01088 if (!DoesCPTagExist (cp, icSigGrayTRCTag) || 01089 !GetCPTagIndex (cp, icSigGrayTRCTag, &Index) || 01090 !GetCPElementType (cp, Index, (LPCSIG) & Tag) || 01091 (Tag != icSigCurveType) || 01092 !GetCPConnSpace (cp, (LPCSIG) & PCS) || 01093 !GetCPElementSize (cp, Index, (LPSINT) & MemSize) || 01094 !MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & lpBuff) || 01095 !GetCPElement (cp, Index, lpBuff, MemSize)) 01096 { 01097 if (NULL != lpBuff) 01098 { 01099 MemFree (hBuff); 01100 } 01101 return (FALSE); 01102 } 01103 nCount = ui32toSINT (((lpcpCurveType) lpBuff)->curve.count); 01104 01105 // Estimate the memory size required to hold CS 01106 *lpcbSize = nCount * 6 + // Number of INT elements 01107 3 * (lstrlen (IndexArray) + 01108 lstrlen (StartClip) + 01109 lstrlen (EndClip)) + 01110 2048; // + other PS stuff 01111 if (lpMem == NULL) // This is a size request 01112 { 01113 MemFree (hBuff); 01114 return (TRUE); 01115 } 01116 // Get info about Illuminant White Point from the header 01117 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 01118 01119 // Support absolute whitePoint 01120 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 01121 01122 //*********** Start creating the ColorSpace 01123 lpMem += WriteObject (lpMem, NewLine); 01124 lpMem += WriteObject (lpMem, CieBasedABegin); 01125 01126 lpMem += WriteObject (lpMem, NewLine); 01127 lpMem += WriteObject (lpMem, BeginArray); // Begin array 01128 //********** /CIEBasedA 01129 lpMem += WriteObject (lpMem, CIEBasedATag); // Create entry 01130 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 01131 01132 //********** Black/White Point 01133 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 01134 01135 //********** /DecodeA 01136 lpMem += WriteObject (lpMem, NewLine); 01137 lpLineStart = lpMem; 01138 01139 if (nCount != 0) 01140 { 01141 lpMem += WriteObject (lpMem, DecodeATag); 01142 lpMem += WriteObject (lpMem, BeginArray); 01143 01144 lpMem += WriteObject (lpMem, BeginFunction); 01145 if (nCount == 1) // Gamma supplied in ui16 format 01146 { 01147 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 01148 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01149 lpMem += WriteObject (lpMem, DecodeA3); 01150 // If the PCS is Lab, we need to convert Lab to XYZ 01151 // Now, the range is from 0 --> 0.99997. 01152 // Actually, the conversion from Lab to XYZ is not needed. 01153 if (PCS == icSigLabData) 01154 { 01155 lpMem += WriteObject (lpMem, DecodeALab); 01156 lpMem += WriteObject (lpMem, DecodeLMNLab); 01157 } 01158 } else 01159 { 01160 lpMem += WriteObject (lpMem, StartClip); 01161 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 01162 lpMem += WriteObject (lpMem, BeginArray); 01163 for (i = 0; i < nCount; i++) 01164 { 01165 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01166 lpTable += sizeof (icUInt16Number); 01167 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 01168 { 01169 lpLineStart = lpMem; 01170 lpMem += WriteObject (lpMem, NewLine); 01171 } 01172 } 01173 lpMem += WriteObject (lpMem, EndArray); 01174 lpLineStart = lpMem; 01175 lpMem += WriteObject (lpMem, NewLine); 01176 01177 lpMem += WriteObject (lpMem, IndexArray); 01178 lpMem += WriteObject (lpMem, Scale16); 01179 // If the PCS is Lab, we need to convert Lab to XYZ 01180 // Now, the range is from 0 --> .99997. 01181 // Actually, the conversion from Lab to XYZ is not needed. 01182 if (PCS == icSigLabData) 01183 { 01184 lpMem += WriteObject (lpMem, DecodeALab); 01185 lpMem += WriteObject (lpMem, DecodeLMNLab); 01186 } 01187 lpMem += WriteObject (lpMem, EndClip); 01188 } 01189 lpMem += WriteObject (lpMem, EndFunction); 01190 lpMem += WriteObject (lpMem, EndArray); 01191 } 01192 01193 //********** /MatrixA 01194 lpMem += WriteObject (lpMem, NewLine); 01195 lpMem += WriteObject (lpMem, MatrixATag); 01196 lpMem += WriteObject (lpMem, BeginArray); 01197 for (i = 0; i < 3; i++) 01198 { 01199 if (InputIntent == icAbsoluteColorimetric) 01200 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 01201 else 01202 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 01203 } 01204 lpMem += WriteObject (lpMem, EndArray); 01205 01206 //********** /RangeLMN 01207 lpMem += WriteObject (lpMem, NewLine); 01208 lpMem += WriteObject (lpMem, RangeLMNTag); 01209 lpMem += WriteObject (lpMem, RangeLMN); 01210 01211 //********** /End dictionary 01212 lpMem += WriteObject (lpMem, EndDict); // End dictionary definition 01213 lpMem += WriteObject (lpMem, EndArray); 01214 01215 MemFree (hBuff); 01216 01217 lpMem += WriteObject (lpMem, NewLine); 01218 lpMem += WriteObject (lpMem, CieBasedAEnd); 01219 *lpcbSize = (DWORD) (lpMem - lpOldMem); 01220 return (TRUE); 01221 } 01222 /*************************************************************************** 01223 * GetPS2CSA_MONO 01224 * function: 01225 * this is the function which creates the MONO ColorSpace (CS) 01226 * from the data supplied in the GRAY Input Profile. 01227 * prototype: 01228 * GetPS2CSA_MONO( 01229 * CHANDLE cp, 01230 * MEMPTR lpMem, 01231 * LPDWORD lpcbSize, 01232 * WORD InpDrvClrSp 01233 * BOOL AllowBinary) 01234 * parameters: 01235 * cp -- Color Profile handle 01236 * lpMem -- Pointer to the memory block. If this point is NULL, 01237 * require buffer size. 01238 * lpcbSize -- Size of the memory block 01239 * InpDrvClrSp -- Device color type (RGB or GRAY). 01240 * AllowBinary -- 1: binary CSA allowed, 0: only ascii CSA allowed. 01241 * returns: 01242 * BOOL -- TRUE if the function was successful, 01243 * FALSE otherwise. 01244 ***************************************************************************/ 01245 static BOOL 01246 GetPS2CSA_MONO (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, 01247 DWORD InpDrvClrSp, CSIG InputIntent, BOOL AllowBinary) 01248 { 01249 BOOL Success = FALSE; 01250 #if 0 01251 if ((InpDrvClrSp == icSigRgbData) || 01252 (InpDrvClrSp == icSigDefData) || 01253 (InpDrvClrSp == 0)) 01254 { 01255 Success = GetPS2CSA_MONO_ABC (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01256 } else if (InpDrvClrSp == icSigGrayData) 01257 { 01258 Success = GetPS2CSA_MONO_A (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01259 } 01260 #else 01261 if ((InpDrvClrSp == icSigGrayData) || 01262 (InpDrvClrSp == 0)) 01263 { 01264 Success = GetPS2CSA_MONO_A (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01265 } 01266 else 01267 { 01268 Success = FALSE; 01269 } 01270 #endif 01271 return Success; 01272 } 01273 /*************************************************************************** 01274 * 01275 * Function to create a procedure for Color space. 01276 * 01277 ***************************************************************************/ 01278 01279 SINT 01280 CreateColSpProc (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary) 01281 { 01282 SINT nCount, Index; 01283 MEMPTR lpTable; 01284 MEMPTR Buff = NULL; 01285 SINT MemSize = 0; 01286 MEMPTR lpOldMem; 01287 HGLOBAL hBuff; 01288 lpOldMem = lpMem; 01289 lpMem += WriteObject (lpMem, BeginFunction); 01290 if (DoesCPTagExist (cp, CPTag) && 01291 GetCPTagIndex (cp, CPTag, (LPSINT) & Index) && 01292 GetCPElementSize (cp, Index, (LPSINT) & MemSize) && 01293 MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & Buff) && 01294 GetCPElement (cp, Index, Buff, MemSize)) 01295 { 01296 nCount = ui32toSINT (((lpcpCurveType) Buff)->curve.count); 01297 if (nCount != 0) 01298 { 01299 if (nCount == 1) // Gamma supplied in ui16 format 01300 { 01301 lpTable = (MEMPTR) (((lpcpCurveType) Buff)->curve.data); 01302 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01303 lpMem += WriteObject (lpMem, DecodeA3); 01304 } else 01305 { 01306 lpMem += WriteObject (lpMem, StartClip); 01307 lpTable = (MEMPTR) (((lpcpCurveType) Buff)->curve.data); 01308 lpMem += WriteObject (lpMem, DecodeABCArray); 01309 lpMem += WriteInt (lpMem, (SINT) CPTag); 01310 01311 if (!AllowBinary) // Output ASCII CS 01312 { 01313 lpMem += WriteObject (lpMem, IndexArray); 01314 } else 01315 { // Output BINARY CS 01316 lpMem += WriteObject (lpMem, IndexArray16b); 01317 } 01318 lpMem += WriteObject (lpMem, Scale16); 01319 lpMem += WriteObject (lpMem, EndClip); 01320 } 01321 } 01322 MemFree (hBuff); 01323 } 01324 lpMem += WriteObject (lpMem, EndFunction); 01325 return ((SINT) (lpMem - lpOldMem)); 01326 } 01327 /*************************************************************************** 01328 * 01329 * Function to create a procedure for Color space. 01330 * 01331 ***************************************************************************/ 01332 01333 SINT 01334 CreateFloatString (CHANDLE cp, MEMPTR lpMem, CSIG CPTag) 01335 { 01336 SINT i, Index; 01337 MEMPTR lpTable; 01338 MEMPTR Buff = NULL; 01339 SINT MemSize = 0; 01340 MEMPTR lpOldMem; 01341 HGLOBAL hBuff; 01342 lpOldMem = lpMem; 01343 if (GetCPTagIndex (cp, CPTag, (LPSINT) & Index) && 01344 GetCPElementSize (cp, Index, (LPSINT) & MemSize) && 01345 MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & Buff) && 01346 GetCPElement (cp, Index, Buff, MemSize)) 01347 { 01348 lpTable = (MEMPTR) & (((lpcpXYZType) Buff)->data); 01349 for (i = 0; i < 3; i++) 01350 { 01351 lpMem += WriteFloat (lpMem, si16f16toSFLOAT (lpTable)); 01352 lpTable += sizeof (icS15Fixed16Number); 01353 } 01354 MemFree (hBuff); 01355 } 01356 return ((SINT) (lpMem - lpOldMem)); 01357 } 01358 /*************************************************************************** 01359 * 01360 * Function to create a array later to be used in ColorSpace's DecodeABC. 01361 * 01362 ***************************************************************************/ 01363 01364 SINT 01365 CreateColSpArray (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary) 01366 { 01367 SINT i, nCount, Index; 01368 MEMPTR lpTable; 01369 MEMPTR Buff = NULL; 01370 SINT MemSize = 0; 01371 MEMPTR lpOldMem, lpLineStart; 01372 HGLOBAL hBuff; 01373 lpOldMem = lpMem; 01374 01375 lpLineStart = lpMem; 01376 lpMem += WriteObject (lpMem, NewLine); 01377 lpMem += WriteObject (lpMem, Slash); 01378 lpMem += WriteObject (lpMem, DecodeABCArray); 01379 lpMem += WriteInt (lpMem, (SINT) CPTag); 01380 if (DoesCPTagExist (cp, CPTag) && 01381 GetCPTagIndex (cp, CPTag, (LPSINT) & Index) && 01382 GetCPElementSize (cp, Index, (LPSINT) & MemSize) && 01383 MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & Buff) && 01384 GetCPElement (cp, Index, Buff, MemSize)) 01385 { 01386 nCount = ui32toSINT (((lpcpCurveType) Buff)->curve.count); 01387 if (nCount > 1) 01388 { 01389 lpTable = (MEMPTR) (((lpcpCurveType) Buff)->curve.data); 01390 if (!AllowBinary) // Output ASCII CS 01391 { 01392 lpMem += WriteObject (lpMem, BeginArray); 01393 for (i = 0; i < nCount; i++) 01394 { 01395 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01396 lpTable += sizeof (icUInt16Number); 01397 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 01398 { 01399 lpLineStart = lpMem; 01400 lpMem += WriteObject (lpMem, NewLine); 01401 } 01402 } 01403 lpMem += WriteObject (lpMem, EndArray); 01404 } else 01405 { // Output BINARY CS 01406 lpMem += WriteHNAToken (lpMem, 149, nCount); 01407 lpMem += WriteIntStringU2S (lpMem, lpTable, nCount); 01408 } 01409 } 01410 MemFree (hBuff); 01411 lpMem += WriteObject (lpMem, DefOp); 01412 } 01413 return ((SINT) (lpMem - lpOldMem)); 01414 } 01415 /*************************************************************************** 01416 * GetCSAFromProfile 01417 * function: 01418 * this is the function which gets the ColorSpace dictionary array 01419 * from the the Profile. 01420 * prototype: 01421 * static BOOL GetCSAFromProfile( 01422 * CHANDLE cp, 01423 * MEMPTR lpMem, 01424 * LPDWORD lpcbSize, 01425 * WORD InpDrvClrSp, 01426 * CSIG DrvColorSpace, 01427 * BOOL AllowBinary) 01428 * parameters: 01429 * cp -- Color Profile handle 01430 * lpBuffer -- Pointer to the memory block. If this point is NULL, 01431 * require buffer size. 01432 * lpcbSize -- Size of the memory block 01433 * InpDrvClrSp -- Input device color space. 01434 * DrvColorSpace -- Profile device color space. 01435 * AllowBinary -- 1: binary CS allowed, 0: only ascii CS allowed. 01436 * returns: 01437 * BOOL -- TRUE if the function was successful, 01438 * FALSE otherwise. 01439 ***************************************************************************/ 01440 01441 static BOOL 01442 GetCSAFromProfile ( 01443 CHANDLE cp, 01444 MEMPTR lpMem, 01445 LPDWORD lpcbSize, 01446 DWORD InpDrvClrSp, 01447 CSIG DrvColorSpace, 01448 BOOL AllowBinary) 01449 { 01450 SINT Index; 01451 SINT Size; 01452 if ((DrvColorSpace == icSigGrayData) && (InpDrvClrSp != icSigGrayData)) 01453 return FALSE; 01454 01455 if (DoesCPTagExist (cp, icSigPs2CSATag) && 01456 GetCPTagIndex (cp, icSigPs2CSATag, (LPSINT) & Index) && 01457 GetCPElementDataSize (cp, Index, (LPSINT) & Size) && 01458 ((lpMem == NULL) || GetCPElementData (cp, Index, lpMem, Size)) && 01459 (*lpcbSize = Convert2Ascii (cp, Index, lpMem, *lpcbSize, Size, AllowBinary))) 01460 { 01461 return TRUE; 01462 } else 01463 { 01464 return FALSE; 01465 } 01466 } 01467 /*************************************************************************** 01468 * GetPS2CSA_DEFG_Intent 01469 * function: 01470 * This is the function which creates the CieBasedDEF(G)ColorSpace array 01471 * based on Intent. 01472 * prototype: 01473 * static BOOL GetPS2CSA_DEFG_Intent( 01474 * CHANDLE cp, 01475 * MEMPTR lpBuffer, 01476 * LPDWORD lpcbSize, 01477 * CSIG Intent, 01478 * int Type, 01479 * BOOL AllowBinary) 01480 * parameters: 01481 * cp -- Color Profile handle 01482 * lpBuffer -- Pointer to the memory block. If this point is NULL, 01483 * require buffer size. 01484 * lpcbSize -- Size of the memory block 01485 * Intent -- Intent. 01486 * Type -- CieBasedDEF or CieBasedDEF. 01487 * AllowBinary -- 1: binary CS allowed, 0: only ascii CS allowed. 01488 * returns: 01489 * BOOL -- TRUE if the function was successful, 01490 * FALSE otherwise. 01491 ***************************************************************************/ 01492 01493 BOOL 01494 GetPS2CSA_DEFG_Intent ( 01495 CHANDLE cp, 01496 MEMPTR lpBuffer, 01497 LPDWORD lpcbSize, 01498 DWORD InpDrvClrSp, 01499 CSIG Intent, 01500 int Type, 01501 BOOL AllowBinary) 01502 { 01503 SINT Index; 01504 BOOL Success = FALSE; 01505 CSIG icSigAToBx; 01506 01507 // Try to create CieBasedDEFG CSA first. 01508 if (((Type == TYPE_CIEBASEDDEFG) && (InpDrvClrSp != icSigCmykData) || 01509 (Type == TYPE_CIEBASEDDEF) && (InpDrvClrSp != icSigDefData)) && 01510 (InpDrvClrSp != 0)) 01511 { 01512 return (FALSE); 01513 } 01514 switch (Intent) 01515 { 01516 case icPerceptual: 01517 icSigAToBx = icSigAToB0Tag; 01518 break; 01519 case icRelativeColorimetric: 01520 icSigAToBx = icSigAToB1Tag; 01521 break; 01522 case icSaturation: 01523 icSigAToBx = icSigAToB2Tag; 01524 break; 01525 case icAbsoluteColorimetric: 01526 icSigAToBx = icSigAToB1Tag; 01527 break; 01528 default: 01529 return Success; 01530 } 01531 01532 if (DoesCPTagExist (cp, icSigAToBx) && 01533 GetCPTagIndex (cp, icSigAToBx, (LPSINT) & Index)) 01534 { 01535 Success = GetPS2CSA_DEFG (cp, lpBuffer, lpcbSize, Intent, Index, Type, AllowBinary); 01536 } 01537 01538 return Success; 01539 } 01540 /*************************************************************************** 01541 * GetPS2ColorSpaceArray 01542 * function: 01543 * This is the main function which creates the ColorSpace array 01544 * from the data supplied in the Profile. 01545 * prototype: 01546 * BOOL GetPS2ColorSpaceArray( 01547 * CHANDLE cp, 01548 * CSIG InputIntent, 01549 * WORD InpDrvClrSp, 01550 * MEMPTR lpBuffer, 01551 * LPDWORD lpcbSize, 01552 * BOOL AllowBinary) 01553 * parameters: 01554 * cp -- Color Profile handle 01555 * lpBuffer -- Pointer to the memory block. If this point is NULL, 01556 * require buffer size. 01557 * lpcbSize -- Size of the memory block 01558 * InpDrvClrSp -- Input device color space. 01559 * icSigCmykData: input data is cmyk, create CiebasedDEFG CSA. 01560 * icSigRgbData : input data is rgb, create CieBasedABC CSA. 01561 * icSigDefData : input data is rgb or lab, create CiebasedDEF CSA. 01562 * isSigGrayData: input data is gray, create CieBasedA CSA. 01563 * 0 : Auto. Create CSA depends on profile color space. 01564 * InputIntent -- Intent. 01565 * AllowBinary -- 1: binary CS allowed, 0: only ascii CS allowed. 01566 * returns: 01567 * BOOL -- TRUE if the function was successful, 01568 * FALSE otherwise. 01569 ***************************************************************************/ 01570 BOOL EXTERN 01571 GetPS2ColorSpaceArray ( 01572 CHANDLE cp, 01573 DWORD InputIntent, 01574 DWORD InpDrvClrSp, 01575 MEMPTR lpBuffer, 01576 LPDWORD lpcbSize, 01577 BOOL AllowBinary) 01578 { 01579 CSIG ColorSpace, Intent; 01580 BOOL Success = FALSE; 01581 DWORD dwSaveSize; 01582 if (!cp) 01583 return Success; 01584 01585 if (!GetCPDevSpace (cp, (LPCSIG) & ColorSpace) || 01586 !GetCPRenderIntent (cp, (LPCSIG) & Intent)) 01587 { 01588 return Success; 01589 } 01590 dwSaveSize = *lpcbSize; 01591 if (InputIntent == icUseRenderingIntent) 01592 InputIntent = (DWORD)Intent; 01593 01594 // Get ColorSpace from Profile. 01595 if ((CSIG) InputIntent == Intent) 01596 { 01597 Success = GetCSAFromProfile (cp, lpBuffer, lpcbSize, 01598 InpDrvClrSp, ColorSpace, AllowBinary); 01599 } 01600 if (!Success) 01601 { 01602 switch (ColorSpace) 01603 { 01604 case icSigRgbData: 01605 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01606 InpDrvClrSp, (CSIG) InputIntent, 01607 TYPE_CIEBASEDDEF, AllowBinary); 01608 if (Success) 01609 { // Create CieBasedABC or DeviceRGB 01610 // for the printer 01611 // which does not support CieBasedDEF(G). 01612 DWORD cbNewSize = 0; 01613 MEMPTR lpNewBuffer; 01614 MEMPTR lpOldBuffer; 01615 if (lpBuffer) 01616 { 01617 lpNewBuffer = lpBuffer + *lpcbSize; 01618 lpOldBuffer = lpNewBuffer; 01619 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01620 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01621 lpNewBuffer += WriteObject (lpNewBuffer, NotSupportDEFG_S); 01622 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01623 } else 01624 lpNewBuffer = NULL; 01625 01626 if (!GetPS2CSA_ABC (cp, lpNewBuffer, &cbNewSize, 01627 (CSIG)InputIntent, InpDrvClrSp, AllowBinary)) 01628 GetDeviceRGB (lpNewBuffer, &cbNewSize, InpDrvClrSp); 01629 01630 if (lpBuffer) 01631 { 01632 lpNewBuffer += cbNewSize; 01633 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01634 lpNewBuffer += WriteObject (lpNewBuffer, SupportDEFG_E); 01635 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01636 } else 01637 *lpcbSize += cbNewSize; 01638 01639 } 01640 if (!Success) 01641 { // Create CieBasedABC 01642 Success = GetPS2CSA_ABC (cp, lpBuffer, lpcbSize, 01643 (CSIG)InputIntent, InpDrvClrSp, AllowBinary); 01644 } 01645 if (!Success) 01646 { // Create DeviceRGB 01647 Success = GetDeviceRGB (lpBuffer, lpcbSize, InpDrvClrSp); 01648 Success = FALSE; 01649 } 01650 break; 01651 case icSigCmykData: 01652 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01653 InpDrvClrSp, (CSIG) InputIntent, 01654 TYPE_CIEBASEDDEFG, AllowBinary); 01655 if (Success) 01656 { // Create DeviceCMYK for the printer 01657 // which does not support CieBasedDEF(G). 01658 DWORD cbNewSize = 0; 01659 MEMPTR lpNewBuffer; 01660 MEMPTR lpOldBuffer; 01661 if (lpBuffer) 01662 { 01663 lpNewBuffer = lpBuffer + *lpcbSize; 01664 lpOldBuffer = lpNewBuffer; 01665 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01666 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01667 lpNewBuffer += WriteObject (lpNewBuffer, NotSupportDEFG_S); 01668 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01669 } else 01670 lpNewBuffer = NULL; 01671 01672 GetDeviceCMYK (lpNewBuffer, &cbNewSize, InpDrvClrSp); 01673 01674 if (lpBuffer) 01675 { 01676 lpNewBuffer += cbNewSize; 01677 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01678 lpNewBuffer += WriteObject (lpNewBuffer, SupportDEFG_E); 01679 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01680 } else 01681 *lpcbSize += cbNewSize; 01682 } 01683 if (!Success) 01684 { // Create DeviceCMYK 01685 Success = GetDeviceCMYK (lpBuffer, lpcbSize, InpDrvClrSp); 01686 Success = FALSE; 01687 } 01688 break; 01689 case icSigGrayData: 01690 Success = GetPS2CSA_MONO (cp, lpBuffer, lpcbSize, InpDrvClrSp, 01691 (CSIG)InputIntent, AllowBinary); 01692 if (!Success) 01693 { // Create DeviceGray 01694 Success = GetDeviceGray (lpBuffer, lpcbSize, InpDrvClrSp); 01695 Success = FALSE; 01696 } 01697 break; 01698 case icSigLabData: 01699 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01700 InpDrvClrSp, (CSIG) InputIntent, 01701 TYPE_CIEBASEDDEF, AllowBinary); 01702 if (Success) 01703 { // Create CieBasedABC or DeviceRGB 01704 // for the printer 01705 // which does not support CieBasedDEF(G). 01706 DWORD cbNewSize = 0; 01707 MEMPTR lpNewBuffer; 01708 MEMPTR lpOldBuffer; 01709 if (lpBuffer) 01710 { 01711 lpNewBuffer = lpBuffer + *lpcbSize; 01712 lpOldBuffer = lpNewBuffer; 01713 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01714 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01715 lpNewBuffer += WriteObject (lpNewBuffer, NotSupportDEFG_S); 01716 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01717 } else 01718 lpNewBuffer = NULL; 01719 01720 GetPS2CSA_ABC_LAB (cp, lpNewBuffer, &cbNewSize, 01721 (CSIG)InputIntent, InpDrvClrSp, AllowBinary); 01722 01723 if (lpBuffer) 01724 { 01725 lpNewBuffer += cbNewSize; 01726 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01727 lpNewBuffer += WriteObject (lpNewBuffer, SupportDEFG_E); 01728 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01729 } else 01730 *lpcbSize += cbNewSize; 01731 } 01732 if (!Success) 01733 { // Create CieBasedABC 01734 Success = GetPS2CSA_ABC_LAB (cp, lpBuffer, lpcbSize, 01735 (CSIG)InputIntent, InpDrvClrSp, AllowBinary); 01736 } 01737 break; 01738 01739 default: 01740 break; 01741 } 01742 } 01743 return Success; 01744 }

Generated on Sat May 15 19:40:12 2004 for test by doxygen 1.3.7