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

profcrd.h File Reference

Go to the source code of this file.

Classes

struct  tagHOSTCLUT

Defines

#define MAXCHANNELS   4
#define PREVIEWCRDGRID   16

Typedefs

typedef tagHOSTCLUT HOSTCLUT
typedef HOSTCLUT __huge * LPHOSTCLUT

Functions

BOOL EXTERN GetPS2PreviewColorRenderingDictionary (CHANDLE cpDev, CHANDLE cpTarget, DWORD Intent, MEMPTR lpMem, LPDWORD lpcbSize, BOOL AllowBinary)


Define Documentation

#define MAXCHANNELS   4
 

Definition at line 4 of file dec97/dll32/profcrd.h.

#define PREVIEWCRDGRID   16
 

Definition at line 5 of file dec97/dll32/profcrd.h.


Typedef Documentation

typedef struct tagHOSTCLUT HOSTCLUT
 

typedef HOSTCLUT __huge* LPHOSTCLUT
 

Definition at line 26 of file dec97/dll32/profcrd.h.


Function Documentation

BOOL EXTERN GetPS2PreviewColorRenderingDictionary CHANDLE  cpDev,
CHANDLE  cpTarget,
DWORD  Intent,
MEMPTR  lpMem,
LPDWORD  lpcbSize,
BOOL  AllowBinary
 

Definition at line 1954 of file aug98/dll32/profcrd.c.

