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

getcsa.c File Reference

#include "generic.h"
#include "icmstr.h"

Go to the source code of this file.

Defines

#define ICMSEG

Functions

SINT CreateColSpArray (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary)
SINT CreateColSpProc (CHANDLE cp, MEMPTR lpMem, CSIG CPTag, BOOL AllowBinary)
SINT CreateFloatString (CHANDLE cp, MEMPTR lpMem, CSIG CPTag)
SINT SendCSABWPoint (MEMPTR lpMem, CSIG Intent, LPSFLOAT IlluminantWP, LPSFLOAT MediaWP)
void GetMediaWP (CHANDLE cp, CSIG InputIntent, LPSFLOAT IlluminantWP, LPSFLOAT MediaWP)
BOOL GetDeviceRGB (MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp, BOOL BackupCSA)
BOOL GetDeviceCMYK (MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp)
BOOL GetDeviceGray (MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp)
SINT GetPublicArrayName (CHANDLE cp, CSIG IntentSig, MEMPTR PublicArrayName)
SINT BeginGlobalDict (MEMPTR lpMem)
SINT EndGlobalDict (MEMPTR lpMem)
SINT EnableGlobalDict (MEMPTR lpMem)
BOOL GetPS2CSA_DEFG (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, SINT Index, int Type, BOOL AllowBinary)
BOOL GetPS2CSA_ABC (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary, BOOL BackupCSA)
BOOL GetPS2CSA_ABC_LAB (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, DWORD InpDrvClrSp, BOOL AllowBinary)
BOOL GetPS2CSA_MONO_ABC (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, BOOL AllowBinary)
BOOL GetPS2CSA_MONO_A (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, CSIG InputIntent, BOOL AllowBinary)
BOOL GetPS2CSA_MONO (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp, CSIG InputIntent, BOOL AllowBinary)
BOOL GetCSAFromProfile (CHANDLE cp, MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp, CSIG DrvColorSpace, BOOL AllowBinary)
BOOL GetPS2CSA_DEFG_Intent (CHANDLE cp, MEMPTR lpBuffer, LPDWORD lpcbSize, DWORD InpDrvClrSp, CSIG Intent, int Type, BOOL AllowBinary)
BOOL EXTERN GetPS2ColorSpaceArray (CHANDLE cp, DWORD InputIntent, DWORD InpDrvClrSp, MEMPTR lpBuffer, LPDWORD lpcbSize, BOOL AllowBinary)

Variables

char * DecodeABCLab []


Define Documentation

#define ICMSEG
 


Function Documentation

SINT BeginGlobalDict MEMPTR  lpMem  ) 
 

Definition at line 205 of file jul98/dll32/getcsa.c.

References BeginOp, GlobalDictOp, MEMPTR, SINT, WriteNewLineObject(), and WriteObject.

00206 { 00207 MEMPTR lpOldMem = lpMem; 00208 00209 lpMem += WriteNewLineObject (lpMem, GlobalDictOp); 00210 lpMem += WriteObject (lpMem, BeginOp); 00211 00212 return (lpMem - lpOldMem); 00213 }

SINT CreateColSpArray CHANDLE  cp,
MEMPTR  lpMem,
CSIG  CPTag,
BOOL  AllowBinary
 

SINT CreateColSpProc CHANDLE  cp,
MEMPTR  lpMem,
CSIG  CPTag,
BOOL  AllowBinary
 

SINT CreateFloatString CHANDLE  cp,
MEMPTR  lpMem,
CSIG  CPTag
 

SINT EnableGlobalDict MEMPTR  lpMem  ) 
 

Definition at line 225 of file jul98/dll32/getcsa.c.

References CurrentGlobalOp, MEMPTR, SetGlobalOp, SINT, TrueOp, WriteNewLineObject(), and WriteObject.

00226 { 00227 MEMPTR lpOldMem = lpMem; 00228 00229 lpMem += WriteNewLineObject (lpMem, CurrentGlobalOp); 00230 lpMem += WriteObject (lpMem, TrueOp); 00231 lpMem += WriteObject (lpMem, SetGlobalOp); 00232 return (lpMem - lpOldMem); 00233 }

SINT EndGlobalDict MEMPTR  lpMem  ) 
 

Definition at line 215 of file jul98/dll32/getcsa.c.

References EndOp, MEMPTR, SetGlobalOp, SINT, WriteNewLineObject(), and WriteObject.

00216 { 00217 MEMPTR lpOldMem = lpMem; 00218 00219 lpMem += WriteNewLineObject (lpMem, EndOp); 00220 lpMem += WriteObject (lpMem, SetGlobalOp); 00221 00222 return (lpMem - lpOldMem); 00223 }

BOOL GetCSAFromProfile CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp,
CSIG  DrvColorSpace,
BOOL  AllowBinary
[static]
 

Definition at line 1441 of file jul98/dll32/getcsa.c.

References AllowBinary, Convert2Ascii(), DoesCPTagExist(), FALSE, GetCPElementData(), GetCPElementDataSize(), GetCPTagIndex(), icSigGrayData, icSigPs2CSATag, Index, LPSINT, NULL, SINT, Size, and TRUE.

01448 { 01449 SINT Index; 01450 SINT Size; 01451 if ((DrvColorSpace == icSigGrayData) && (InpDrvClrSp != icSigGrayData)) 01452 return FALSE; 01453 01454 if (DoesCPTagExist (cp, icSigPs2CSATag) && 01455 GetCPTagIndex (cp, icSigPs2CSATag, (LPSINT) & Index) && 01456 GetCPElementDataSize (cp, Index, (LPSINT) & Size) && 01457 ((lpMem == NULL) || GetCPElementData (cp, Index, lpMem, Size)) && 01458 (*lpcbSize = Convert2Ascii (cp, Index, lpMem, *lpcbSize, Size, AllowBinary))) 01459 { 01460 return TRUE; 01461 } else 01462 { 01463 return FALSE; 01464 } 01465 }

BOOL GetDeviceCMYK MEMPTR  lpMem,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp
[static]
 

Definition at line 90 of file jul98/dll32/getcsa.c.

References DeviceCMYKTag, DWORD, FALSE, icSigCmykData, MEMPTR, NULL, TRUE, and WriteNewLineObject().

Referenced by GetPS2ColorSpaceArray().

00094 { 00095 MEMPTR lpOldMem = lpMem; 00096 if ((InpDrvClrSp != icSigCmykData) && 00097 (InpDrvClrSp != 0)) 00098 return FALSE; 00099 if (lpMem == NULL) 00100 { 00101 *lpcbSize = lstrlen (DeviceCMYKTag) + 8; 00102 return (TRUE); 00103 } 00104 lpMem += WriteNewLineObject (lpMem, DeviceCMYKTag); 00105 00106 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00107 return (TRUE); 00108 00109 }

BOOL GetDeviceGray MEMPTR  lpMem,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp
[static]
 

Definition at line 115 of file jul98/dll32/getcsa.c.

References DeviceGrayTag, DeviceRGBTag, DWORD, icSigDefData, icSigGrayData, icSigRgbData, MEMPTR, NULL, TRUE, and WriteNewLineObject().

Referenced by GetPS2ColorSpaceArray().

00119 { 00120 MEMPTR lpOldMem = lpMem; 00121 if ((InpDrvClrSp == icSigRgbData) || 00122 (InpDrvClrSp == icSigDefData) || 00123 (InpDrvClrSp == 0)) 00124 { 00125 if (lpMem == NULL) 00126 { 00127 *lpcbSize = lstrlen (DeviceRGBTag) + 8; 00128 return (TRUE); 00129 } 00130 lpMem += WriteNewLineObject (lpMem, DeviceRGBTag); 00131 00132 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00133 return (TRUE); 00134 } else if (InpDrvClrSp == icSigGrayData) 00135 { 00136 if (lpMem == NULL) 00137 { 00138 *lpcbSize = lstrlen (DeviceGrayTag) + 8; 00139 return (TRUE); 00140 } 00141 lpMem += WriteNewLineObject (lpMem, DeviceGrayTag); 00142 00143 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00144 return (TRUE); 00145 } 00146 }

BOOL GetDeviceRGB MEMPTR  lpMem,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp,
BOOL  BackupCSA
[static]
 

Definition at line 39 of file jul98/dll32/getcsa.c.

