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

csprof.c File Reference

#include "generic.h"

Go to the source code of this file.

Defines

#define ICMSEG
#define TempBfSize   128
#define LINELENG   128

Functions

BOOL EXTERN SetCPLastError (SINT LastError)
SINT EXTERN GetCPLastError ()
BOOL EXTERN MemAlloc (SINT Size, HGLOBAL FAR *hMemory, LPMEMPTR lpMH)
BOOL EXTERN MemFree (HGLOBAL hMem)
BOOL EXTERN LoadCP (LPCSTR filename, HGLOBAL FAR *phMem, LPCHANDLE lpCP)
BOOL EXTERN FreeCP (HGLOBAL hMem)
BOOL EXTERN GetCPElementCount (CHANDLE CP, LPSINT lpCount)
BOOL EXTERN GetCPElementInfo (CHANDLE CP, SINT Index, LPMEMPTR lpTagData, LPMEMPTR lpElemData)
BOOL EXTERN ValidateCP (CHANDLE CP)
BOOL EXTERN DoesCPTagExist (CHANDLE CP, CSIG CPTag)
BOOL EXTERN GetCPTagIndex (CHANDLE CP, CSIG CPTag, LPSINT lpIndex)
BOOL EXTERN GetCPTagSig (CHANDLE CP, SINT Index, LPCSIG lpCPTag)
BOOL EXTERN GetCPElementType (CHANDLE CP, SINT Index, LPCSIG lpCSig)
BOOL EXTERN GetCPElementSize (CHANDLE CP, SINT Index, LPSINT lpSize)
BOOL EXTERN GetCPElementDataSize (CHANDLE CP, SINT Index, LPSINT lpSize)
BOOL EXTERN GetCPElement (CHANDLE CP, SINT Index, MEMPTR lpData, SINT Size)
BOOL EXTERN GetCPElementData (CHANDLE CP, SINT Index, MEMPTR lpData, SINT Size)
BOOL EXTERN GetCPElementDataType (CHANDLE CP, SINT Index, long far *lpDataType)
BOOL EXTERN ValidateCPElement (CHANDLE CP, SINT Index)
BOOL EXTERN GetCPSize (CHANDLE CP, LPSINT lpSize)
BOOL EXTERN GetCPCMMType (CHANDLE CP, LPCSIG lpType)
BOOL EXTERN GetCPVersion (CHANDLE CP, LPSINT lpVers)
BOOL EXTERN GetCPClass (CHANDLE CP, LPCSIG lpClass)
BOOL EXTERN GetCPDevSpace (CHANDLE CP, LPCSIG lpInSpace)
BOOL EXTERN GetCPConnSpace (CHANDLE CP, LPCSIG lpOutSpace)
BOOL EXTERN GetCPTarget (CHANDLE CP, LPCSIG lpTarget)
BOOL EXTERN GetCPManufacturer (CHANDLE CP, LPCSIG lpManuf)
BOOL EXTERN GetCPModel (CHANDLE CP, LPCSIG lpModel)
BOOL EXTERN GetCPFlags (CHANDLE CP, LPSINT lpFlags)
BOOL EXTERN GetCPRenderIntent (CHANDLE CP, LPSINT lpIntent)
BOOL EXTERN GetCPWhitePoint (CHANDLE CP, LPSFLOAT lpWP)
BOOL EXTERN GetCPAttributes (CHANDLE CP, LPATTRIB lpAttributes)
BOOL EXTERN GetCPMediaWhitePoint (CHANDLE cp, LPSFLOAT lpMediaWP)
BOOL EXTERN GetPS2ColorRenderingIntent (CHANDLE cp, DWORD Intent, MEMPTR lpMem, LPDWORD lpcbSize)
BOOL EXTERN ValidColorSpace (LPPDEVICE lppd, LPICMINFO lpICMI, LPCSIG lpDevCS)
SINT WriteHexBuffer (MEMPTR lpMem, MEMPTR lpBuff, MEMPTR lpLineStart, DWORD dwBytes)
SINT WriteNewLineObject (MEMPTR lpMem, MEMPTR Obj)
SINT WriteObject (MEMPTR lpMem, MEMPTR Obj)
SINT WriteObjectN (MEMPTR lpMem, MEMPTR Obj, SINT n)
SINT WriteInt (MEMPTR lpMem, SINT Number)
SINT WriteHex (MEMPTR lpMem, SINT Number)
SINT WriteFloat (MEMPTR lpMem, double dFloat)
SINT WriteStringToken (MEMPTR lpMem, BYTE Token, SINT sNum)
SINT WriteHNAToken (MEMPTR lpMem, BYTE Token, SINT sNum)
SINT WriteIntStringU2S (MEMPTR lpMem, MEMPTR lpBuff, SINT sNum)
SINT WriteIntStringU2S_L (MEMPTR lpMem, MEMPTR lpBuff, SINT sNum)
SINT WriteByteString (MEMPTR lpMem, MEMPTR lpBuff, SINT sBytes)
SINT WriteInt2ByteString (MEMPTR lpMem, MEMPTR lpBuff, SINT sBytes)
SINT WriteASCII85Cont (MEMPTR lpDest, SINT BufSize, MEMPTR lpSource, SINT DataSize)
SINT WriteAscii85 (MEMPTR lpDest, unsigned long inWord, SINT nBytes)
SINT ConvertBinaryData2Ascii (MEMPTR lpMem, SINT DataSize, SINT BufSize)
SINT Convert2Ascii (CHANDLE CP, SINT Index, MEMPTR lpData, SINT BufSize, SINT DataSize, BOOL AllowBinary)

Variables

char ICM2SEG NewLine [] = "\n"
char ICM2SEG ASCII85DecodeBegine [] = "<~"
char ICM2SEG ASCII85DecodeEnd [] = "~> cvx exec "
SINT CPLastError


Define Documentation

#define ICMSEG
 

#define LINELENG   128
 

Definition at line 7 of file jul98/dll32/csprof.c.

#define TempBfSize   128
 

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


Function Documentation

SINT Convert2Ascii CHANDLE  CP,
SINT  Index,
MEMPTR  lpData,
SINT  BufSize,
SINT  DataSize,
BOOL  AllowBinary
 

Definition at line 1485 of file jul98/dll32/csprof.c.

References AllowBinary, ASCII85DecodeBegine, ASCII85DecodeEnd, ConvertBinaryData2Ascii(), GetCPElementDataType(), Index, and SINT.

Referenced by GetCSAFromProfile(), and GetPS2ColorRenderingDictionary().