01960 { 01961 MEMPTR lpTargetCRD, lpTargetCSA, lpDevCRD; 01962 DWORD cbTargetCRD, cbTargetCSA, cbDevCRD; 01963 HGLOBAL hTargetCRD, hTargetCSA, hDevCRD; 01964 BOOL Success = FALSE; 01965 float Input[MAXCHANNELS]; 01966 float Output[MAXCHANNELS]; 01967 float Temp[MAXCHANNELS]; 01968 int i, j, k, l; 01969 MEMPTR lpLineStart; 01970 MEMPTR lpOldMem; 01971 CSIG ColorSpace; 01972 CSIG DevColorSpace; 01973 static CSIG IntentTag; 01974 static SINT PreviewCRDGrid; 01975 SINT OutArraySize, InArraySize; 01976 char PublicArrayName[TempBfSize]; 01977 SINT TargetGrids, DevGrids; 01978 01979 // First pass, return the size of Previewind CRD. 01980 if (lpMem == NULL) 01981 { 01982 SINT dwOutArraySizr = 0; 01983 01984 i = 3; // Default output channal; 01985 if ((GetCPDevSpace (cpDev, (LPCSIG) & DevColorSpace)) && 01986 (DevColorSpace == icSigCmykData)) 01987 { 01988 i = 4; 01989 } 01990 01991 // Get the input array size IntentTag and Grid of the Target icc profile. 01992 if (!GetCRDInputOutputArraySize(cpTarget, Intent, 01993 &InArraySize, NULL, &IntentTag, &TargetGrids )) 01994 return FALSE; 01995 01996 // Get the output array size IntentTag and Grid of the Dev icc profile. 01997 if (!GetCRDInputOutputArraySize(cpDev, Intent, 01998 NULL, &OutArraySize, &IntentTag, &DevGrids )) 01999 return FALSE; 02000 02001 PreviewCRDGrid = (TargetGrids > DevGrids)? TargetGrids: DevGrids; 02002 02003 // Min proofing CRD grid will be PREVIEWCRDGRID 02004 if (PreviewCRDGrid < PREVIEWCRDGRID) 02005 PreviewCRDGrid = PREVIEWCRDGRID; 02006 *lpcbSize = PreviewCRDGrid * PreviewCRDGrid * PreviewCRDGrid * 02007 i * 2 + // CLUT size (Hex output) 02008 OutArraySize + // Output Array size 02009 InArraySize + // Input Array size 02010 4096; // Extra PostScript staff. 02011 return (TRUE); 02012 } 02013 02014 // Second pass, return the Previewind CRD. 02015 lpOldMem = lpMem; 02016 02017 //Query the sizes of Host TargetCRD, TargetCSA and DevCRD. 02018 if (!(GetHostColorRenderingDictionary (cpTarget, Intent, NULL, &cbTargetCRD)) || 02019 !(GetHostColorSpaceArray (cpTarget, Intent, NULL, &cbTargetCSA)) || 02020 !(GetHostColorRenderingDictionary (cpDev, Intent, NULL, &cbDevCRD))) 02021 { 02022 return (Success); 02023 } 02024 02025 //Alloc the buffers for Host TargetCRD, TargetCSA and DevCRD. 02026 hTargetCRD = hTargetCSA = hDevCRD = 0; 02027 if (!MemAlloc (cbTargetCRD, (HGLOBAL FAR *)&hTargetCRD, (LPMEMPTR)&lpTargetCRD) || 02028 !MemAlloc (cbTargetCSA, (HGLOBAL FAR *)&hTargetCSA, (LPMEMPTR)&lpTargetCSA) || 02029 !MemAlloc (cbDevCRD, (HGLOBAL FAR *)&hDevCRD, (LPMEMPTR)&lpDevCRD)) 02030 { 02031 goto Done; 02032 } 02033 02034 //Build Host TargetCRD, TargetCSA and DevCRD. 02035 if (!(GetHostColorRenderingDictionary (cpTarget, Intent, lpTargetCRD, &cbTargetCRD)) || 02036 !(GetHostColorSpaceArray (cpTarget, Intent, lpTargetCSA, &cbTargetCSA)) || 02037 !(GetHostColorRenderingDictionary (cpDev, Intent, lpDevCRD, &cbDevCRD))) 02038 { 02039 goto Done; 02040 } 02041 02042 // Build Proofing CRD based on Host TargetCRD TargetCSA and DevCRD. 02043 // We use TargetCRD input tables and matrix as the 02044 // input tables and matrix of the ProofCRD. 02045 // We use DevCRD output tables as the output tables of the ProofCRD. 02046 02047 //******** Define golbal array used in EncodeABC and RenderTaber 02048 GetPublicArrayName (cpDev, IntentTag, PublicArrayName); 02049 lpMem += WriteNewLineObject (lpMem, CRDBegin); 02050 02051 lpMem += EnableGlobalDict(lpMem); 02052 lpMem += BeginGlobalDict(lpMem); 02053 02054 lpMem += CreateInputArray (lpMem, (SINT)0, (SINT)0, (MEMPTR)PublicArrayName, 02055 (CSIG)0, NULL, bAllowBinary, lpTargetCRD); 02056 02057 lpMem += CreateOutputArray (lpMem, (SINT)0, (SINT)0, (SINT)0, 02058 (MEMPTR)PublicArrayName, (CSIG)0, NULL, bAllowBinary, lpDevCRD); 02059 02060 lpMem += EndGlobalDict(lpMem); 02061 02062 //************* Start writing CRD **************************** 02063 lpMem += WriteNewLineObject (lpMem, BeginDict); // Begin dictionary 02064 lpMem += WriteObject (lpMem, DictType); // Dictionary type 02065 02066 lpMem += WriteNewLineObject (lpMem, IntentType); // RenderingIntent 02067 switch (Intent) 02068 { 02069 case icPerceptual: 02070 lpMem += WriteObject (lpMem, IntentPer); 02071 break; 02072 02073 case icSaturation: 02074 lpMem += WriteObject (lpMem, IntentSat); 02075 break; 02076 02077 case icRelativeColorimetric: 02078 lpMem += WriteObject (lpMem, IntentRCol); 02079 break; 02080 02081 case icAbsoluteColorimetric: 02082 lpMem += WriteObject (lpMem, IntentACol); 02083 break; 02084 } 02085 02086 //********** Send Black/White Point. 02087 lpMem += SendCRDBWPoint(lpMem, 02088 ((LPHOSTCLUT)lpTargetCRD)->whitePoint); 02089 02090 //********** Send PQR - For White Point correction 02091 lpMem += SendCRDPQR(lpMem, Intent, 02092 ((LPHOSTCLUT)lpTargetCRD)->whitePoint); 02093 02094 //********** Send LMN - For Absolute Colorimetric use WhitePoint's XYZs 02095 lpMem += SendCRDLMN(lpMem, Intent, 02096 ((LPHOSTCLUT)lpTargetCRD)->whitePoint, 02097 ((LPHOSTCLUT)lpTargetCRD)->mediaWP, 02098 ((LPHOSTCLUT)lpTargetCRD)->pcs); 02099 02100 //********** Create MatrixABC and EncodeABC stuff 02101 lpMem += SendCRDABC(lpMem, PublicArrayName, 02102 ((LPHOSTCLUT)lpTargetCRD)->pcs, 02103 ((LPHOSTCLUT)lpTargetCRD)->inputChan, 02104 NULL, 02105 ((LPHOSTCLUT)lpTargetCRD)->e, 02106 (((LPHOSTCLUT)lpTargetCRD)->lutBits == 8)? icSigLut8Type:icSigLut16Type, 02107 bAllowBinary); 02108 02109 //********** /RenderTable 02110 lpMem += WriteNewLineObject (lpMem, RenderTableTag); 02111 lpMem += WriteObject (lpMem, BeginArray); 02112 02113 lpMem += WriteInt (lpMem, PreviewCRDGrid); // Send down Na 02114 lpMem += WriteInt (lpMem, PreviewCRDGrid); // Send down Nb 02115 lpMem += WriteInt (lpMem, PreviewCRDGrid); // Send down Nc 02116 02117 lpLineStart = lpMem; 02118 lpMem += WriteNewLineObject (lpMem, BeginArray); 02119 ColorSpace = ((LPHOSTCLUT)lpDevCRD)->pcs; 02120 for (i = 0; i < PreviewCRDGrid; i++) // Na strings should be sent 02121 { 02122 lpMem += WriteObject (lpMem, NewLine); 02123 lpLineStart = lpMem; 02124 if (bAllowBinary) 02125 { 02126 lpMem += WriteStringToken (lpMem, 143, 02127 PreviewCRDGrid * PreviewCRDGrid * ((LPHOSTCLUT)lpDevCRD)->outputChan); 02128 } 02129 else 02130 { 02131 lpMem += WriteObject (lpMem, BeginString); 02132 } 02133 Input[0] = ((float)i) / (PreviewCRDGrid - 1); 02134 for (j = 0; j < PreviewCRDGrid; j++) 02135 { 02136 Input[1] = ((float)j) / (PreviewCRDGrid - 1); 02137 for (k = 0; k < PreviewCRDGrid; k++) 02138 { 02139 Input[2] = ((float)k) / (PreviewCRDGrid - 1); 02140 02141 DoHostConversionCRD ((LPHOSTCLUT)lpTargetCRD, NULL, Input, Output, ColorSpace, 1); 02142 DoHostConversionCSA ((LPHOSTCLUT)lpTargetCSA, Output, Temp); 02143 DoHostConversionCRD ((LPHOSTCLUT)lpDevCRD, (LPHOSTCLUT)lpTargetCSA, 02144 Temp, Output, 0, 0); 02145 for (l = 0; l < ((LPHOSTCLUT)lpDevCRD)->outputChan; l++) 02146 { 02147 if (bAllowBinary) 02148 { 02149 *lpMem++ = (BYTES)(Output[l]*255); 02150 } 02151 else 02152 { 02153 lpMem += WriteHex (lpMem, (USHORT)(Output[l]*255)); 02154 if (((SINT) (lpMem - lpLineStart)) > MAX_LINELENG) 02155 { 02156 lpLineStart = lpMem; 02157 lpMem += WriteObject (lpMem, NewLine); 02158 } 02159 } 02160 } 02161 } 02162 } 02163 if (!bAllowBinary) 02164 lpMem += WriteObject (lpMem, EndString); 02165 } 02166 lpMem += WriteNewLineObject (lpMem, EndArray); 02167 lpMem += WriteInt (lpMem, ((LPHOSTCLUT)lpDevCRD)->outputChan); 02168 02169 //********** Send Output Table. 02170 lpMem += SendCRDOutputTable(lpMem, PublicArrayName, 02171 ((LPHOSTCLUT)lpDevCRD)->outputChan, 02172 (((LPHOSTCLUT)lpDevCRD)->lutBits == 8)? icSigLut8Type:icSigLut16Type, 02173 TRUE, 02174 bAllowBinary); 02175 02176 02177 lpMem += WriteNewLineObject (lpMem, EndArray); 02178 lpMem += WriteObject (lpMem, EndDict); // End dictionary definition 02179 lpMem += WriteNewLineObject (lpMem, CRDEnd); 02180 Success = TRUE; 02181 02182 Done: 02183 *lpcbSize = (DWORD)(lpMem - lpOldMem); 02184 02185 if (hTargetCRD) 02186 MemFree(hTargetCRD); 02187 if (hTargetCSA) 02188 MemFree(hTargetCSA); 02189 if (hDevCRD) 02190 MemFree(hDevCRD); 02191 return (Success); 02192 }


Generated on Sat May 15 19:45:20 2004 for test by doxygen 1.3.7