References DeviceRGBTag, DWORD, FALSE, icSigDefData, icSigRgbData, MEMPTR, NotSupportDEFG_S, NULL, SupportDEFG_E, TRUE, and WriteNewLineObject().

Referenced by GetPS2ColorSpaceArray().

00044 { 00045 MEMPTR lpOldMem = lpMem; 00046 if ((InpDrvClrSp != icSigRgbData) && 00047 (InpDrvClrSp != icSigDefData) && 00048 (InpDrvClrSp != 0)) 00049 return FALSE; 00050 00051 if (lpMem == NULL) 00052 { 00053 *lpcbSize = lstrlen (DeviceRGBTag) + 8; 00054 return (TRUE); 00055 } 00056 00057 if (BackupCSA) 00058 { 00059 lpMem += WriteNewLineObject (lpMem, NotSupportDEFG_S); 00060 } 00061 00062 lpMem += WriteNewLineObject (lpMem, DeviceRGBTag); 00063 00064 if (BackupCSA) 00065 { 00066 lpMem += WriteNewLineObject (lpMem, SupportDEFG_E); 00067 } 00068 00069 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00070 return (TRUE); 00071 }

void GetMediaWP CHANDLE  cp,
CSIG  InputIntent,
LPSFLOAT  IlluminantWP,
LPSFLOAT  MediaWP
[static]
 

Definition at line 191 of file jul98/dll32/getcsa.c.

References GetCPMediaWhitePoint(), icAbsoluteColorimetric, and LPSFLOAT.