01488 { 01489 long DataType; 01490 01491 GetCPElementDataType(CP, Index, &DataType); 01492 if (BufSize == 0) 01493 { 01494 if (AllowBinary) 01495 return (DataSize); 01496 else if (DataType == 0) // Ascii data in Profile 01497 return (DataSize); 01498 else // Keep space for ascii85 encoding. 01499 return (DataSize / 4 * 5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048); 01500 } 01501 else 01502 { 01503 if (AllowBinary) 01504 return (DataSize); 01505 else if(DataType == 0) 01506 return (DataSize); 01507 else 01508 return (ConvertBinaryData2Ascii(lpData, DataSize, BufSize) ); 01509 } 01510 }

SINT ConvertBinaryData2Ascii MEMPTR  lpMem,
SINT  DataSize,
SINT  BufSize
 

Definition at line 1440 of file jul98/dll32/csprof.c.

References ASCII85DecodeBegine, ASCII85DecodeEnd, MEMPTR, NewLine, NULL, SINT, WriteASCII85Cont(), and WriteObject.

Referenced by Convert2Ascii().

01441 { 01442 MEMPTR intrbuf, Temp; 01443 HANDLE intrhandle; 01444 SINT AsciiDataSize = 0; 01445 01446 if (BufSize >= (SINT)(DataSize/4*5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048)) 01447 { 01448 if ((intrhandle = GlobalAlloc(GHND, BufSize)) != NULL) 01449 { 01450 if ((intrbuf = (MEMPTR) GlobalLock(intrhandle)) != NULL) 01451 { 01452 Temp = intrbuf; 01453 Temp += WriteObject(Temp, NewLine); 01454 Temp += WriteObject(Temp, ASCII85DecodeBegine); 01455 Temp += WriteObject(Temp, NewLine); 01456 Temp += WriteASCII85Cont(Temp, BufSize, lpMem, DataSize); 01457 Temp += WriteObject(Temp, ASCII85DecodeEnd); 01458 AsciiDataSize = (SINT)(Temp - intrbuf); 01459 lstrcpyn(lpMem, intrbuf, (WORD)AsciiDataSize); 01460 GlobalUnlock(intrhandle); 01461 } 01462 } 01463 GlobalFree(intrhandle); 01464 } 01465 return (AsciiDataSize); 01466 }

BOOL EXTERN DoesCPTagExist CHANDLE  CP,
CSIG  CPTag
 

Definition at line 403 of file jul98/dll32/csprof.c.

References BOOL, Count, EXTERN, FALSE, lpcpProfile, lpcpTag, lpcpTagList, MEMPTR, SigtoCSIG, SINT, TRUE, and ui32toSINT.

00404 { 00405 SINT Count; 00406 MEMPTR Data; 00407 lpcpTagList lpTL; 00408 00409 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00410 Count = ui32toSINT(lpTL->count); 00411 Data = (MEMPTR) &(lpTL->tags[0]) ; 00412 while ( Count-- ) 00413 { 00414 if( SigtoCSIG( ((lpcpTag)Data)->sig) == CPTag ) 00415 { 00416 return(TRUE); 00417 }else 00418 { 00419 Data += sizeof(icTag); // Bump pointer to the next tag 00420 } 00421 } 00422 return(FALSE); 00423 }

BOOL EXTERN FreeCP HGLOBAL  hMem  ) 
 

Definition at line 212 of file jul98/dll32/csprof.c.

References BOOL, EXTERN, and MemFree().

Referenced by ColorSpaceControl(), CreateCRDControl(), CreateINTENTControl(), and CreateProfCRDControl().

00213 { 00214 return( MemFree(hMem) ); 00215 }

BOOL EXTERN GetCPAttributes CHANDLE  CP,
LPATTRIB  lpAttributes
 

Definition at line 885 of file jul98/dll32/csprof.c.

References BOOL, EXTERN, LPATTRIB, and TRUE.

00886 { 00887 return(TRUE); 00888 }

BOOL EXTERN GetCPClass CHANDLE  CP,
LPCSIG  lpClass
 

Definition at line 784 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

Referenced by ValidateCP().

00785 { 00786 if (lpClass == NULL) 00787 { 00788 SetCPLastError(CP_NULL_POINTER_ERR); 00789 return(FALSE); 00790 } 00791 *lpClass = SigtoCSIG( ((lpcpHeader)CP)->deviceClass); 00792 return(TRUE); 00793 }

BOOL EXTERN GetCPCMMType CHANDLE  CP,
LPCSIG  lpType
 

Definition at line 762 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

00763 { 00764 if (lpType == NULL) 00765 { 00766 SetCPLastError(CP_NULL_POINTER_ERR); 00767 return(FALSE); 00768 } 00769 *lpType = SigtoCSIG( ((lpcpHeader)CP)->cmmId); 00770 return(TRUE); 00771 }

BOOL EXTERN GetCPConnSpace CHANDLE  CP,
LPCSIG  lpOutSpace
 

Definition at line 806 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, pcs, SetCPLastError(), SigtoCSIG, and TRUE.

00807 { 00808 if (lpOutSpace == NULL) 00809 { 00810 SetCPLastError(CP_NULL_POINTER_ERR); 00811 return(FALSE); 00812 } 00813 *lpOutSpace = SigtoCSIG( ((lpcpHeader)CP)->pcs); 00814 return(TRUE); 00815 }

BOOL EXTERN GetCPDevSpace CHANDLE  CP,
LPCSIG  lpInSpace
 

Definition at line 795 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

00796 { 00797 if (lpInSpace == NULL) 00798 { 00799 SetCPLastError(CP_NULL_POINTER_ERR); 00800 return(FALSE); 00801 } 00802 *lpInSpace = SigtoCSIG( ((lpcpHeader)CP)->colorSpace); 00803 return(TRUE); 00804 }

BOOL EXTERN GetCPElement CHANDLE  CP,
SINT  Index,
MEMPTR  lpData,
SINT  Size
 

Definition at line 557 of file jul98/dll32/csprof.c.

References BOOL, CP_NO_MEMORY_ERR, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), Index, lpcpTag, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), SINT, Size, TRUE, and ui32toSINT.

Referenced by CreateColorantArray(), CreateColSpArray(), CreateColSpProc(), CreateFloatString(), CreateHostLutCRD(), CreateLutCRD(), CreateMatrixCRD(), CreateMonoCRD(), GetCPMediaWhitePoint(), GetCRDInputOutputArraySize(), GetHostCSA(), GetPS2CSA_DEFG(), GetPS2CSA_MONO_A(), GetPS2CSA_MONO_ABC(), GetTRCData(), and IsSRGB().

00559 { 00560 SINT ElemSize; 00561 MEMPTR TagData, ElemData; 00562 if (lpData == NULL) 00563 { 00564 SetCPLastError(CP_NULL_POINTER_ERR); 00565 return(FALSE); 00566 } 00567 00568 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00569 (LPMEMPTR) &ElemData) ) 00570 { 00571 return(FALSE); 00572 } 00573 ElemSize = ui32toSINT( ((lpcpTag)TagData)->size); 00574 if(ElemSize > Size ) 00575 { 00576 SetCPLastError(CP_NO_MEMORY_ERR); 00577 return(FALSE); 00578 } 00579 MemCopy(lpData, ElemData, ElemSize); 00580 return(TRUE); 00581 00582 }

BOOL EXTERN GetCPElementCount CHANDLE  CP,
LPSINT  lpCount
 

Definition at line 218 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpProfile, lpcpTagList, LPSINT, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00219 { 00220 lpcpTagList lpTL; 00221 if (lpCount == NULL) 00222 { 00223 SetCPLastError(CP_NULL_POINTER_ERR); 00224 return(FALSE); 00225 } 00226 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00227 *lpCount = ui32toSINT(lpTL->count); 00228 return(TRUE); 00229 }

BOOL EXTERN GetCPElementData CHANDLE  CP,
SINT  Index,
MEMPTR  lpData,
SINT  Size
 

Definition at line 585 of file jul98/dll32/csprof.c.

References BOOL, CP_NO_MEMORY_ERR, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), icUInt32Number, Index, lpcpTag, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), SINT, Size, TRUE, and ui32toSINT.

00587 { 00588 SINT ElemSize; 00589 MEMPTR TagData, ElemData; 00590 if (lpData == NULL) 00591 { 00592 SetCPLastError(CP_NULL_POINTER_ERR); 00593 return(FALSE); 00594 } 00595 00596 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00597 (LPMEMPTR) &ElemData) ) 00598 { 00599 return(FALSE); 00600 } 00601 // Changed by jjia 8/24/95 00602 // ElemData += sizeof(lpcpTagBase); 00603 // ElemSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00604 // sizeof(lpcpTagBase); 00605 ElemData += sizeof(icTagBase) + sizeof(icUInt32Number); 00606 ElemSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00607 sizeof(icTagBase) - sizeof(icUInt32Number); 00608 00609 if(ElemSize > Size ) 00610 { 00611 SetCPLastError(CP_NO_MEMORY_ERR); 00612 return(FALSE); 00613 } 00614 00615 MemCopy(lpData, ElemData, ElemSize); 00616 return(TRUE); 00617 }

