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 GetDeviceCMYK (MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp)
BOOL GetDeviceGray (MEMPTR lpMem, LPDWORD lpcbSize, DWORD InpDrvClrSp)
SINT GetPublicArrayName (CHANDLE cp, CSIG IntentSig, MEMPTR PublicArrayName)
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 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 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 199 of file dec97/dll32/getcsa.c.

References BeginOp, CurrentGlobalOp, GlobalDictOp, MEMPTR, NewLine, SetGlobalOp, SINT, TrueOp, and WriteObject.

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 }

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

Definition at line 1442 of file dec97/dll32/getcsa.c.

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

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 }

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

Definition at line 79 of file dec97/dll32/getcsa.c.

References DeviceCMYKTag, DWORD, FALSE, icSigCmykData, MEMPTR, NewLine, NULL, TRUE, and WriteObject.

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 }

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

Definition at line 105 of file dec97/dll32/getcsa.c.

References DeviceGrayTag, DeviceRGBTag, DWORD, icSigDefData, icSigGrayData, icSigRgbData, MEMPTR, NewLine, NULL, TRUE, and WriteObject.

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 }

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

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

References DeviceRGBTag, DWORD, FALSE, icSigDefData, icSigRgbData, MEMPTR, NewLine, NULL, TRUE, and WriteObject.

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 }

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

Definition at line 185 of file dec97/dll32/getcsa.c.

References GetCPMediaWhitePoint(), icAbsoluteColorimetric, and LPSFLOAT.

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 }

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

Definition at line 1571 of file dec97/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, and WriteObject.

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 }

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

Definition at line 634 of file dec97/dll32/getcsa.c.

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 }

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

Definition at line 786 of file dec97/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(), and WriteObject.

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 }

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

Definition at line 237 of file dec97/dll32/getcsa.c.

References AllowBinary, BeginArray, BeginDict, BeginFunction, 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(), WriteObject, WriteObjectN(), and WriteStringToken().

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 }

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

Definition at line 1494 of file dec97/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.

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 }

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

Definition at line 1246 of file dec97/dll32/getcsa.c.

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

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 }

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

Definition at line 1073 of file dec97/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, and WriteObject.

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 }

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

Definition at line 908 of file dec97/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, and WriteObject.

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 }

SINT GetPublicArrayName CHANDLE  cp,
CSIG  IntentSig,
MEMPTR  PublicArrayName
 

Definition at line 144 of file dec97/dll32/getcsa.c.

References CSIG, and MEMPTR.

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 }

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

Definition at line 155 of file dec97/dll32/getcsa.c.

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

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 }


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 dec97/dll32/getcsa.c.

Referenced by GetPS2CSA_DEFG().


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