00193 { 00194 if (InputIntent == icAbsoluteColorimetric) 00195 { 00196 if (!GetCPMediaWhitePoint (cp, (LPSFLOAT) & MediaWP)) // .. Media WhitePoint 00197 { 00198 MediaWP[0] = IlluminantWP[0]; 00199 MediaWP[1] = IlluminantWP[1]; 00200 MediaWP[2] = IlluminantWP[2]; 00201 } 00202 } 00203 }

BOOL EXTERN GetPS2ColorSpaceArray CHANDLE  cp,
DWORD  InputIntent,
DWORD  InpDrvClrSp,
MEMPTR  lpBuffer,
LPDWORD  lpcbSize,
BOOL  AllowBinary
 

Definition at line 1570 of file jul98/dll32/getcsa.c.

References AllowBinary, BOOL, CSIG, DWORD, FALSE, GetCPDevSpace, GetCPRenderIntent, GetCSAFromProfile(), GetDeviceCMYK(), GetDeviceGray(), GetDeviceRGB(), GetPS2CSA_ABC(), GetPS2CSA_ABC_LAB(), GetPS2CSA_DEFG_Intent(), GetPS2CSA_MONO(), icSigCmykData, icSigGrayData, icSigLabData, icSigRgbData, icUseRenderingIntent, Intent, LPCSIG, MEMPTR, NewLine, NotSupportDEFG_S, NULL, SupportDEFG_E, TYPE_CIEBASEDDEF, TYPE_CIEBASEDDEFG, WriteNewLineObject(), and WriteObject.

01577 { 01578 CSIG ColorSpace, Intent; 01579 BOOL Success = FALSE; 01580 DWORD dwSaveSize; 01581 if (!cp) 01582 return Success; 01583 01584 if (!GetCPDevSpace (cp, (LPCSIG) & ColorSpace) || 01585 !GetCPRenderIntent (cp, (LPCSIG) & Intent)) 01586 { 01587 return Success; 01588 } 01589 dwSaveSize = *lpcbSize; 01590 if (InputIntent == icUseRenderingIntent) 01591 InputIntent = (DWORD)Intent; 01592 01593 // Get ColorSpace from Profile. 01594 if ((CSIG) InputIntent == Intent) 01595 { 01596 Success = GetCSAFromProfile (cp, lpBuffer, lpcbSize, 01597 InpDrvClrSp, ColorSpace, AllowBinary); 01598 } 01599 if (!Success) 01600 { 01601 switch (ColorSpace) 01602 { 01603 case icSigRgbData: 01604 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01605 InpDrvClrSp, (CSIG) InputIntent, 01606 TYPE_CIEBASEDDEF, AllowBinary); 01607 if (Success) 01608 { // Create CieBasedABC or DeviceRGB 01609 // for the printer 01610 // which does not support CieBasedDEF(G). 01611 DWORD cbNewSize = 0; 01612 MEMPTR lpNewBuffer; 01613 MEMPTR lpOldBuffer; 01614 if (lpBuffer) 01615 { 01616 lpNewBuffer = lpBuffer + *lpcbSize; 01617 lpOldBuffer = lpNewBuffer; 01618 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01619 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01620 } else 01621 lpNewBuffer = NULL; 01622 01623 if (!GetPS2CSA_ABC (cp, lpNewBuffer, &cbNewSize, 01624 (CSIG)InputIntent, InpDrvClrSp, 01625 AllowBinary, 1)) // create a backup CSA 01626 GetDeviceRGB (lpNewBuffer, &cbNewSize, InpDrvClrSp, 1); 01627 01628 if (lpBuffer) 01629 { 01630 lpNewBuffer += cbNewSize; 01631 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01632 } else 01633 *lpcbSize += cbNewSize; 01634 01635 } 01636 if (!Success) 01637 { // Create CieBasedABC 01638 Success = GetPS2CSA_ABC (cp, lpBuffer, lpcbSize, 01639 (CSIG)InputIntent, InpDrvClrSp, 01640 AllowBinary, 0); 01641 } 01642 if (!Success) 01643 { // Create DeviceRGB 01644 Success = GetDeviceRGB (lpBuffer, lpcbSize, InpDrvClrSp, 0); 01645 Success = FALSE; 01646 } 01647 break; 01648 case icSigCmykData: 01649 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01650 InpDrvClrSp, (CSIG) InputIntent, 01651 TYPE_CIEBASEDDEFG, AllowBinary); 01652 if (Success) 01653 { // Create DeviceCMYK for the printer 01654 // which does not support CieBasedDEF(G). 01655 DWORD cbNewSize = 0; 01656 MEMPTR lpNewBuffer; 01657 MEMPTR lpOldBuffer; 01658 if (lpBuffer) 01659 { 01660 lpNewBuffer = lpBuffer + *lpcbSize; 01661 lpOldBuffer = lpNewBuffer; 01662 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01663 lpNewBuffer += WriteNewLineObject (lpNewBuffer, NotSupportDEFG_S); 01664 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01665 } else 01666 lpNewBuffer = NULL; 01667 01668 GetDeviceCMYK (lpNewBuffer, &cbNewSize, InpDrvClrSp); 01669 01670 if (lpBuffer) 01671 { 01672 lpNewBuffer += cbNewSize; 01673 lpNewBuffer += WriteNewLineObject (lpNewBuffer, SupportDEFG_E); 01674 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01675 } else 01676 *lpcbSize += cbNewSize; 01677 } 01678 if (!Success) 01679 { // Create DeviceCMYK 01680 Success = GetDeviceCMYK (lpBuffer, lpcbSize, InpDrvClrSp); 01681 Success = FALSE; 01682 } 01683 break; 01684 case icSigGrayData: 01685 Success = GetPS2CSA_MONO (cp, lpBuffer, lpcbSize, InpDrvClrSp, 01686 (CSIG)InputIntent, AllowBinary); 01687 if (!Success) 01688 { // Create DeviceGray 01689 Success = GetDeviceGray (lpBuffer, lpcbSize, InpDrvClrSp); 01690 Success = FALSE; 01691 } 01692 break; 01693 case icSigLabData: 01694 Success = GetPS2CSA_DEFG_Intent (cp, lpBuffer, lpcbSize, 01695 InpDrvClrSp, (CSIG) InputIntent, 01696 TYPE_CIEBASEDDEF, AllowBinary); 01697 if (Success) 01698 { // Create CieBasedABC or DeviceRGB 01699 // for the printer 01700 // which does not support CieBasedDEF(G). 01701 DWORD cbNewSize = 0; 01702 MEMPTR lpNewBuffer; 01703 MEMPTR lpOldBuffer; 01704 if (lpBuffer) 01705 { 01706 lpNewBuffer = lpBuffer + *lpcbSize; 01707 lpOldBuffer = lpNewBuffer; 01708 lpNewBuffer += WriteObject (lpNewBuffer, NewLine); 01709 lpNewBuffer += WriteNewLineObject (lpNewBuffer, NotSupportDEFG_S); 01710 cbNewSize = dwSaveSize - (DWORD) (lpNewBuffer - lpBuffer); 01711 } else 01712 lpNewBuffer = NULL; 01713 01714 GetPS2CSA_ABC_LAB (cp, lpNewBuffer, &cbNewSize, 01715 (CSIG)InputIntent, InpDrvClrSp, AllowBinary); 01716 01717 if (lpBuffer) 01718 { 01719 lpNewBuffer += cbNewSize; 01720 lpNewBuffer += WriteNewLineObject (lpNewBuffer, SupportDEFG_E); 01721 *lpcbSize += (DWORD) (lpNewBuffer - lpOldBuffer); 01722 } else 01723 *lpcbSize += cbNewSize; 01724 } 01725 if (!Success) 01726 { // Create CieBasedABC 01727 Success = GetPS2CSA_ABC_LAB (cp, lpBuffer, lpcbSize, 01728 (CSIG)InputIntent, InpDrvClrSp, AllowBinary); 01729 } 01730 break; 01731 01732 default: 01733 break; 01734 } 01735 } 01736 return Success; 01737 }

BOOL GetPS2CSA_ABC CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
CSIG  InputIntent,
DWORD  InpDrvClrSp,
BOOL  AllowBinary,
BOOL  BackupCSA
 

Definition at line 641 of file jul98/dll32/getcsa.c.

References AllowBinary, BeginArray, BeginDict, BeginFunction, BeginGlobalDict(), CieBasedABCBegin, CieBasedABCEnd, CIEBasedABCTag, CreateColSpArray(), CreateColSpProc(), CreateFloatString(), CSIG, DecodeABCTag, DecodeLMNTag, DoesTRCAndColorantTagExist(), DWORD, EnableGlobalDict(), EndArray, EndDict, EndFunction, EndOp, FALSE, GetCPConnSpace, GetCPDevSpace, GetCPWhitePoint(), GetMediaWP(), icAbsoluteColorimetric, icSigBlueColorantTag, icSigBlueTRCTag, icSigDefData, icSigGreenColorantTag, icSigGreenTRCTag, icSigRedColorantTag, icSigRedTRCTag, icSigRgbData, LPCSIG, LPSFLOAT, MatrixABCTag, MEMPTR, MulOp, NewLine, NotSupportDEFG_S, NULL, RangeLMN, RangeLMNTag, SendCSABWPoint(), SetGlobalOp, SFLOAT, SINT, SupportDEFG_E, TRUE, WriteFloat(), WriteNewLineObject(), and WriteObject.

00644 { 00645 CSIG PCS, Dev; 00646 SFLOAT IlluminantWP[3]; 00647 SFLOAT MediaWP[3]; 00648 00649 SINT i; 00650 MEMPTR lpOldMem = lpMem; 00651 SINT Ret = 0; 00652 // Check if we can generate the CS. 00653 // Required tags are: red, green and blue Colorants. 00654 // As for TRC tags - we are quite flexible here - if we cannot find the 00655 // required tag - we assume the linear responce 00656 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00657 !GetCPDevSpace (cp, (LPCSIG) & Dev) || 00658 (Dev != icSigRgbData) || 00659 !DoesTRCAndColorantTagExist(cp)) 00660 { 00661 return (FALSE); 00662 } 00663 if ((InpDrvClrSp != icSigRgbData) && 00664 (InpDrvClrSp != icSigDefData) && 00665 (InpDrvClrSp != 0)) 00666 { 00667 return (FALSE); 00668 } 00669 // Estimate the memory size required to hold CS 00670 00671 if (lpMem == NULL) // This is a size request 00672 { 00673 *lpcbSize = 65530; 00674 return (TRUE); 00675 } 00676 // Get info about Illuminant White Point from the header 00677 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00678 00679 // Support absolute whitePoint 00680 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00681 00682 //*********** Creating global data 00683 lpMem += WriteNewLineObject (lpMem, CieBasedABCBegin); 00684 00685 lpMem += EnableGlobalDict(lpMem); 00686 00687 if (BackupCSA) 00688 { 00689 lpMem += WriteNewLineObject (lpMem, NotSupportDEFG_S); 00690 } 00691 00692 lpMem += BeginGlobalDict(lpMem); 00693 00694 lpMem += CreateColSpArray (cp, lpMem, icSigRedTRCTag, AllowBinary); 00695 lpMem += CreateColSpArray (cp, lpMem, icSigGreenTRCTag, AllowBinary); 00696 lpMem += CreateColSpArray (cp, lpMem, icSigBlueTRCTag, AllowBinary); 00697 00698 lpMem += WriteNewLineObject (lpMem, EndOp); 00699 00700 if (BackupCSA) 00701 { 00702 lpMem += WriteNewLineObject (lpMem, SupportDEFG_E); 00703 } 00704 lpMem += WriteNewLineObject (lpMem, SetGlobalOp); 00705 00706 if (BackupCSA) 00707 { 00708 lpMem += WriteNewLineObject (lpMem, NotSupportDEFG_S); 00709 } 00710 00711 //*********** Start creating the ColorSpace 00712 lpMem += WriteNewLineObject (lpMem, BeginArray); // Begin array 00713 //********** /CIEBasedABC 00714 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00715 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00716 00717 //********** Black/White Point 00718 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00719 00720 //********** /DecodeABC 00721 lpMem += WriteNewLineObject (lpMem, DecodeABCTag); 00722 lpMem += WriteObject (lpMem, BeginArray); 00723 00724 lpMem += WriteObject (lpMem, NewLine); 00725 lpMem += CreateColSpProc (cp, lpMem, icSigRedTRCTag, AllowBinary); 00726 lpMem += WriteObject (lpMem, NewLine); 00727 lpMem += CreateColSpProc (cp, lpMem, icSigGreenTRCTag, AllowBinary); 00728 lpMem += WriteObject (lpMem, NewLine); 00729 lpMem += CreateColSpProc (cp, lpMem, icSigBlueTRCTag, AllowBinary); 00730 lpMem += WriteObject (lpMem, EndArray); 00731 00732 //********** /MatrixABC 00733 lpMem += WriteNewLineObject (lpMem, MatrixABCTag); 00734 lpMem += WriteObject (lpMem, BeginArray); 00735 00736 lpMem += CreateFloatString (cp, lpMem, icSigRedColorantTag); 00737 lpMem += CreateFloatString (cp, lpMem, icSigGreenColorantTag); 00738 lpMem += CreateFloatString (cp, lpMem, icSigBlueColorantTag); 00739 00740 lpMem += WriteObject (lpMem, EndArray); 00741 00742 //********** /RangeLMN 00743 lpMem += WriteNewLineObject (lpMem, RangeLMNTag); 00744 lpMem += WriteObject (lpMem, RangeLMN); 00745 00746 //********** /DecodeLMN 00747 if (InputIntent == icAbsoluteColorimetric) 00748 { 00749 // Support absolute whitePoint 00750 lpMem += WriteNewLineObject (lpMem, DecodeLMNTag); 00751 lpMem += WriteObject (lpMem, BeginArray); 00752 for (i = 0; i < 3; i ++) 00753 { 00754 lpMem += WriteObject (lpMem, BeginFunction); 00755 lpMem += WriteFloat (lpMem, (double)MediaWP[i]/IlluminantWP[i]); 00756 lpMem += WriteObject (lpMem, MulOp); 00757 lpMem += WriteObject (lpMem, EndFunction); 00758 } 00759 lpMem += WriteObject (lpMem, EndArray); 00760 } 00761 00762 //********** End dictionary definition 00763 lpMem += WriteNewLineObject (lpMem, EndDict); 00764 lpMem += WriteObject (lpMem, EndArray); 00765 00766 if (BackupCSA) 00767 { 00768 lpMem += WriteNewLineObject (lpMem, SupportDEFG_E); 00769 } 00770 00771 lpMem += WriteNewLineObject (lpMem, CieBasedABCEnd); 00772 *lpcbSize = (DWORD) ((lpMem - lpOldMem)); 00773 return (TRUE); 00774 }

BOOL GetPS2CSA_ABC_LAB CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
CSIG  InputIntent,
DWORD  InpDrvClrSp,
BOOL  AllowBinary
 

Definition at line 801 of file jul98/dll32/getcsa.c.

References BeginArray, BeginDict, BeginFunction, CieBasedABCEnd, CIEBasedABCTag, CSIG, DecodeABCLab1, DecodeABCTag, DecodeLMNLab, DecodeLMNTag, DWORD, EndArray, EndDict, EndFunction, FALSE, GetCPConnSpace, GetCPDevSpace, GetCPWhitePoint(), GetMediaWP(), icAbsoluteColorimetric, icSigDefData, icSigLabData, LPCSIG, LPSFLOAT, MatrixABCLab, MatrixABCTag, MEMPTR, MulOp, NewLine, NULL, RangeABC_Lab, RangeABCTag, SendCSABWPoint(), SFLOAT, SINT, TRUE, WriteFloat(), WriteNewLineObject(), and WriteObject.

Referenced by GetPS2ColorSpaceArray().

00803 { 00804 CSIG PCS, Dev; 00805 SFLOAT IlluminantWP[3]; 00806 SFLOAT MediaWP[3]; 00807 00808 SINT i; 00809 MEMPTR lpOldMem = lpMem; 00810 SINT Ret = 0; 00811 // Check if we can generate the CS. 00812 // Required tags are: red, green and blue Colorants. 00813 // As for TRC tags - we are quite flexible here - if we cannot find the 00814 // required tag - we assume the linear responce 00815 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00816 !GetCPDevSpace (cp, (LPCSIG) & Dev) || 00817 (Dev != icSigLabData)) 00818 { 00819 return (FALSE); 00820 } 00821 if ((InpDrvClrSp != icSigLabData) && 00822 (InpDrvClrSp != icSigDefData) && 00823 (InpDrvClrSp != 0)) 00824 { 00825 return (FALSE); 00826 } 00827 // Estimate the memory size required to hold CS 00828 00829 if (lpMem == NULL) // This is a size request 00830 { 00831 *lpcbSize = 65530; 00832 return (TRUE); 00833 } 00834 // Get info about Illuminant White Point from the header 00835 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00836 00837 // Support absolute whitePoint 00838 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00839 00840 //*********** Start creating the ColorSpace 00841 lpMem += WriteNewLineObject (lpMem, BeginArray); // Begin array 00842 00843 //********** /CIEBasedABC 00844 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00845 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00846 00847 //********** Black/White Point 00848 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00849 00850 //********** /RangeABC 00851 lpMem += WriteNewLineObject (lpMem, RangeABCTag); 00852 lpMem += WriteObject (lpMem, RangeABC_Lab); 00853 00854 //********** /DecodeABC 00855 lpMem += WriteNewLineObject (lpMem, DecodeABCTag); 00856 lpMem += WriteObject (lpMem, DecodeABCLab1); 00857 00858 //********** /MatrixABC 00859 lpMem += WriteNewLineObject (lpMem, MatrixABCTag); 00860 lpMem += WriteObject (lpMem, MatrixABCLab); 00861 00862 //********** /DecodeLMN 00863 lpMem += WriteNewLineObject (lpMem, DecodeLMNTag); 00864 lpMem += WriteObject (lpMem, BeginArray); 00865 for (i = 0; i < 3; i ++) 00866 { 00867 lpMem += WriteObject (lpMem, BeginFunction); 00868 lpMem += WriteObject (lpMem, DecodeLMNLab); 00869 if (InputIntent == icAbsoluteColorimetric) 00870 { 00871 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00872 } 00873 else 00874 { 00875 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00876 } 00877 lpMem += WriteObject (lpMem, MulOp); 00878 lpMem += WriteObject (lpMem, EndFunction); 00879 lpMem += WriteObject (lpMem, NewLine); 00880 } 00881 lpMem += WriteObject (lpMem, EndArray); 00882 00883 00884 //********** End dictionary definition 00885 lpMem += WriteNewLineObject (lpMem, EndDict); 00886 lpMem += WriteObject (lpMem, EndArray); 00887 00888 lpMem += WriteNewLineObject (lpMem, CieBasedABCEnd); 00889 *lpcbSize = (DWORD) ((lpMem - lpOldMem)); 00890 return (TRUE); 00891 }

BOOL GetPS2CSA_DEFG CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
CSIG  InputIntent,
SINT  Index,
int  Type,
BOOL  AllowBinary
[static]
 

Definition at line 259 of file jul98/dll32/getcsa.c.

References AllowBinary, BeginArray, BeginDict, BeginFunction, BeginGlobalDict(), BeginString, CieBasedDEFBegin, CieBasedDEFEnd, CieBasedDEFGBegin, CieBasedDEFGEnd, CIEBasedDEFGTag, CIEBasedDEFTag, Clip01, CP_POSTSCRIPT_ERR, CreateInputArray(), CreateOutputArray(), CSIG, DecodeABCLab, DecodeABCTag, DecodeDEFGTag, DecodeDEFTag, DecodeLMNLab, DecodeLMNTag, DWORD, EnableGlobalDict(), EncodeABCLab1, EncodeABCLab2, EndArray, EndClip, EndDict, EndFunction, EndOp, EndString, FALSE, FAR, GetCLUTinfo(), GetCPConnSpace, GetCPElement(), GetCPElementSize(), GetCPElementType(), GetCPTagSig(), GetCPWhitePoint(), GetMediaWP(), GetPublicArrayName(), icAbsoluteColorimetric, icSigLabData, icSigLut16Type, icSigLut8Type, icSigXYZData, icUInt16Number, Index, IndexArray, IndexArray16b, InputArray, lpcpLut16Type, lpcpLut8Type, LPCSIG, LPMEMPTR, LPSFLOAT, LPSINT, MatrixABCLab, MatrixABCTag, MAX_LINELENG, MemAlloc(), MemFree(), MEMPTR, MulOp, NewLine, NULL, OutputArray, RangeLMN, RangeLMNTag, Scale16, Scale16XYZ, Scale8, SendCSABWPoint(), SetCPLastError(), SetGlobalOp, SFLOAT, SINT, StartClip, SupportDEFG_E, SupportDEFG_S, TableTag, TempBfSize, TestingDEFG, TFunction8XYZ, TRUE, TYPE_CIEBASEDDEF, TYPE_CIEBASEDDEFG, ui16toSINT, WriteByteString(), WriteFloat(), WriteHex, WriteHexBuffer(), WriteInt, WriteInt2ByteString(), WriteNewLineObject(), WriteObject, WriteObjectN(), and WriteStringToken().

00267 { 00268 CSIG PCS, LutTag; 00269 CSIG IntentSig; 00270 SFLOAT IlluminantWP[3]; 00271 SFLOAT MediaWP[3]; 00272 SINT nInputCh, nOutputCh, nGrids, SecondGrids; 00273 SINT nInputTable, nOutputTable, nNumbers; 00274 SINT i, j, k; 00275 MEMPTR lpTable; 00276 MEMPTR lpOldMem = lpMem; 00277 MEMPTR lpLut = NULL; 00278 MEMPTR lpLineStart; 00279 HGLOBAL hLut = 0; 00280 SINT LutSize; 00281 char PublicArrayName[TempBfSize]; 00282 // Check if we can generate the CS. 00283 // Required tags are: red, green and blue Colorants. 00284 // As for TRC tags - we are quite flexible here - if we cannot find the 00285 // required tag - we assume the linear responce 00286 if (!GetCPConnSpace (cp, (LPCSIG) & PCS) || 00287 (PCS != icSigLabData) && (PCS != icSigXYZData) || 00288 !GetCPTagSig (cp, Index, (LPCSIG) & IntentSig)) 00289 { 00290 return (FALSE); 00291 } 00292 if (!GetCPElementType (cp, Index, (LPCSIG) & LutTag) || 00293 ((LutTag != icSigLut8Type) && (LutTag != icSigLut16Type)) || 00294 !GetCPElementSize (cp, Index, (LPSINT) & LutSize) || 00295 !MemAlloc (LutSize, (HGLOBAL FAR *) &hLut, (LPMEMPTR) & lpLut) || 00296 !GetCPElement (cp, Index, lpLut, LutSize)) 00297 { 00298 if (0 != hLut) 00299 { 00300 MemFree (hLut); 00301 } 00302 return (FALSE); 00303 } 00304 // Estimate the memory size required to hold CS 00305 00306 GetCLUTinfo(LutTag, lpLut, &nInputCh, &nOutputCh, 00307 &nGrids, &nInputTable, &nOutputTable, &i); 00308 00309 // Level 2 printers support only tri-component CIEBasedABC input, 00310 // but can have either 3 or 4 output channels. 00311 if (!(nOutputCh == 3) || 00312 !((nInputCh == 3) && (Type == TYPE_CIEBASEDDEF)) && 00313 !((nInputCh == 4) && (Type == TYPE_CIEBASEDDEFG))) 00314 { 00315 SetCPLastError (CP_POSTSCRIPT_ERR); 00316 MemFree (hLut); 00317 return (FALSE); 00318 } 00319 if (lpMem == NULL) // This is a size request 00320 { 00321 if (Type == TYPE_CIEBASEDDEFG) 00322 *lpcbSize = nOutputCh * nGrids * nGrids * nGrids * nGrids * 2; // LUT HEX bytes 00323 else 00324 *lpcbSize = nOutputCh * nGrids * nGrids * nGrids * 2; // LUT HEX bytes 00325 00326 *lpcbSize = *lpcbSize + 00327 nInputCh * nInputTable * 6 + 00328 nOutputCh * nOutputTable * 6 + // Number of INT bytes 00329 nInputCh * (lstrlen (IndexArray) + 00330 lstrlen (StartClip) + 00331 lstrlen (EndClip)) + 00332 nOutputCh * (lstrlen (IndexArray) + 00333 lstrlen (StartClip) + 00334 lstrlen (EndClip)) + 00335 4096; // + other PS stuff 00336 00337 00338 return (TRUE); 00339 } 00340 // Get info about Illuminant White Point from the header 00341 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00342 00343 // Support absolute whitePoint 00344 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00345 00346 //*********** Testing CieBasedDEFG support 00347 lpMem += WriteNewLineObject (lpMem, TestingDEFG); 00348 00349 //*********** Creating global data 00350 GetPublicArrayName (cp, IntentSig, PublicArrayName); 00351 if (Type == TYPE_CIEBASEDDEFG) 00352 lpMem += WriteNewLineObject (lpMem, CieBasedDEFGBegin); 00353 else 00354 lpMem += WriteNewLineObject (lpMem, CieBasedDEFBegin); 00355 00356 lpMem += EnableGlobalDict(lpMem); 00357 lpMem += WriteNewLineObject (lpMem, SupportDEFG_S); 00358 lpMem += BeginGlobalDict(lpMem); 00359 00360 lpMem += CreateInputArray (lpMem, nInputCh, nInputTable, 00361 (MEMPTR) PublicArrayName, LutTag, lpLut, AllowBinary, NULL); 00362 00363 if (Type == TYPE_CIEBASEDDEFG) 00364 { 00365 i = nInputTable * nInputCh + 00366 nGrids * nGrids * nGrids * nGrids * nOutputCh; 00367 } else 00368 { 00369 i = nInputTable * nInputCh + 00370 nGrids * nGrids * nGrids * nOutputCh; 00371 } 00372 lpMem += CreateOutputArray (lpMem, nOutputCh, nOutputTable, i, 00373 (MEMPTR) PublicArrayName, LutTag, lpLut, AllowBinary, NULL); 00374 00375 lpMem += WriteNewLineObject (lpMem, EndOp); 00376 lpMem += WriteNewLineObject (lpMem, SupportDEFG_E); 00377 lpMem += WriteNewLineObject (lpMem, SetGlobalOp); 00378 lpMem += WriteNewLineObject (lpMem, SupportDEFG_S); 00379 00380 //*********** Start creating the ColorSpace 00381 lpMem += WriteNewLineObject (lpMem, BeginArray); // Begin array 00382 00383 //********** /CIEBasedDEF(G) 00384 if (Type == TYPE_CIEBASEDDEFG) 00385 lpMem += WriteObject (lpMem, CIEBasedDEFGTag); 00386 else 00387 lpMem += WriteObject (lpMem, CIEBasedDEFTag); 00388 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00389 00390 //********** Black/White Point 00391 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00392 00393 //********** /DecodeDEF(G) 00394 lpLineStart = lpMem; 00395 if (Type == TYPE_CIEBASEDDEFG) 00396 lpMem += WriteNewLineObject (lpMem, DecodeDEFGTag); 00397 else 00398 lpMem += WriteNewLineObject (lpMem, DecodeDEFTag); 00399 00400 lpMem += WriteObject (lpMem, BeginArray); 00401 for (i = 0; i < nInputCh; i++) 00402 { 00403 lpLineStart = lpMem; 00404 00405 lpMem += WriteNewLineObject (lpMem, BeginFunction); 00406 #if 0 00407 if (PCS == icSigLabData) 00408 { 00409 lpMem += WriteObject (lpMem, 00410 (0 == i) ? EncodeABCLab1 : EncodeABCLab2); 00411 } 00412 #endif 00413 lpMem += WriteObject (lpMem, StartClip); 00414 lpMem += WriteObject (lpMem, InputArray); 00415 lpMem += WriteObjectN (lpMem, (MEMPTR) PublicArrayName, lstrlen (PublicArrayName)); 00416 lpMem += WriteInt (lpMem, i); 00417 00418 if (!AllowBinary) // Output ASCII 00419 { 00420 lpMem += WriteObject (lpMem, IndexArray); 00421 } else 00422 { // Output BINARY 00423 if (LutTag == icSigLut8Type) 00424 { 00425 lpMem += WriteObject (lpMem, IndexArray); 00426 } else 00427 { 00428 lpMem += WriteObject (lpMem, IndexArray16b); 00429 } 00430 } 00431 lpMem += WriteObject (lpMem, (LutTag == icSigLut8Type) ? Scale8 : Scale16); 00432 lpMem += WriteObject (lpMem, EndClip); 00433 lpMem += WriteObject (lpMem, EndFunction); 00434 } 00435 lpMem += WriteObject (lpMem, EndArray); 00436 00437 //********** /Table 00438 lpMem += WriteNewLineObject (lpMem, TableTag); 00439 lpMem += WriteObject (lpMem, BeginArray); 00440 00441 lpMem += WriteInt (lpMem, nGrids); // Send down Nh 00442 lpMem += WriteInt (lpMem, nGrids); // Send down Ni 00443 lpMem += WriteInt (lpMem, nGrids); // Send down Nj 00444 nNumbers = nGrids * nGrids * nOutputCh; 00445 SecondGrids = 1; 00446 if (Type == TYPE_CIEBASEDDEFG) 00447 { 00448 lpMem += WriteInt (lpMem, nGrids); // Send down Nk 00449 // nNumbers = nGrids * nGrids * nGrids * nOutputCh ; 00450 SecondGrids = nGrids; 00451 } 00452 lpMem += WriteNewLineObject (lpMem, BeginArray); 00453 for (i = 0; i < nGrids; i++) // Nh strings should be sent 00454 { 00455 if (Type == TYPE_CIEBASEDDEFG) 00456 { 00457 lpMem += WriteNewLineObject (lpMem, BeginArray); 00458 } 00459 for (k = 0; k < SecondGrids; k++) 00460 { 00461 lpLineStart = lpMem; 00462 lpMem += WriteObject (lpMem, NewLine); 00463 if (LutTag == icSigLut8Type) 00464 { 00465 lpTable = (MEMPTR) (((lpcpLut8Type) lpLut)->lut.data) + 00466 nInputTable * nInputCh + 00467 nNumbers * (i * SecondGrids + k); 00468 } else 00469 { 00470 lpTable = (MEMPTR) (((lpcpLut16Type) lpLut)->lut.data) + 00471 2 * nInputTable * nInputCh + 00472 2 * nNumbers * (i * SecondGrids + k); 00473 } 00474 00475 if (!AllowBinary) // Output ASCII 00476 { 00477 lpMem += WriteObject (lpMem, BeginString); 00478 if (LutTag == icSigLut8Type) 00479 lpMem += WriteHexBuffer (lpMem, lpTable, lpLineStart, nNumbers); 00480 else 00481 { 00482 for (j = 0; j < nNumbers; j++) 00483 { 00484 lpMem += WriteHex (lpMem, ui16toSINT (lpTable) / 256); 00485 lpTable += sizeof (icUInt16Number); 00486 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 00487 { 00488 lpLineStart = lpMem; 00489 lpMem += WriteObject (lpMem, NewLine); 00490 } 00491 } 00492 } 00493 lpMem += WriteObject (lpMem, EndString); 00494 } else 00495 { // Output BINARY 00496 lpMem += WriteStringToken (lpMem, 143, nNumbers); 00497 if (LutTag == icSigLut8Type) 00498 lpMem += WriteByteString (lpMem, lpTable, nNumbers); 00499 else 00500 lpMem += WriteInt2ByteString (lpMem, lpTable, nNumbers); 00501 } 00502 lpMem += WriteObject (lpMem, NewLine); 00503 } 00504 if (Type == TYPE_CIEBASEDDEFG) 00505 { 00506 lpMem += WriteObject (lpMem, EndArray); 00507 } 00508 } 00509 lpMem += WriteObject (lpMem, EndArray); 00510 lpMem += WriteObject (lpMem, EndArray); // End array 00511 00512 //********** /DecodeABC 00513 lpLineStart = lpMem; 00514 lpMem += WriteNewLineObject (lpMem, DecodeABCTag); 00515 lpMem += WriteObject (lpMem, BeginArray); 00516 for (i = 0; i < nOutputCh; i++) 00517 { 00518 lpLineStart = lpMem; 00519 lpMem += WriteNewLineObject (lpMem, BeginFunction); 00520 lpMem += WriteObject (lpMem, Clip01); 00521 lpMem += WriteObject (lpMem, OutputArray); 00522 lpMem += WriteObjectN (lpMem, (MEMPTR) PublicArrayName, lstrlen (PublicArrayName)); 00523 lpMem += WriteInt (lpMem, i); 00524 00525 if (!AllowBinary) // Output ASCII CRD 00526 { 00527 lpMem += WriteObject (lpMem, NewLine); 00528 00529 if (LutTag == icSigLut8Type) 00530 { 00531 lpMem += WriteObject (lpMem, TFunction8XYZ); 00532 } else 00533 { 00534 lpMem += WriteObject (lpMem, IndexArray); 00535 lpMem += WriteObject (lpMem, Scale16XYZ); 00536 } 00537 } else 00538 { // Output BINARY CRD 00539 if (LutTag == icSigLut8Type) 00540 { 00541 lpMem += WriteObject (lpMem, TFunction8XYZ); 00542 } else 00543 { 00544 lpMem += WriteObject (lpMem, IndexArray16b); 00545 lpMem += WriteObject (lpMem, Scale16XYZ); 00546 } 00547 } 00548 00549 // Now, We get CieBasedXYZ output. Output range 0 --> 1.99997 00550 // If the connection space is absolute XYZ, We need to convert 00551 // from relative XYZ to absolute XYZ. 00552 if ((PCS == icSigXYZData) && 00553 (InputIntent == icAbsoluteColorimetric)) 00554 { 00555 lpMem += WriteFloat (lpMem, (double)MediaWP[i]/IlluminantWP[i]); 00556 lpMem += WriteObject (lpMem, MulOp); 00557 } 00558 // If the connection space is Lab, We need to convert XYZ to Lab. 00559 else if (PCS == icSigLabData) 00560 lpMem += WriteObject (lpMem, DecodeABCLab[i]); 00561 lpMem += WriteObject (lpMem, EndFunction); 00562 } 00563 lpMem += WriteObject (lpMem, EndArray); 00564 00565 if (PCS == icSigLabData) 00566 { 00567 //********** /MatrixABC 00568 lpMem += WriteNewLineObject (lpMem, MatrixABCTag); 00569 lpMem += WriteObject (lpMem, MatrixABCLab); 00570 00571 //********** /DecodeLMN 00572 lpLineStart = lpMem; 00573 lpMem += WriteNewLineObject (lpMem, DecodeLMNTag); 00574 lpMem += WriteObject (lpMem, BeginArray); 00575 for (i = 0; i < 3; i++) 00576 { 00577 lpLineStart = lpMem; 00578 lpMem += WriteNewLineObject (lpMem, BeginFunction); 00579 lpMem += WriteObject (lpMem, DecodeLMNLab); 00580 if (InputIntent == icAbsoluteColorimetric) 00581 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00582 else 00583 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00584 lpMem += WriteObject (lpMem, MulOp); 00585 lpMem += WriteObject (lpMem, EndFunction); 00586 } 00587 lpMem += WriteObject (lpMem, EndArray); 00588 } else 00589 { 00590 //********** /RangeLMN 00591 lpMem += WriteNewLineObject (lpMem, RangeLMNTag); 00592 lpMem += WriteObject (lpMem, RangeLMN); 00593 } 00594 00595 //********** End dictionary definition 00596 lpMem += WriteNewLineObject (lpMem, EndDict); 00597 lpMem += WriteObject (lpMem, EndArray); 00598 00599 if (Type == TYPE_CIEBASEDDEFG) 00600 lpMem += WriteNewLineObject (lpMem, CieBasedDEFGEnd); 00601 else 00602 lpMem += WriteNewLineObject (lpMem, CieBasedDEFEnd); 00603 00604 lpMem += WriteNewLineObject (lpMem, SupportDEFG_E); 00605 00606 *lpcbSize = (DWORD) (lpMem - lpOldMem); 00607 00608 MemFree (hLut); 00609 return (TRUE); 00610 }

BOOL GetPS2CSA_DEFG_Intent CHANDLE  cp,
MEMPTR  lpBuffer,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp,
CSIG  Intent,
int  Type,
BOOL  AllowBinary
 

Definition at line 1493 of file jul98/dll32/getcsa.c.

References AllowBinary, BOOL, CSIG, DoesCPTagExist(), FALSE, GetCPTagIndex(), GetPS2CSA_DEFG(), icAbsoluteColorimetric, icPerceptual, icRelativeColorimetric, icSaturation, icSigAToB0Tag, icSigAToB1Tag, icSigAToB2Tag, icSigCmykData, icSigDefData, Index, Intent, LPSINT, SINT, TYPE_CIEBASEDDEF, and TYPE_CIEBASEDDEFG.

Referenced by ColorSpaceControl(), and GetPS2ColorSpaceArray().

01501 { 01502 SINT Index; 01503 BOOL Success = FALSE; 01504 CSIG icSigAToBx; 01505 01506 // Try to create CieBasedDEFG CSA first. 01507 if (((Type == TYPE_CIEBASEDDEFG) && (InpDrvClrSp != icSigCmykData) || 01508 (Type == TYPE_CIEBASEDDEF) && (InpDrvClrSp != icSigDefData)) && 01509 (InpDrvClrSp != 0)) 01510 { 01511 return (FALSE); 01512 } 01513 switch (Intent) 01514 { 01515 case icPerceptual: 01516 icSigAToBx = icSigAToB0Tag; 01517 break; 01518 case icRelativeColorimetric: 01519 icSigAToBx = icSigAToB1Tag; 01520 break; 01521 case icSaturation: 01522 icSigAToBx = icSigAToB2Tag; 01523 break; 01524 case icAbsoluteColorimetric: 01525 icSigAToBx = icSigAToB1Tag; 01526 break; 01527 default: 01528 return Success; 01529 } 01530 01531 if (DoesCPTagExist (cp, icSigAToBx) && 01532 GetCPTagIndex (cp, icSigAToBx, (LPSINT) & Index)) 01533 { 01534 Success = GetPS2CSA_DEFG (cp, lpBuffer, lpcbSize, Intent, Index, Type, AllowBinary); 01535 } 01536 01537 return Success; 01538 }

BOOL GetPS2CSA_MONO CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
DWORD  InpDrvClrSp,
CSIG  InputIntent,
BOOL  AllowBinary
[static]
 

Definition at line 1244 of file jul98/dll32/getcsa.c.

References AllowBinary, BOOL, FALSE, GetPS2CSA_MONO_A(), GetPS2CSA_MONO_ABC(), icSigDefData, icSigGrayData, and icSigRgbData.

Referenced by GetPS2ColorSpaceArray().

01246 { 01247 BOOL Success = FALSE; 01248 #if 0 01249 if ((InpDrvClrSp == icSigRgbData) || 01250 (InpDrvClrSp == icSigDefData) || 01251 (InpDrvClrSp == 0)) 01252 { 01253 Success = GetPS2CSA_MONO_ABC (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01254 } else if (InpDrvClrSp == icSigGrayData) 01255 { 01256 Success = GetPS2CSA_MONO_A (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01257 } 01258 #else 01259 if ((InpDrvClrSp == icSigGrayData) || 01260 (InpDrvClrSp == 0)) 01261 { 01262 Success = GetPS2CSA_MONO_A (cp, lpMem, lpcbSize, InputIntent, AllowBinary); 01263 } 01264 else 01265 { 01266 Success = FALSE; 01267 } 01268 #endif 01269 return Success; 01270 }

BOOL GetPS2CSA_MONO_A CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
CSIG  InputIntent,
BOOL  AllowBinary
[static]
 

Definition at line 1076 of file jul98/dll32/getcsa.c.

References BeginArray, BeginDict, BeginFunction, CieBasedABegin, CieBasedAEnd, CIEBasedATag, CSIG, DecodeA3, DecodeALab, DecodeATag, DecodeLMNLab, DoesCPTagExist(), DWORD, EndArray, EndClip, EndDict, EndFunction, FALSE, FAR, GetCPConnSpace, GetCPElement(), GetCPElementSize(), GetCPElementType(), GetCPTagIndex(), GetCPWhitePoint(), GetMediaWP(), icAbsoluteColorimetric, icSigCurveType, icSigGrayTRCTag, icSigLabData, icUInt16Number, Index, IndexArray, lpcpCurveType, LPCSIG, LPMEMPTR, LPSFLOAT, LPSINT, MatrixATag, MAX_LINELENG, MemAlloc(), MemFree(), MEMPTR, NewLine, NULL, RangeLMN, RangeLMNTag, Scale16, SendCSABWPoint(), SFLOAT, SINT, StartClip, TRUE, ui16toSINT, ui32toSINT, WriteFloat(), WriteInt, WriteNewLineObject(), and WriteObject.

01078 { 01079 SINT nCount; 01080 CSIG Tag, PCS; 01081 SINT i, Index; 01082 MEMPTR lpTable; 01083 SFLOAT IlluminantWP[3]; 01084 SFLOAT MediaWP[3]; 01085 MEMPTR lpBuff = NULL; 01086 SINT MemSize = 0; 01087 MEMPTR lpOldMem = lpMem; 01088 HGLOBAL hBuff; 01089 MEMPTR lpLineStart; 01090 // Check if we can generate the CS 01091 if (!DoesCPTagExist (cp, icSigGrayTRCTag) || 01092 !GetCPTagIndex (cp, icSigGrayTRCTag, &Index) || 01093 !GetCPElementType (cp, Index, (LPCSIG) & Tag) || 01094 (Tag != icSigCurveType) || 01095 !GetCPConnSpace (cp, (LPCSIG) & PCS) || 01096 !GetCPElementSize (cp, Index, (LPSINT) & MemSize) || 01097 !MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & lpBuff) || 01098 !GetCPElement (cp, Index, lpBuff, MemSize)) 01099 { 01100 if (NULL != lpBuff) 01101 { 01102 MemFree (hBuff); 01103 } 01104 return (FALSE); 01105 } 01106 nCount = ui32toSINT (((lpcpCurveType) lpBuff)->curve.count); 01107 01108 // Estimate the memory size required to hold CS 01109 *lpcbSize = nCount * 6 + // Number of INT elements 01110 3 * (lstrlen (IndexArray) + 01111 lstrlen (StartClip) + 01112 lstrlen (EndClip)) + 01113 2048; // + other PS stuff 01114 if (lpMem == NULL) // This is a size request 01115 { 01116 MemFree (hBuff); 01117 return (TRUE); 01118 } 01119 // Get info about Illuminant White Point from the header 01120 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 01121 01122 // Support absolute whitePoint 01123 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 01124 01125 //*********** Start creating the ColorSpace 01126 lpMem += WriteNewLineObject (lpMem, CieBasedABegin); 01127 01128 lpMem += WriteNewLineObject (lpMem, BeginArray); // Begin array 01129 //********** /CIEBasedA 01130 lpMem += WriteObject (lpMem, CIEBasedATag); // Create entry 01131 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 01132 01133 //********** Black/White Point 01134 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 01135 01136 //********** /DecodeA 01137 lpMem += WriteObject (lpMem, NewLine); 01138 lpLineStart = lpMem; 01139 01140 if (nCount != 0) 01141 { 01142 lpMem += WriteObject (lpMem, DecodeATag); 01143 lpMem += WriteObject (lpMem, BeginArray); 01144 01145 lpMem += WriteObject (lpMem, BeginFunction); 01146 if (nCount == 1) // Gamma supplied in ui16 format 01147 { 01148 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 01149 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01150 lpMem += WriteObject (lpMem, DecodeA3); 01151 // If the PCS is Lab, we need to convert Lab to XYZ 01152 // Now, the range is from 0 --> 0.99997. 01153 // Actually, the conversion from Lab to XYZ is not needed. 01154 if (PCS == icSigLabData) 01155 { 01156 lpMem += WriteObject (lpMem, DecodeALab); 01157 lpMem += WriteObject (lpMem, DecodeLMNLab); 01158 } 01159 } else 01160 { 01161 lpMem += WriteObject (lpMem, StartClip); 01162 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 01163 lpMem += WriteObject (lpMem, BeginArray); 01164 for (i = 0; i < nCount; i++) 01165 { 01166 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 01167 lpTable += sizeof (icUInt16Number); 01168 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 01169 { 01170 lpLineStart = lpMem; 01171 lpMem += WriteObject (lpMem, NewLine); 01172 } 01173 } 01174 lpMem += WriteObject (lpMem, EndArray); 01175 lpLineStart = lpMem; 01176 lpMem += WriteObject (lpMem, NewLine); 01177 01178 lpMem += WriteObject (lpMem, IndexArray); 01179 lpMem += WriteObject (lpMem, Scale16); 01180 // If the PCS is Lab, we need to convert Lab to XYZ 01181 // Now, the range is from 0 --> .99997. 01182 // Actually, the conversion from Lab to XYZ is not needed. 01183 if (PCS == icSigLabData) 01184 { 01185 lpMem += WriteObject (lpMem, DecodeALab); 01186 lpMem += WriteObject (lpMem, DecodeLMNLab); 01187 } 01188 lpMem += WriteObject (lpMem, EndClip); 01189 } 01190 lpMem += WriteObject (lpMem, EndFunction); 01191 lpMem += WriteObject (lpMem, EndArray); 01192 } 01193 01194 //********** /MatrixA 01195 lpMem += WriteNewLineObject (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 += WriteNewLineObject (lpMem, RangeLMNTag); 01208 lpMem += WriteObject (lpMem, RangeLMN); 01209 01210 //********** /End dictionary 01211 lpMem += WriteObject (lpMem, EndDict); // End dictionary definition 01212 lpMem += WriteObject (lpMem, EndArray); 01213 01214 MemFree (hBuff); 01215 01216 lpMem += WriteNewLineObject (lpMem, CieBasedAEnd); 01217 *lpcbSize = (DWORD) (lpMem - lpOldMem); 01218 return (TRUE); 01219 }

BOOL GetPS2CSA_MONO_ABC CHANDLE  cp,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
CSIG  InputIntent,
BOOL  AllowBinary
[static]
 

Definition at line 916 of file jul98/dll32/getcsa.c.

References BeginArray, BeginDict, BeginFunction, CieBasedABCBegin, CieBasedABCEnd, CIEBasedABCTag, CSIG, DecodeA3, DecodeABCTag, DoesCPTagExist(), DupOp, DWORD, EndArray, EndClip, EndDict, EndFunction, FALSE, FAR, GetCPConnSpace, GetCPElement(), GetCPElementSize(), GetCPElementType(), GetCPTagIndex(), GetCPWhitePoint(), GetMediaWP(), icAbsoluteColorimetric, icSigCurveType, icSigGrayTRCTag, icUInt16Number, Index, IndexArray, lpcpCurveType, LPCSIG, LPMEMPTR, LPSFLOAT, LPSINT, MatrixABCTag, MAX_LINELENG, MemAlloc(), MemFree(), MEMPTR, NewLine, NULL, RangeLMN, RangeLMNTag, Scale16, SendCSABWPoint(), SFLOAT, SINT, StartClip, TRUE, ui16toSINT, ui32toSINT, WriteFloat(), WriteInt, WriteNewLineObject(), and WriteObject.

Referenced by GetPS2CSA_MONO().

00918 { 00919 SINT nCount; 00920 CSIG Tag, PCS; 00921 SINT i, j, Index; 00922 MEMPTR lpTable; 00923 SFLOAT IlluminantWP[3]; 00924 SFLOAT MediaWP[3]; 00925 MEMPTR lpBuff = NULL; 00926 SINT MemSize = 0; 00927 MEMPTR lpOldMem = lpMem; 00928 HGLOBAL hBuff; 00929 MEMPTR lpLineStart; 00930 // Check if we can generate the CS 00931 if (!DoesCPTagExist (cp, icSigGrayTRCTag) || 00932 !GetCPTagIndex (cp, icSigGrayTRCTag, &Index) || 00933 !GetCPElementType (cp, Index, (LPCSIG) & Tag) || 00934 (Tag != icSigCurveType) || 00935 !GetCPConnSpace (cp, (LPCSIG) & PCS) || 00936 !GetCPElementSize (cp, Index, (LPSINT) & MemSize) || 00937 !MemAlloc (MemSize, (HGLOBAL FAR *)&hBuff, (LPMEMPTR) & lpBuff) || 00938 !GetCPElement (cp, Index, lpBuff, MemSize)) 00939 { 00940 if (NULL != lpBuff) 00941 { 00942 MemFree (hBuff); 00943 } 00944 return (FALSE); 00945 } 00946 nCount = ui32toSINT (((lpcpCurveType) lpBuff)->curve.count); 00947 00948 // Estimate the memory size required to hold CS 00949 *lpcbSize = nCount * 6 + // Number of INT elements 00950 3 * (lstrlen (IndexArray) + 00951 lstrlen (StartClip) + 00952 lstrlen (EndClip)) + 00953 2048; // + other PS stuff 00954 if (lpMem == NULL) // This is a size request 00955 { 00956 MemFree (hBuff); 00957 return (TRUE); 00958 } 00959 // Get info about Illuminant White Point from the header 00960 GetCPWhitePoint (cp, (LPSFLOAT) & IlluminantWP); // .. Illuminant 00961 00962 // Support absolute whitePoint 00963 GetMediaWP(cp, InputIntent, IlluminantWP, MediaWP); 00964 00965 //*********** Start creating the ColorSpace 00966 lpMem += WriteNewLineObject (lpMem, CieBasedABCBegin); 00967 00968 lpMem += WriteNewLineObject (lpMem, BeginArray); // Begin array 00969 //********** /CIEBasedABC 00970 lpMem += WriteObject (lpMem, CIEBasedABCTag); // Create entry 00971 lpMem += WriteObject (lpMem, BeginDict); // Begin dictionary 00972 00973 //********** Black/White Point 00974 lpMem += SendCSABWPoint(lpMem, InputIntent, IlluminantWP, MediaWP); 00975 00976 //********** /DecodeABC 00977 lpMem += WriteObject (lpMem, NewLine); 00978 lpLineStart = lpMem; 00979 00980 if (nCount != 0) 00981 { 00982 lpMem += WriteObject (lpMem, DecodeABCTag); 00983 lpMem += WriteObject (lpMem, BeginArray); 00984 00985 lpMem += WriteObject (lpMem, BeginFunction); 00986 if (nCount == 1) // Gamma supplied in ui16 format 00987 { 00988 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 00989 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 00990 lpMem += WriteObject (lpMem, DecodeA3); 00991 } else 00992 { 00993 lpMem += WriteObject (lpMem, StartClip); 00994 lpTable = (MEMPTR) (((lpcpCurveType) lpBuff)->curve.data); 00995 lpMem += WriteObject (lpMem, BeginArray); 00996 for (i = 0; i < nCount; i++) 00997 { 00998 lpMem += WriteInt (lpMem, ui16toSINT (lpTable)); 00999 lpTable += sizeof (icUInt16Number); 01000 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 01001 { 01002 lpLineStart = lpMem; 01003 lpMem += WriteObject (lpMem, NewLine); 01004 } 01005 } 01006 lpMem += WriteObject (lpMem, EndArray); 01007 lpLineStart = lpMem; 01008 lpMem += WriteObject (lpMem, NewLine); 01009 01010 lpMem += WriteObject (lpMem, IndexArray); 01011 lpMem += WriteObject (lpMem, Scale16); 01012 lpMem += WriteObject (lpMem, EndClip); 01013 } 01014 lpMem += WriteObject (lpMem, EndFunction); 01015 lpMem += WriteObject (lpMem, DupOp); 01016 lpMem += WriteObject (lpMem, DupOp); 01017 lpMem += WriteObject (lpMem, EndArray); 01018 } 01019 //********** /MatrixABC 01020 lpMem += WriteNewLineObject (lpMem, MatrixABCTag); 01021 lpMem += WriteObject (lpMem, BeginArray); 01022 for (i = 0; i < 3; i ++) 01023 { 01024 for (j = 0; j < 3; j++) 01025 { 01026 if (i != j) 01027 lpMem += WriteFloat (lpMem, (double)0); 01028 else 01029 { 01030 if (InputIntent == icAbsoluteColorimetric) 01031 lpMem += WriteFloat (lpMem, (double)MediaWP[i]); 01032 else 01033 lpMem += WriteFloat (lpMem, (double)IlluminantWP[i]); 01034 } 01035 } 01036 } 01037 lpMem += WriteObject (lpMem, EndArray); 01038 01039 //********** /RangeLMN 01040 lpMem += WriteNewLineObject (lpMem, RangeLMNTag); 01041 lpMem += WriteObject (lpMem, RangeLMN); 01042 01043 01044 lpMem += WriteObject (lpMem, EndDict); // End dictionary definition 01045 lpMem += WriteObject (lpMem, EndArray); 01046 01047 MemFree (hBuff); 01048 01049 lpMem += WriteNewLineObject (lpMem, CieBasedABCEnd); 01050 *lpcbSize = (DWORD) (lpMem - lpOldMem); 01051 return (TRUE); 01052 }

SINT GetPublicArrayName CHANDLE  cp,
CSIG  IntentSig,
MEMPTR  PublicArrayName
 

Definition at line 152 of file jul98/dll32/getcsa.c.

References CSIG, and MEMPTR.

00153 { 00154 MEMPTR OldPtr; 00155 OldPtr = PublicArrayName; 00156 PublicArrayName[0] = 0; 00157 MemCopy (PublicArrayName, (MEMPTR) & IntentSig, sizeof (CSIG)); 00158 PublicArrayName += sizeof (CSIG); 00159 PublicArrayName[0] = 0; 00160 return (PublicArrayName - OldPtr); 00161 }

SINT SendCSABWPoint MEMPTR  lpMem,
CSIG  Intent,
LPSFLOAT  IlluminantWP,
LPSFLOAT  MediaWP
[static]
 

Definition at line 163 of file jul98/dll32/getcsa.c.

References BeginArray, BlackPoint, BlackPointTag, EndArray, icAbsoluteColorimetric, Intent, MEMPTR, SINT, WhitePointTag, WriteFloat(), WriteNewLineObject(), and WriteObject.

00165 { 00166 SINT i; 00167 MEMPTR lpOldMem = lpMem; 00168 00169 //********** /BlackPoint 00170 lpMem += WriteNewLineObject (lpMem, BlackPointTag); 00171 lpMem += WriteObject (lpMem, BlackPoint); 00172 00173 //********** /WhitePoint 00174 lpMem += WriteNewLineObject (lpMem, WhitePointTag); 00175 lpMem += WriteObject (lpMem, BeginArray); 00176 for (i = 0; i < 3; i++) 00177 { 00178 if (Intent == icAbsoluteColorimetric) 00179 { 00180 lpMem += WriteFloat (lpMem, (double) MediaWP[i]); 00181 } 00182 else 00183 { 00184 lpMem += WriteFloat (lpMem, (double) IlluminantWP[i]); 00185 } 00186 } 00187 lpMem += WriteObject (lpMem, EndArray); 00188 return (SINT)(lpMem - lpOldMem); 00189 }


Variable Documentation

char* DecodeABCLab[] [static]
 

Initial value:

{"50 mul 16 add 116 div ", "128 mul 128 sub 500 div", "128 mul 128 sub 200 div"}

Definition at line 6 of file jul98/dll32/getcsa.c.

Referenced by GetPS2CSA_DEFG().


Generated on Sat May 15 19:43:53 2004 for test by doxygen 1.3.7