BOOL EXTERN GetCPElementDataSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 522 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), icUInt32Number, Index, lpcpTag, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00523 { 00524 MEMPTR TagData, ElemData; 00525 if (lpSize == NULL) 00526 { 00527 SetCPLastError(CP_NULL_POINTER_ERR); 00528 return(FALSE); 00529 } 00530 00531 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00532 (LPMEMPTR) &ElemData) ) 00533 { 00534 // Changed by jjia 8/24/95 00535 // *lpSize = ui32toSINT( ((lpcpTag)TagData)->size ) - 00536 // sizeof(lpcpTagBase); 00537 *lpSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00538 sizeof(icTagBase) - sizeof(icUInt32Number); 00539 }else 00540 { 00541 return(FALSE); 00542 } 00543 00544 return(TRUE); 00545 }

BOOL EXTERN GetCPElementDataType CHANDLE  CP,
SINT  Index,
long far *  lpDataType
 

Definition at line 621 of file jul98/dll32/csprof.c.

References __huge, BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), Index, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00622 { 00623 MEMPTR TagData, ElemData; 00624 00625 if (lpDataType == NULL) 00626 { 00627 SetCPLastError(CP_NULL_POINTER_ERR); 00628 return(FALSE); 00629 } 00630 00631 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00632 (LPMEMPTR) &ElemData) ) 00633 { 00634 return(FALSE); 00635 } 00636 ElemData += sizeof(icTagBase); 00637 *lpDataType = ui32toSINT( ((icData __huge *)ElemData)->dataFlag); 00638 return (TRUE); 00639 }

BOOL EXTERN GetCPElementInfo CHANDLE  CP,
SINT  Index,
LPMEMPTR  lpTagData,
LPMEMPTR  lpElemData
 

Definition at line 232 of file jul98/dll32/csprof.c.

References BOOL, Count, CP_NULL_POINTER_ERR, CP_OUT_OF_RANGE_ERR, EXTERN, FALSE, Index, lpcpProfile, lpcpTag, lpcpTagList, MEMPTR, NULL, SetCPLastError(), SINT, TRUE, and ui32toSINT.

Referenced by GetCPElement(), GetCPElementData(), GetCPElementDataSize(), GetCPElementDataType(), GetCPElementSize(), GetCPElementType(), and GetCPTagSig().

00234 { 00235 SINT Count; 00236 lpcpTagList lpTL; 00237 00238 if ( (lpTagData == NULL) || (lpElemData == NULL) ) 00239 { 00240 SetCPLastError(CP_NULL_POINTER_ERR); 00241 return(FALSE); 00242 } 00243 00244 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00245 Count = ui32toSINT(lpTL->count); 00246 if ( Count <= Index ) 00247 { 00248 SetCPLastError(CP_OUT_OF_RANGE_ERR); 00249 return(FALSE); 00250 } 00251 *lpTagData = ((MEMPTR) &(lpTL->tags[0])) + (Index * sizeof(icTag)) ; 00252 *lpElemData = ((MEMPTR) CP) + 00253 ui32toSINT( ((lpcpTag)*lpTagData)->offset); 00254 return(TRUE); 00255 }

BOOL EXTERN GetCPElementSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 501 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), Index, lpcpTag, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00502 { 00503 MEMPTR TagData, ElemData; 00504 if (lpSize == NULL) 00505 { 00506 SetCPLastError(CP_NULL_POINTER_ERR); 00507 return(FALSE); 00508 } 00509 00510 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00511 (LPMEMPTR) &ElemData) ) 00512 { 00513 *lpSize = ui32toSINT( ((lpcpTag)TagData)->size ); 00514 }else 00515 { 00516 return(FALSE); 00517 } 00518 00519 return(TRUE); 00520 }

BOOL EXTERN GetCPElementType CHANDLE  CP,
SINT  Index,
LPCSIG  lpCSig
 

Definition at line 485 of file jul98/dll32/csprof.c.

References BOOL, EXTERN, FALSE, GetCPElementInfo(), Index, lpcpTagBase, LPMEMPTR, MEMPTR, SigtoCSIG, and TRUE.

Referenced by CreateHostLutCRD(), CreateLutCRD(), CreateMonoCRD(), GetCRDInputOutputArraySize(), GetHostCSA(), GetPS2CSA_DEFG(), GetPS2CSA_MONO_A(), GetPS2CSA_MONO_ABC(), GetTRCElementSize(), and ValidateCPElement().

00486 { 00487 MEMPTR TagData, ElemData; 00488 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00489 (LPMEMPTR) &ElemData) ) 00490 { 00491 *lpCSig = SigtoCSIG( ((lpcpTagBase)ElemData)->sig ) ; 00492 }else 00493 { 00494 return(FALSE); 00495 } 00496 return(TRUE); 00497 }

BOOL EXTERN GetCPFlags CHANDLE  CP,
LPSINT  lpFlags
 

Definition at line 850 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00851 { 00852 if (lpFlags == NULL) 00853 { 00854 SetCPLastError(CP_NULL_POINTER_ERR); 00855 return(FALSE); 00856 } 00857 *lpFlags = ui32toSINT( ((lpcpHeader)CP)->flags); 00858 return(TRUE); 00859 }

SINT EXTERN GetCPLastError  ) 
 

Definition at line 27 of file jul98/dll32/csprof.c.

References CPLastError, EXTERN, and SINT.

00028 { 00029 return(CPLastError); 00030 }

BOOL EXTERN GetCPManufacturer CHANDLE  CP,
LPCSIG  lpManuf
 

Definition at line 828 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

00829 { 00830 if (lpManuf == NULL) 00831 { 00832 SetCPLastError(CP_NULL_POINTER_ERR); 00833 return(FALSE); 00834 } 00835 *lpManuf = SigtoCSIG( ((lpcpHeader)CP)->manufacturer); 00836 return(TRUE); 00837 }

BOOL EXTERN GetCPMediaWhitePoint CHANDLE  cp,
LPSFLOAT  lpMediaWP
 

Definition at line 890 of file jul98/dll32/csprof.c.

References BOOL, DoesCPTagExist(), EXTERN, FALSE, GetCPElement(), GetCPElementSize(), GetCPTagIndex(), icS15Fixed16Number, icSigMediaWhitePointTag, Index, lpcpXYZType, LPMEMPTR, LPSINT, MemAlloc(), MemFree(), MEMPTR, SFLOAT, si16f16toSFLOAT, SINT, and TRUE.

00891 { 00892 HGLOBAL hTempMem; 00893 SINT TempSize; 00894 MEMPTR TempBuff; 00895 MEMPTR lpTable; 00896 SINT i, Index; 00897 00898 if (DoesCPTagExist (cp, icSigMediaWhitePointTag) && 00899 GetCPTagIndex (cp, icSigMediaWhitePointTag, (LPSINT) & Index) && 00900 GetCPElementSize (cp, Index, (LPSINT) & TempSize) && 00901 MemAlloc (TempSize, (HGLOBAL *) & hTempMem, (LPMEMPTR) & TempBuff) && 00902 GetCPElement (cp, Index, TempBuff, TempSize)) 00903 { 00904 lpTable = (MEMPTR) & (((lpcpXYZType) TempBuff)->data); 00905 for (i = 0; i < 3; i++) 00906 { 00907 lpMediaWP[i] = (SFLOAT) si16f16toSFLOAT (lpTable); 00908 lpTable += sizeof (icS15Fixed16Number); 00909 } 00910 MemFree (hTempMem); 00911 return (TRUE); 00912 } 00913 return (FALSE); 00914 }

BOOL EXTERN GetCPModel CHANDLE  CP,
LPCSIG  lpModel
 

Definition at line 839 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

00840 { 00841 if (lpModel == NULL) 00842 { 00843 SetCPLastError(CP_NULL_POINTER_ERR); 00844 return(FALSE); 00845 } 00846 *lpModel = SigtoCSIG( ((lpcpHeader)CP)->model); 00847 return(TRUE); 00848 }

BOOL EXTERN GetCPRenderIntent CHANDLE  CP,
LPSINT  lpIntent
 

Definition at line 861 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00862 { 00863 if (lpIntent == NULL) 00864 { 00865 SetCPLastError(CP_NULL_POINTER_ERR); 00866 return(FALSE); 00867 } 00868 *lpIntent = ui32toSINT( ((lpcpHeader)CP)->renderingIntent); 00869 return(TRUE); 00870 }

BOOL EXTERN GetCPSize CHANDLE  CP,
LPSINT  lpSize
 

Definition at line 751 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00752 { 00753 if (lpSize == NULL) 00754 { 00755 SetCPLastError(CP_NULL_POINTER_ERR); 00756 return(FALSE); 00757 } 00758 *lpSize = ui32toSINT( ((lpcpHeader)CP)->size); 00759 return(TRUE); 00760 }

BOOL EXTERN GetCPTagIndex CHANDLE  CP,
CSIG  CPTag,
LPSINT  lpIndex
 

Definition at line 426 of file jul98/dll32/csprof.c.

References BOOL, Count, CP_NOT_FOUND_ERR, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpProfile, lpcpTag, lpcpTagList, MEMPTR, NULL, SetCPLastError(), SigtoCSIG, SINT, TRUE, and ui32toSINT.

Referenced by CreateColorantArray(), CreateColSpArray(), CreateColSpProc(), CreateFloatString(), GetCPMediaWhitePoint(), GetCRDInputOutputArraySize(), GetCSAFromProfile(), GetHostColorRenderingDictionary(), GetHostCSA_Intent(), GetPS2ColorRenderingDictionary(), GetPS2ColorRenderingIntent(), GetPS2CSA_DEFG_Intent(), GetPS2CSA_MONO_A(), GetPS2CSA_MONO_ABC(), GetTRCElementSize(), and IsSRGB().

00427 { 00428 SINT Count; 00429 MEMPTR Data; 00430 SINT i; 00431 lpcpTagList lpTL; 00432 00433 if (lpIndex == NULL) 00434 { 00435 SetCPLastError(CP_NULL_POINTER_ERR); 00436 return(FALSE); 00437 } 00438 00439 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00440 Count = ui32toSINT(lpTL->count); 00441 Data = (MEMPTR) &(lpTL->tags[0]) ; 00442 00443 for (i = 0; i < Count; i++ ) 00444 { 00445 if( SigtoCSIG( ((lpcpTag)Data)->sig) == CPTag ) 00446 { 00447 *lpIndex = i; 00448 return(TRUE); 00449 }else 00450 { 00451 Data += sizeof(icTag); // Bump pointer to the next tag 00452 } 00453 } 00454 00455 SetCPLastError(CP_NOT_FOUND_ERR); 00456 return(FALSE); 00457 }

BOOL EXTERN GetCPTagSig CHANDLE  CP,
SINT  Index,
LPCSIG  lpCPTag
 

Definition at line 461 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, GetCPElementInfo(), Index, lpcpTag, LPMEMPTR, MEMPTR, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

Referenced by CreateHostLutCRD(), CreateLutCRD(), GetHostCSA(), GetPS2CSA_DEFG(), and ValidateCPElement().

00462 { 00463 MEMPTR TagData, ElemData; 00464 if (lpCPTag == NULL) 00465 { 00466 SetCPLastError(CP_NULL_POINTER_ERR); 00467 return(FALSE); 00468 } 00469 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00470 (LPMEMPTR) &ElemData) ) 00471 { 00472 *lpCPTag = SigtoCSIG( ((lpcpTag)TagData)->sig ) ; 00473 }else 00474 { 00475 return(FALSE); 00476 } 00477 return(TRUE); 00478 }

BOOL EXTERN GetCPTarget CHANDLE  CP,
LPCSIG  lpTarget
 

Definition at line 817 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SigtoCSIG, and TRUE.

00818 { 00819 if (lpTarget == NULL) 00820 { 00821 SetCPLastError(CP_NULL_POINTER_ERR); 00822 return(FALSE); 00823 } 00824 *lpTarget = SigtoCSIG( ((lpcpHeader)CP)->platform); 00825 return(TRUE); 00826 }

BOOL EXTERN GetCPVersion CHANDLE  CP,
LPSINT  lpVers
 

Definition at line 773 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), TRUE, and ui32toSINT.

00774 { 00775 if (lpVers == NULL) 00776 { 00777 SetCPLastError(CP_NULL_POINTER_ERR); 00778 return(FALSE); 00779 } 00780 *lpVers = ui32toSINT( ((lpcpHeader)CP)->version); 00781 return(TRUE); 00782 }

BOOL EXTERN GetCPWhitePoint CHANDLE  CP,
LPSFLOAT  lpWP
 

Definition at line 872 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, lpcpHeader, NULL, SetCPLastError(), SFLOAT, si16f16toSFLOAT, and TRUE.

00873 { 00874 if (lpWP == NULL) 00875 { 00876 SetCPLastError(CP_NULL_POINTER_ERR); 00877 return(FALSE); 00878 } 00879 lpWP[0] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.X); 00880 lpWP[1] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.Y); 00881 lpWP[2] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.Z); 00882 return(TRUE); 00883 }

BOOL EXTERN GetPS2ColorRenderingIntent CHANDLE  cp,
DWORD  Intent,
MEMPTR  lpMem,
LPDWORD  lpcbSize
 

Definition at line 938 of file jul98/dll32/csprof.c.

References BOOL, DoesCPTagExist(), DWORD, EXTERN, FALSE, GetCPElementData(), GetCPElementDataSize(), GetCPTagIndex(), icAbsoluteColorimetric, icPerceptual, icRelativeColorimetric, icSaturation, icSigPs2Intent0Tag, icSigPs2Intent1Tag, icSigPs2Intent2Tag, icSigPs2Intent3Tag, Index, Intent, LPSINT, NULL, SINT, Size, and TRUE.

00940 { 00941 SINT Index; 00942 SINT Size; 00943 00944 if (!cp) 00945 return FALSE; 00946 00947 Size = (SINT) *lpcbSize; 00948 if( ( lpMem == NULL ) || ( Size == 0 ) ) 00949 { 00950 lpMem = NULL; 00951 Size = 0; 00952 *lpcbSize = 0; 00953 } 00954 00955 switch(Intent) 00956 { 00957 case icPerceptual: 00958 if( DoesCPTagExist(cp, icSigPs2Intent0Tag) && 00959 GetCPTagIndex(cp, icSigPs2Intent0Tag, (LPSINT) &Index) && 00960 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00961 ( ( lpMem == NULL ) || 00962 GetCPElementData(cp, Index, lpMem, Size) ) ) 00963 { 00964 } 00965 break; 00966 00967 case icRelativeColorimetric: 00968 if( DoesCPTagExist(cp, icSigPs2Intent1Tag) && 00969 GetCPTagIndex(cp, icSigPs2Intent1Tag, (LPSINT) &Index) && 00970 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00971 ( ( lpMem == NULL ) || 00972 GetCPElementData(cp, Index, lpMem, Size) ) ) 00973 { 00974 } 00975 break; 00976 00977 case icSaturation: 00978 if( DoesCPTagExist(cp, icSigPs2Intent2Tag) && 00979 GetCPTagIndex(cp, icSigPs2Intent2Tag, (LPSINT) &Index) && 00980 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00981 ( ( lpMem == NULL ) || 00982 GetCPElementData(cp, Index, lpMem, Size ) ) 00983 ) 00984 { 00985 } 00986 break; 00987 case icAbsoluteColorimetric: 00988 if( DoesCPTagExist(cp, icSigPs2Intent3Tag) && 00989 GetCPTagIndex(cp, icSigPs2Intent3Tag, (LPSINT) &Index) && 00990 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00991 ( ( lpMem == NULL ) || 00992 GetCPElementData(cp, Index, lpMem, Size) ) ) 00993 { 00994 } 00995 break; 00996 default: 00997 Size = 0 ; 00998 break; 00999 } 01000 01001 if (Size != 0) 01002 { 01003 if (lpMem) 01004 { 01005 lpMem[Size] = '\0'; 01006 } 01007 Size ++; 01008 *lpcbSize = (DWORD) Size; 01009 return (TRUE); 01010 } 01011 else 01012 { 01013 return(FALSE); 01014 } 01015 }

BOOL EXTERN LoadCP LPCSTR  filename,
HGLOBAL FAR *  phMem,
LPCHANDLE  lpCP
 

Definition at line 80 of file jul98/dll32/csprof.c.

References BOOL, CHANDLE, CP_FILE_OPEN_ERR, CP_FILE_READ_ERR, CP_FORMAT_ERR, CP_NULL_POINTER_ERR, EXTERN, FALSE, icMagicNumber, L, LPMEMPTR, LPVOID, MemAlloc(), MEMPTR, NULL, SetCPLastError(), SigtoCSIG, SINT, TRUE, and ui32toSINT.

00081 { 00082 icHeader CPHeader; 00083 HFILE hFile; 00084 SINT Res, CPSize; 00085 MEMPTR mpCP; 00086 00087 *phMem = 0; 00088 if (lpCP == NULL) 00089 { 00090 SetCPLastError(CP_NULL_POINTER_ERR); 00091 return(FALSE); 00092 } 00093 00094 hFile = _lopen(filename, READ ); 00095 if( hFile == HFILE_ERROR ) 00096 { 00097 SetCPLastError(CP_FILE_OPEN_ERR); 00098 return(FALSE); 00099 } 00100 00101 Res = _lread(hFile, (LPVOID) &CPHeader, sizeof(CPHeader)); 00102 if( (Res == HFILE_ERROR) || 00103 (Res != sizeof(CPHeader)) ) 00104 { 00105 _lclose(hFile); 00106 SetCPLastError(CP_FILE_READ_ERR); 00107 return(FALSE); 00108 } 00109 00110 // Make the initial check for validity of the profile 00111 if( SigtoCSIG(CPHeader.magic) != icMagicNumber ) 00112 { 00113 _lclose(hFile); 00114 SetCPLastError(CP_FORMAT_ERR); 00115 return(FALSE); 00116 } 00117 00118 CPSize = ui32toSINT(CPHeader.size); 00119 if( MemAlloc(CPSize, phMem, (LPMEMPTR) &mpCP) ) 00120 { 00121 00122 *lpCP = (CHANDLE) mpCP; // Put the memory pointer as handle 00123 // Read profile into memory 00124 _lseek(hFile, 0L, SEEK_SET); 00125 00126 while(CPSize) 00127 { 00128 Res = _lread(hFile, (LPVOID) mpCP, 4096); 00129 if (Res == HFILE_ERROR) 00130 { 00131 _lclose(hFile); 00132 SetCPLastError(CP_FILE_READ_ERR); 00133 return(FALSE); 00134 } 00135 mpCP += Res; 00136 CPSize -= Res; 00137 } 00138 }else 00139 { 00140 *phMem = 0; 00141 _lclose(hFile); 00142 return(FALSE); 00143 } 00144 _lclose(hFile); 00145 return (TRUE); 00146 }

BOOL EXTERN MemAlloc SINT  Size,
HGLOBAL FAR *  hMemory,
LPMEMPTR  lpMH
 

Definition at line 32 of file jul98/dll32/csprof.c.

References BOOL, CP_MEMORY_ALLOC_ERR, CP_NULL_POINTER_ERR, EXTERN, FALSE, LPVOID, MEMPTR, NULL, SetCPLastError(), Size, and TRUE.

00033 { 00034 HGLOBAL hMem; 00035 LPVOID lpMem; 00036 00037 *hMemory = 0; 00038 if(lpMH == NULL ) 00039 { 00040 SetCPLastError(CP_NULL_POINTER_ERR); 00041 return(FALSE); 00042 } 00043 00044 hMem = GlobalAlloc(GHND, Size) ; 00045 if(hMem == 0 ) 00046 { 00047 SetCPLastError(CP_MEMORY_ALLOC_ERR); 00048 return(FALSE); 00049 } 00050 00051 lpMem = GlobalLock(hMem); 00052 if(lpMem == NULL ) 00053 { 00054 GlobalFree(hMem); 00055 SetCPLastError(CP_MEMORY_ALLOC_ERR); 00056 return(FALSE); 00057 } 00058 *lpMH = (MEMPTR)lpMem ; 00059 *hMemory = hMem; 00060 return (TRUE); 00061 }

BOOL EXTERN MemFree HGLOBAL  hMem  ) 
 

Definition at line 63 of file jul98/dll32/csprof.c.

References BOOL, CP_NULL_POINTER_ERR, EXTERN, FALSE, NULL, SetCPLastError(), and TRUE.

00064 { 00065 if(hMem == NULL ) 00066 { 00067 SetCPLastError(CP_NULL_POINTER_ERR); 00068 return(FALSE); 00069 } 00070 00071 GlobalUnlock(hMem); 00072 GlobalFree(hMem) ; 00073 return(TRUE); 00074 }

BOOL EXTERN SetCPLastError SINT  LastError  ) 
 

Definition at line 21 of file jul98/dll32/csprof.c.

References BOOL, CPLastError, EXTERN, and TRUE.

Referenced by CreateHostLutCRD(), CreateLutCRD(), GetCPClass(), GetCPCMMType(), GetCPConnSpace(), GetCPDevSpace(), GetCPElement(), GetCPElementCount(), GetCPElementData(), GetCPElementDataSize(), GetCPElementDataType(), GetCPElementInfo(), GetCPElementSize(), GetCPFlags(), GetCPManufacturer(), GetCPModel(), GetCPRenderIntent(), GetCPSize(), GetCPTagIndex(), GetCPTagSig(), GetCPTarget(), GetCPVersion(), GetCPWhitePoint(), GetHostCSA(), GetPS2CSA_DEFG(), LoadCP(), MemAlloc(), MemFree(), and ValidateCP().

00022 { 00023 CPLastError = LastError; 00024 return(TRUE); 00025 }

BOOL EXTERN ValidateCP CHANDLE  CP  ) 
 

Definition at line 260 of file jul98/dll32/csprof.c.

References BOOL, CP_NOT_FOUND_ERR, CSIG, DoesCPTagExist(), EXTERN, FALSE, GetCPClass(), icSigAbstractClass, icSigAToB0Tag, icSigAToB1Tag, icSigAToB2Tag, icSigBlueColorantTag, icSigBlueTRCTag, icSigBToA0Tag, icSigBToA1Tag, icSigBToA2Tag, icSigColorSpaceClass, icSigCopyrightTag, icSigDisplayClass, icSigGamutTag, icSigGrayTRCTag, icSigGreenColorantTag, icSigGreenTRCTag, icSigInputClass, icSigLinkClass, icSigMediaWhitePointTag, icSigOutputClass, icSigProfileDescriptionTag, icSigProfileSequenceDescTag, icSigRedColorantTag, icSigRedTRCTag, LPCSIG, SetCPLastError(), and TRUE.

00261 { 00262 BOOL Result; 00263 CSIG ProfileClass; 00264 00265 if(GetCPClass(CP, (LPCSIG) &ProfileClass) ) 00266 { 00267 // All profiles must have a ProfileDescription and 00268 // a Copyright tags. 00269 00270 if( !DoesCPTagExist(CP, icSigProfileDescriptionTag) || 00271 !DoesCPTagExist(CP, icSigCopyrightTag ) ) 00272 { 00273 SetCPLastError(CP_NOT_FOUND_ERR); 00274 return(FALSE); 00275 } 00276 00277 // All profiles, except Device-link, must have a mediaWhitePoint Tag 00278 switch( ProfileClass ) 00279 { 00280 case icSigLinkClass : /* 'link' */ 00281 if( DoesCPTagExist(CP, icSigAToB0Tag) && 00282 DoesCPTagExist(CP, icSigProfileSequenceDescTag) 00283 ) 00284 { 00285 Result = TRUE; 00286 }else 00287 { 00288 Result = FALSE; 00289 } 00290 break; 00291 00292 case icSigInputClass: /* 'scnr' */ 00293 if( DoesCPTagExist(CP, icSigGrayTRCTag) || 00294 DoesCPTagExist(CP, icSigAToB0Tag) ) 00295 { 00296 Result = TRUE; 00297 }else if( DoesCPTagExist(CP, icSigGreenColorantTag) ) 00298 { 00299 if( DoesCPTagExist(CP, icSigRedColorantTag) && 00300 DoesCPTagExist(CP, icSigBlueColorantTag) && 00301 DoesCPTagExist(CP, icSigRedTRCTag) && 00302 DoesCPTagExist(CP, icSigGreenTRCTag) && 00303 DoesCPTagExist(CP, icSigBlueTRCTag) 00304 ) 00305 { 00306 Result = TRUE; 00307 }else 00308 { 00309 Result = FALSE; 00310 } 00311 }else 00312 { 00313 Result = FALSE; 00314 } 00315 Result &= DoesCPTagExist(CP, icSigMediaWhitePointTag); 00316 break; 00317 00318 case icSigDisplayClass: /* 'mntr' */ 00319 if( DoesCPTagExist(CP, icSigGrayTRCTag) ) 00320 { 00321 Result = TRUE; 00322 }else if( DoesCPTagExist(CP, icSigGreenColorantTag) ) 00323 { 00324 if( DoesCPTagExist(CP, icSigRedColorantTag) && 00325 DoesCPTagExist(CP, icSigBlueColorantTag) && 00326 DoesCPTagExist(CP, icSigRedTRCTag) && 00327 DoesCPTagExist(CP, icSigGreenTRCTag) && 00328 DoesCPTagExist(CP, icSigBlueTRCTag) 00329 ) 00330 { 00331 Result = TRUE; 00332 }else 00333 { 00334 Result = FALSE; 00335 } 00336 }else 00337 { 00338 Result = FALSE; 00339 } 00340 Result &= DoesCPTagExist(CP, icSigMediaWhitePointTag); 00341 break; 00342 00343 case icSigOutputClass: /* 'prtr' */ 00344 if( DoesCPTagExist(CP, icSigGrayTRCTag) ) 00345 { 00346 Result = TRUE; 00347 }else if( DoesCPTagExist(CP, icSigAToB0Tag) && 00348 DoesCPTagExist(CP, icSigAToB1Tag) && 00349 DoesCPTagExist(CP, icSigAToB2Tag) && 00350 DoesCPTagExist(CP, icSigBToA0Tag) && 00351 DoesCPTagExist(CP, icSigBToA1Tag) && 00352 DoesCPTagExist(CP, icSigBToA2Tag) && 00353 DoesCPTagExist(CP, icSigGamutTag) 00354 ) 00355 { 00356 Result = TRUE; 00357 }else 00358 { 00359 Result = FALSE; 00360 } 00361 Result &= DoesCPTagExist(CP, icSigMediaWhitePointTag); 00362 break; 00363 00364 case icSigAbstractClass: /* 'abst' */ 00365 if( DoesCPTagExist(CP, icSigAToB0Tag) ) 00366 { 00367 Result = TRUE; 00368 }else 00369 { 00370 Result = FALSE; 00371 } 00372 Result &= DoesCPTagExist(CP, icSigMediaWhitePointTag); 00373 break; 00374 00375 case icSigColorSpaceClass: /* 'spac' */ 00376 if( DoesCPTagExist(CP, icSigAToB0Tag) && 00377 DoesCPTagExist(CP, icSigBToA0Tag) 00378 ) 00379 { 00380 Result = TRUE; 00381 }else 00382 { 00383 Result = FALSE; 00384 } 00385 Result &= DoesCPTagExist(CP, icSigMediaWhitePointTag); 00386 break; 00387 00388 default: 00389 Result = FALSE; 00390 break; 00391 } 00392 }else 00393 { 00394 return(FALSE); 00395 } 00396 if( Result == FALSE ) 00397 { 00398 SetCPLastError(CP_NOT_FOUND_ERR); 00399 } 00400 return(Result); 00401 }

BOOL EXTERN ValidateCPElement CHANDLE  CP,
SINT  Index
 

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

References BOOL, CSIG, EXTERN, FALSE, GetCPElementType(), GetCPTagSig(), icSigAToB0Tag, icSigAToB1Tag, icSigAToB2Tag, icSigBlueColorantTag, icSigBlueTRCTag, icSigBToA0Tag, icSigBToA1Tag, icSigBToA2Tag, icSigCalibrationDateTimeTag, icSigCharTargetTag, icSigCopyrightTag, icSigCurveType, icSigDataType, icSigDateTimeType, icSigDeviceMfgDescTag, icSigDeviceModelDescTag, icSigGamutTag, icSigGrayTRCTag, icSigGreenColorantTag, icSigGreenTRCTag, icSigLuminanceTag, icSigLut16Type, icSigLut8Type, icSigMeasurementTag, icSigMediaBlackPointTag, icSigMediaWhitePointTag, icSigNamedColorTag, icSigPreview0Tag, icSigPreview1Tag, icSigPreview2Tag, icSigProfileDescriptionTag, icSigProfileSequenceDescTag, icSigPs2CRD0Tag, icSigPs2CRD1Tag, icSigPs2CRD2Tag, icSigPs2CRD3Tag, icSigPs2CSATag, icSigPs2Intent0Tag, icSigPs2Intent1Tag, icSigPs2Intent2Tag, icSigPs2Intent3Tag, icSigRedColorantTag, icSigRedTRCTag, icSigScreeningDescTag, icSigScreeningTag, icSigSignatureType, icSigTechnologyTag, icSigTextDescriptionType, icSigTextType, icSigUcrBgTag, icSigViewingCondDescTag, icSigViewingConditionsTag, icSigXYZType, Index, LPCSIG, and TRUE.

00642 { 00643 CSIG TagSig, DataSig; 00644 BOOL Result; 00645 if( GetCPTagSig(CP, Index, (LPCSIG) &TagSig) && 00646 GetCPElementType(CP, Index, (LPCSIG) &DataSig) ) 00647 { 00648 switch(TagSig) 00649 { 00650 case icSigAToB0Tag: 00651 case icSigAToB1Tag: 00652 case icSigAToB2Tag: 00653 case icSigBToA0Tag: 00654 case icSigBToA1Tag: 00655 case icSigBToA2Tag: 00656 case icSigGamutTag: 00657 case icSigPreview0Tag: 00658 case icSigPreview1Tag: 00659 case icSigPreview2Tag: 00660 Result = (DataSig == icSigLut16Type) || 00661 (DataSig == icSigLut8Type) ; 00662 break; 00663 00664 case icSigRedColorantTag: 00665 case icSigGreenColorantTag: 00666 case icSigBlueColorantTag: 00667 case icSigLuminanceTag: 00668 case icSigMediaBlackPointTag: 00669 case icSigMediaWhitePointTag: 00670 Result = (DataSig == icSigXYZType); 00671 break; 00672 00673 case icSigRedTRCTag: 00674 case icSigGreenTRCTag: 00675 case icSigBlueTRCTag: 00676 case icSigGrayTRCTag: 00677 Result = (DataSig == icSigCurveType); 00678 break; 00679 00680 case icSigPs2CRD0Tag: 00681 case icSigPs2CRD1Tag: 00682 case icSigPs2CRD2Tag: 00683 case icSigPs2CRD3Tag: 00684 case icSigPs2CSATag: 00685 case icSigPs2Intent0Tag: 00686 case icSigPs2Intent1Tag: 00687 case icSigPs2Intent2Tag: 00688 case icSigPs2Intent3Tag: 00689 Result = (DataSig == icSigDataType); 00690 break; 00691 00692 case icSigCharTargetTag: 00693 case icSigCopyrightTag: 00694 Result = (DataSig == icSigTextType); 00695 break; 00696 00697 case icSigCalibrationDateTimeTag: 00698 Result = (DataSig == icSigDateTimeType); 00699 break; 00700 00701 case icSigDeviceMfgDescTag: 00702 case icSigDeviceModelDescTag: 00703 case icSigProfileDescriptionTag: 00704 case icSigScreeningDescTag: 00705 case icSigViewingCondDescTag: 00706 Result = (DataSig == icSigTextDescriptionType); 00707 break; 00708 00709 case icSigMeasurementTag: 00710 Result = (DataSig == icSigMeasurementTag); 00711 break; 00712 00713 case icSigNamedColorTag: 00714 Result = (DataSig == icSigNamedColorTag); 00715 break; 00716 00717 case icSigProfileSequenceDescTag: 00718 Result = (DataSig == icSigProfileSequenceDescTag); 00719 break; 00720 00721 case icSigScreeningTag: 00722 Result = (DataSig == icSigScreeningTag); 00723 break; 00724 00725 case icSigTechnologyTag: 00726 Result = (DataSig == icSigSignatureType); 00727 break; 00728 00729 case icSigUcrBgTag: 00730 Result = (DataSig == icSigUcrBgTag); 00731 break; 00732 00733 case icSigViewingConditionsTag: 00734 Result = (DataSig == icSigViewingConditionsTag); 00735 break; 00736 00737 default: 00738 Result = TRUE; 00739 break; 00740 } 00741 }else 00742 { 00743 Result = FALSE; 00744 } 00745 return(Result); 00746 }

BOOL EXTERN ValidColorSpace LPPDEVICE  lppd,
LPICMINFO  lpICMI,
LPCSIG  lpDevCS
 

Definition at line 1029 of file jul98/dll32/csprof.c.

References BOOL, CSIG, EXTERN, FALSE, icMagicNumber, icSigCmyData, tagICMINFO::lcsDestFilename, LPICMINFO, LPVOID, NULL, SigtoCSIG, SINT, and TRUE.

01030 { 01031 icHeader CPHeader; 01032 HFILE hFile; 01033 SINT Res; 01034 CSIG CPColorSpaceTag; 01035 01036 if (NULL == lpICMI) 01037 { 01038 return(FALSE); 01039 } 01040 hFile = _lopen(lpICMI->lcsDestFilename, READ); 01041 if( hFile == HFILE_ERROR ) 01042 { 01043 return(FALSE); 01044 } 01045 01046 Res = _lread(hFile, (LPVOID) &CPHeader, sizeof(CPHeader)); 01047 _lclose(hFile); 01048 if( (Res == HFILE_ERROR) || (Res != sizeof(CPHeader)) ) 01049 { 01050 return(FALSE); 01051 } 01052 01053 // Make the initial check for validity of the profile 01054 if( SigtoCSIG(CPHeader.magic) != icMagicNumber ) 01055 { 01056 return(FALSE); 01057 } 01058 // Make sure the profile is 'prtr' 01059 // SRGB98 01060 // if( SigtoCSIG(CPHeader.deviceClass) != icSigOutputClass ) 01061 // { 01062 // return(FALSE); 01063 // } 01064 CPColorSpaceTag = SigtoCSIG(CPHeader.colorSpace); 01065 *lpDevCS = CPColorSpaceTag; // 247974 01066 01067 switch ( lppd->lpPSExtDevmode->dm.iColorMatchingMethod ) 01068 { 01069 case COLOR_MATCHING_ON_HOST: 01070 if ((CPColorSpaceTag == icSigCmyData)) 01071 // (CPColorSpaceTag == icSigRgbData)) 01072 // (CPColorSpaceTag == icSigGrayData)) 01073 { 01074 return(FALSE); 01075 } 01076 break; 01077 case COLOR_MATCHING_ON_PRINTER: 01078 if ((CPColorSpaceTag == icSigCmyData)) 01079 // (CPColorSpaceTag == icSigGrayData)) 01080 { 01081 return(FALSE); 01082 } 01083 break; 01084 case COLOR_MATCHING_PRINTER_CALIBRATION: 01085 default: 01086 break; 01087 } 01088 return (TRUE); 01089 }

SINT WriteAscii85 MEMPTR  lpDest,
unsigned long  inWord,
SINT  nBytes
 

Definition at line 1400 of file jul98/dll32/csprof.c.

References BYTE, lpDest, MEMPTR, and SINT.

Referenced by WriteASCII85Cont().

01401 { 01402 unsigned long divisor; 01403 int bcount; 01404 BYTE outchar; 01405 MEMPTR lpSave = lpDest; 01406 01407 if ((inWord == 0UL) && (nBytes == 5)) 01408 *lpDest++ = 'z'; 01409 else 01410 { 01411 divisor = 52200625UL; 01412 for (bcount = 0; bcount < nBytes; bcount ++) 01413 { 01414 outchar = (BYTE)((int)(inWord/divisor) + (int)'!'); 01415 *lpDest++ = outchar; 01416 if (bcount < 4) 01417 { 01418 inWord = (inWord % divisor); 01419 divisor =(divisor / 85); 01420 } 01421 } 01422 } 01423 return (SINT)(lpDest - lpSave); 01424 }

SINT WriteASCII85Cont MEMPTR  lpDest,
SINT  BufSize,
MEMPTR  lpSource,
SINT  DataSize
 

Definition at line 1339 of file jul98/dll32/csprof.c.

References BYTE, LINELENG, lpDest, lpSource, MEMPTR, NewLine, SINT, WriteAscii85(), and WriteObject.

Referenced by Ascii85Encode(), and ConvertBinaryData2Ascii().

01340 { 01341 SINT incount; 01342 MEMPTR lpPtr, lpSave; 01343 SINT rem; 01344 SINT bcount; 01345 SINT dex; 01346 unsigned long word; 01347 01348 /* encode the initial 4-tuples */ 01349 lpSave = lpDest; 01350 lpPtr = lpSource; 01351 word = 0UL; 01352 bcount = 0; 01353 01354 for (incount = 0; incount < DataSize; incount ++) 01355 { 01356 if ( incount && ((incount % LINELENG) == 0) ) 01357 lpDest += WriteObject(lpDest, NewLine); 01358 word = (word<<8); 01359 word |= (BYTE)*lpPtr++; 01360 if (bcount == 3) 01361 { 01362 lpDest += WriteAscii85(lpDest, word, 5); 01363 word = 0UL; 01364 bcount = 0; 01365 } 01366 else 01367 { 01368 bcount ++; 01369 } 01370 } 01371 01372 /* now do the last partial 4-tuple -- if there is one */ 01373 /* see the Red Book spec for the rules on how this is done */ 01374 if (bcount > 0) 01375 { 01376 rem = 4 - bcount; /* count the remaining bytes */ 01377 for (dex = 0; dex < rem; dex ++) /* shift left for each of them */ 01378 { 01379 word = (word<<8); /* (equivalent to adding in ZERO's)*/ 01380 word |= (BYTE)32; 01381 } 01382 // lpDest += WriteAscii85(lpDest, word, (bcount + 1)); /* output only meaningful 01383 lpDest += WriteAscii85(lpDest, word, 5); /* output only meaningful bytes + 1 */ 01384 } 01385 return (lpDest - lpSave); 01386 }

SINT WriteByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

Definition at line 1299 of file jul98/dll32/csprof.c.

References SINT.

01300 { 01301 SINT i; 01302 01303 for (i = 0; i < sBytes; i ++) 01304 *lpMem++ = *lpBuff++; 01305 01306 return(sBytes); 01307 }

SINT WriteFloat MEMPTR  lpMem,
double  dFloat
 

Definition at line 1193 of file jul98/dll32/csprof.c.

References DWORD, SINT, and TempBfSize.

Referenced by CreateFloatString(), CreateMatrixCRD(), GetPS2CSA_ABC(), GetPS2CSA_ABC_LAB(), GetPS2CSA_DEFG(), GetPS2CSA_MONO_A(), GetPS2CSA_MONO_ABC(), SendCRDABC(), SendCRDBWPoint(), SendCRDLMN(), SendCRDPQR(), and SendCSABWPoint().

01194 { 01195 char cSign; 01196 double dInt ; 01197 double dFract ; 01198 LONG lFloat ; 01199 SINT Res; 01200 char TempArray[TempBfSize]; 01201 01202 lFloat = (LONG) floor( dFloat * 10000.0 + 0.5); 01203 01204 dFloat = lFloat / 10000.0 ; 01205 01206 dInt = floor(fabs(dFloat)); 01207 dFract = fabs(dFloat) - dInt ; 01208 01209 cSign = ' ' ; 01210 if ( dFloat < 0 ) 01211 { 01212 cSign = '-' ; 01213 } 01214 01215 Res = wsprintf( (LPSTR) TempArray, (LPSTR) "%c%d.%0.4lu ", 01216 cSign, (WORD) dInt , (DWORD) (dFract *10000.0) ); 01217 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01218 return ( Res ); 01219 }

SINT WriteHex MEMPTR  lpMem,
SINT  Number
 

Definition at line 1177 of file jul98/dll32/csprof.c.

References SINT, and TempBfSize.

01178 { 01179 SINT Res; 01180 char TempArray[TempBfSize]; 01181 01182 Res = wsprintf( TempArray, "%2.2x", (int)(Number & 0x00FF) ); 01183 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01184 return( Res ); 01185 }

SINT WriteHexBuffer MEMPTR  lpMem,
MEMPTR  lpBuff,
MEMPTR  lpLineStart,
DWORD  dwBytes
 

Definition at line 1104 of file jul98/dll32/csprof.c.

References MAX_LINELENG, MEMPTR, NewLine, SINT, TempBfSize, and WriteObject.

01105 { 01106 SINT Res; 01107 char TempArray[TempBfSize]; 01108 MEMPTR lpOldPtr = lpMem; 01109 01110 for ( ; dwBytes ; dwBytes-- ) 01111 { 01112 Res = wsprintf( (MEMPTR)TempArray, (LPSTR) "%2.2x", *lpBuff ); 01113 *lpMem++ = TempArray[0]; 01114 *lpMem++ = TempArray[1]; 01115 lpBuff++; 01116 if (((SINT)(lpMem - lpLineStart)) > MAX_LINELENG) 01117 { 01118 lpLineStart = lpMem; 01119 lpMem += WriteObject(lpMem, NewLine); 01120 } 01121 } 01122 return( (SINT)(lpMem - lpOldPtr)); 01123 }

SINT WriteHNAToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1241 of file jul98/dll32/csprof.c.

References BYTE, SINT, and Token.

01242 { 01243 *lpMem++ = Token; 01244 *lpMem++ = 32; // 16-bit fixed integer, high-order byte first 01245 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01246 *lpMem++ = (BYTE)(sNum & 0x00FF); 01247 return (4); 01248 }

SINT WriteInt MEMPTR  lpMem,
SINT  Number
 

Definition at line 1162 of file jul98/dll32/csprof.c.

References MEMPTR, SINT, and TempBfSize.

01163 { 01164 SINT Res; 01165 char TempArray[TempBfSize]; 01166 01167 Res = wsprintf( (MEMPTR)TempArray, "%lu ", Number ); 01168 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01169 return( Res ); 01170 }

SINT WriteInt2ByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

Definition at line 1314 of file jul98/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01315 { 01316 SINT i; 01317 01318 for( i = 0; i < sBytes ; i++) 01319 { 01320 *lpMem++ = (BYTE)(ui16toSINT( lpBuff)/256) ; 01321 lpBuff += sizeof(icUInt16Number); 01322 } 01323 return(sBytes); 01324 }

SINT WriteIntStringU2S MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1257 of file jul98/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01258 { 01259 SINT i; 01260 SINT Temp; 01261 01262 for (i = 0; i < sNum; i ++) 01263 { 01264 Temp = ui16toSINT( lpBuff) - 32768; 01265 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01266 *lpMem++ = (BYTE)(Temp & 0x00FF); 01267 lpBuff += sizeof(icUInt16Number); 01268 } 01269 return(sNum * 2); 01270 }

SINT WriteIntStringU2S_L MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1279 of file jul98/dll32/csprof.c.

References BYTE, icUInt16Number, PUSHORT, and SINT.

01280 { 01281 SINT i; 01282 SINT Temp; 01283 01284 for (i = 0; i < sNum; i ++) 01285 { 01286 Temp = (SINT)*((PUSHORT)lpBuff) - 32768; 01287 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01288 *lpMem++ = (BYTE)(Temp & 0x00FF); 01289 lpBuff += sizeof(icUInt16Number); 01290 } 01291 return(sNum * 2); 01292 }

SINT WriteNewLineObject MEMPTR  lpMem,
MEMPTR  Obj
 

Definition at line 1130 of file jul98/dll32/csprof.c.

References NewLine, and SINT.

01131 { 01132 SINT Res1, Res2; 01133 01134 Res1 = lstrlen(NewLine); 01135 MemCopy(lpMem, NewLine, Res1); 01136 01137 lpMem += Res1; 01138 Res2 = lstrlen(Obj); 01139 MemCopy(lpMem, Obj, Res2); 01140 return( Res1 + Res2 ); 01141 }

SINT WriteObject MEMPTR  lpMem,
MEMPTR  Obj
 

Definition at line 1143 of file jul98/dll32/csprof.c.

References SINT.

01144 { 01145 SINT Res; 01146 01147 Res = lstrlen(Obj); 01148 MemCopy(lpMem, Obj, Res); 01149 return( Res ); 01150 }

SINT WriteObjectN MEMPTR  lpMem,
MEMPTR  Obj,
SINT  n
 

Definition at line 1152 of file jul98/dll32/csprof.c.

References n, and SINT.

Referenced by CreateInputArray(), CreateOutputArray(), GetPS2CSA_DEFG(), SendCRDABC(), and SendCRDOutputTable().

01153 { 01154 MemCopy(lpMem, Obj, n); 01155 return( n ); 01156 }

SINT WriteStringToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1227 of file jul98/dll32/csprof.c.

References BYTE, SINT, and Token.

01228 { 01229 *lpMem++ = Token; 01230 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01231 *lpMem++ = (BYTE)(sNum & 0x00FF); 01232 return (3); 01233 }


Variable Documentation

char ICM2SEG ASCII85DecodeBegine[] = "<~" [static]
 

Definition at line 13 of file jul98/dll32/csprof.c.

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

char ICM2SEG ASCII85DecodeEnd[] = "~> cvx exec " [static]
 

Definition at line 14 of file jul98/dll32/csprof.c.

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

SINT CPLastError [static]
 

Definition at line 19 of file jul98/dll32/csprof.c.

Referenced by GetCPLastError(), and SetCPLastError().

char ICM2SEG NewLine[] = "\n" [static]
 

Definition at line 12 of file jul98/dll32/csprof.c.


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