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)
SINT WriteHexBuffer (MEMPTR lpMem, MEMPTR lpBuff, MEMPTR lpLineStart, DWORD dwBytes)
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 NewLine [] = "\n"
char ASCII85DecodeBegine [] = "<~"
char ASCII85DecodeEnd [] = "~> cvx exec "
SINT CPLastError


Define Documentation

#define ICMSEG
 

#define LINELENG   128
 

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

#define TempBfSize   128
 

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


Function Documentation

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

Definition at line 1468 of file dec97/dll32/csprof.c.

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

01471 { 01472 long DataType; 01473 01474 GetCPElementDataType(CP, Index, &DataType); 01475 if (BufSize == 0) 01476 { 01477 if (AllowBinary) 01478 return (DataSize); 01479 else if (DataType == 0) // Ascii data in Profile 01480 return (DataSize); 01481 else // Keep space for ascii85 encoding. 01482 return (DataSize / 4 * 5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048); 01483 } 01484 else 01485 { 01486 if (AllowBinary) 01487 return (DataSize); 01488 else if(DataType == 0) 01489 return (DataSize); 01490 else 01491 return (ConvertBinaryData2Ascii(lpData, DataSize, BufSize) ); 01492 } 01493 }

SINT ConvertBinaryData2Ascii MEMPTR  lpMem,
SINT  DataSize,
SINT  BufSize
 

Definition at line 1423 of file dec97/dll32/csprof.c.

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

01424 { 01425 MEMPTR intrbuf, Temp; 01426 HANDLE intrhandle; 01427 SINT AsciiDataSize = 0; 01428 01429 if (BufSize >= (SINT)(DataSize/4*5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048)) 01430 { 01431 if ((intrhandle = GlobalAlloc(GHND, BufSize)) != NULL) 01432 { 01433 if ((intrbuf = (MEMPTR) GlobalLock(intrhandle)) != NULL) 01434 { 01435 Temp = intrbuf; 01436 Temp += WriteObject(Temp, NewLine); 01437 Temp += WriteObject(Temp, ASCII85DecodeBegine); 01438 Temp += WriteObject(Temp, NewLine); 01439 Temp += WriteASCII85Cont(Temp, BufSize, lpMem, DataSize); 01440 Temp += WriteObject(Temp, ASCII85DecodeEnd); 01441 AsciiDataSize = (SINT)(Temp - intrbuf); 01442 lstrcpyn(lpMem, intrbuf, (WORD)AsciiDataSize); 01443 GlobalUnlock(intrhandle); 01444 } 01445 } 01446 GlobalFree(intrhandle); 01447 } 01448 return (AsciiDataSize); 01449 }

BOOL EXTERN DoesCPTagExist CHANDLE  CP,
CSIG  CPTag
 

Definition at line 401 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN FreeCP HGLOBAL  hMem  ) 
 

Definition at line 210 of file dec97/dll32/csprof.c.

References BOOL, EXTERN, and MemFree().

00211 { 00212 return( MemFree(hMem) ); 00213 }

BOOL EXTERN GetCPAttributes CHANDLE  CP,
LPATTRIB  lpAttributes
 

Definition at line 883 of file dec97/dll32/csprof.c.

References BOOL, EXTERN, and TRUE.

00884 { 00885 return(TRUE); 00886 }

BOOL EXTERN GetCPClass CHANDLE  CP,
LPCSIG  lpClass
 

Definition at line 782 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPCMMType CHANDLE  CP,
LPCSIG  lpType
 

Definition at line 760 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPConnSpace CHANDLE  CP,
LPCSIG  lpOutSpace
 

Definition at line 804 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPDevSpace CHANDLE  CP,
LPCSIG  lpInSpace
 

Definition at line 793 of file dec97/dll32/csprof.c.

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

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

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

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

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

BOOL EXTERN GetCPElementCount CHANDLE  CP,
LPSINT  lpCount
 

Definition at line 216 of file dec97/dll32/csprof.c.

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

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

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

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

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

BOOL EXTERN GetCPElementDataSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 520 of file dec97/dll32/csprof.c.

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

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

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

Definition at line 619 of file dec97/dll32/csprof.c.

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

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

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

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

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

BOOL EXTERN GetCPElementSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 499 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPElementType CHANDLE  CP,
SINT  Index,
LPCSIG  lpCSig
 

Definition at line 483 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPFlags CHANDLE  CP,
LPSINT  lpFlags
 

Definition at line 848 of file dec97/dll32/csprof.c.

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

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

SINT EXTERN GetCPLastError  ) 
 

Definition at line 24 of file dec97/dll32/csprof.c.

References CPLastError, EXTERN, and SINT.

00025 { 00026 return(CPLastError); 00027 }

BOOL EXTERN GetCPManufacturer CHANDLE  CP,
LPCSIG  lpManuf
 

Definition at line 826 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPMediaWhitePoint CHANDLE  cp,
LPSFLOAT  lpMediaWP
 

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

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

BOOL EXTERN GetCPModel CHANDLE  CP,
LPCSIG  lpModel
 

Definition at line 837 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPRenderIntent CHANDLE  CP,
LPSINT  lpIntent
 

Definition at line 859 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPSize CHANDLE  CP,
LPSINT  lpSize
 

Definition at line 749 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPTagIndex CHANDLE  CP,
CSIG  CPTag,
LPSINT  lpIndex
 

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

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

BOOL EXTERN GetCPTagSig CHANDLE  CP,
SINT  Index,
LPCSIG  lpCPTag
 

Definition at line 459 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPTarget CHANDLE  CP,
LPCSIG  lpTarget
 

Definition at line 815 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPVersion CHANDLE  CP,
LPSINT  lpVers
 

Definition at line 771 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN GetCPWhitePoint CHANDLE  CP,
LPSFLOAT  lpWP
 

Definition at line 870 of file dec97/dll32/csprof.c.

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

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

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

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

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

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

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

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

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

Definition at line 29 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN MemFree HGLOBAL  hMem  ) 
 

Definition at line 60 of file dec97/dll32/csprof.c.

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

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

BOOL EXTERN SetCPLastError SINT  LastError  ) 
 

Definition at line 18 of file dec97/dll32/csprof.c.

References BOOL, CPLastError, EXTERN, and TRUE.

00019 { 00020 CPLastError = LastError; 00021 return(TRUE); 00022 }

BOOL EXTERN ValidateCP CHANDLE  CP  ) 
 

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

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

BOOL EXTERN ValidateCPElement CHANDLE  CP,
SINT  Index
 

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

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

BOOL EXTERN ValidColorSpace LPPDEVICE  lppd,
LPICMINFO  lpICMI
 

Definition at line 1027 of file dec97/dll32/csprof.c.

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

SINT WriteAscii85 MEMPTR  lpDest,
unsigned long  inWord,
SINT  nBytes
 

Definition at line 1383 of file dec97/dll32/csprof.c.

References BYTE, lpDest, MEMPTR, and SINT.

01384 { 01385 unsigned long divisor; 01386 int bcount; 01387 BYTE outchar; 01388 MEMPTR lpSave = lpDest; 01389 01390 if ((inWord == 0UL) && (nBytes == 5)) 01391 *lpDest++ = 'z'; 01392 else 01393 { 01394 divisor = 52200625UL; 01395 for (bcount = 0; bcount < nBytes; bcount ++) 01396 { 01397 outchar = (BYTE)((int)(inWord/divisor) + (int)'!'); 01398 *lpDest++ = outchar; 01399 if (bcount < 4) 01400 { 01401 inWord = (inWord % divisor); 01402 divisor =(divisor / 85); 01403 } 01404 } 01405 } 01406 return (SINT)(lpDest - lpSave); 01407 }

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

Definition at line 1322 of file dec97/dll32/csprof.c.

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

01323 { 01324 SINT incount; 01325 MEMPTR lpPtr, lpSave; 01326 SINT rem; 01327 SINT bcount; 01328 SINT dex; 01329 unsigned long word; 01330 01331 /* encode the initial 4-tuples */ 01332 lpSave = lpDest; 01333 lpPtr = lpSource; 01334 word = 0UL; 01335 bcount = 0; 01336 01337 for (incount = 0; incount < DataSize; incount ++) 01338 { 01339 if ( incount && ((incount % LINELENG) == 0) ) 01340 lpDest += WriteObject(lpDest, NewLine); 01341 word = (word<<8); 01342 word |= (BYTE)*lpPtr++; 01343 if (bcount == 3) 01344 { 01345 lpDest += WriteAscii85(lpDest, word, 5); 01346 word = 0UL; 01347 bcount = 0; 01348 } 01349 else 01350 { 01351 bcount ++; 01352 } 01353 } 01354 01355 /* now do the last partial 4-tuple -- if there is one */ 01356 /* see the Red Book spec for the rules on how this is done */ 01357 if (bcount > 0) 01358 { 01359 rem = 4 - bcount; /* count the remaining bytes */ 01360 for (dex = 0; dex < rem; dex ++) /* shift left for each of them */ 01361 { 01362 word = (word<<8); /* (equivalent to adding in ZERO's)*/ 01363 word |= (BYTE)32; 01364 } 01365 // lpDest += WriteAscii85(lpDest, word, (bcount + 1)); /* output only meaningful 01366 lpDest += WriteAscii85(lpDest, word, 5); /* output only meaningful bytes + 1 */ 01367 } 01368 return (lpDest - lpSave); 01369 }

SINT WriteByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

Definition at line 1282 of file dec97/dll32/csprof.c.

References SINT.

01283 { 01284 SINT i; 01285 01286 for (i = 0; i < sBytes; i ++) 01287 *lpMem++ = *lpBuff++; 01288 01289 return(sBytes); 01290 }

SINT WriteFloat MEMPTR  lpMem,
double  dFloat
 

Definition at line 1176 of file dec97/dll32/csprof.c.

References DWORD, SINT, and TempBfSize.

01177 { 01178 char cSign; 01179 double dInt ; 01180 double dFract ; 01181 LONG lFloat ; 01182 SINT Res; 01183 char TempArray[TempBfSize]; 01184 01185 lFloat = (LONG) floor( dFloat * 10000.0 + 0.5); 01186 01187 dFloat = lFloat / 10000.0 ; 01188 01189 dInt = floor(fabs(dFloat)); 01190 dFract = fabs(dFloat) - dInt ; 01191 01192 cSign = ' ' ; 01193 if ( dFloat < 0 ) 01194 { 01195 cSign = '-' ; 01196 } 01197 01198 Res = wsprintf( (LPSTR) TempArray, (LPSTR) "%c%d.%0.4lu ", 01199 cSign, (WORD) dInt , (DWORD) (dFract *10000.0) ); 01200 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01201 return ( Res ); 01202 }

SINT WriteHex MEMPTR  lpMem,
SINT  Number
 

Definition at line 1160 of file dec97/dll32/csprof.c.

References SINT, and TempBfSize.

01161 { 01162 SINT Res; 01163 char TempArray[TempBfSize]; 01164 01165 Res = wsprintf( TempArray, "%2.2x", (int)(Number & 0x00FF) ); 01166 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01167 return( Res ); 01168 }

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

Definition at line 1100 of file dec97/dll32/csprof.c.

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

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

SINT WriteHNAToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1224 of file dec97/dll32/csprof.c.

References BYTE, SINT, and Token.

01225 { 01226 *lpMem++ = Token; 01227 *lpMem++ = 32; // 16-bit fixed integer, high-order byte first 01228 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01229 *lpMem++ = (BYTE)(sNum & 0x00FF); 01230 return (4); 01231 }

SINT WriteInt MEMPTR  lpMem,
SINT  Number
 

Definition at line 1145 of file dec97/dll32/csprof.c.

References MEMPTR, SINT, and TempBfSize.

01146 { 01147 SINT Res; 01148 char TempArray[TempBfSize]; 01149 01150 Res = wsprintf( (MEMPTR)TempArray, "%lu ", Number ); 01151 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01152 return( Res ); 01153 }

SINT WriteInt2ByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

Definition at line 1297 of file dec97/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01298 { 01299 SINT i; 01300 01301 for( i = 0; i < sBytes ; i++) 01302 { 01303 *lpMem++ = (BYTE)(ui16toSINT( lpBuff)/256) ; 01304 lpBuff += sizeof(icUInt16Number); 01305 } 01306 return(sBytes); 01307 }

SINT WriteIntStringU2S MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1240 of file dec97/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01241 { 01242 SINT i; 01243 SINT Temp; 01244 01245 for (i = 0; i < sNum; i ++) 01246 { 01247 Temp = ui16toSINT( lpBuff) - 32768; 01248 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01249 *lpMem++ = (BYTE)(Temp & 0x00FF); 01250 lpBuff += sizeof(icUInt16Number); 01251 } 01252 return(sNum * 2); 01253 }

SINT WriteIntStringU2S_L MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1262 of file dec97/dll32/csprof.c.

References BYTE, icUInt16Number, PUSHORT, and SINT.

01263 { 01264 SINT i; 01265 SINT Temp; 01266 01267 for (i = 0; i < sNum; i ++) 01268 { 01269 Temp = (SINT)*((PUSHORT)lpBuff) - 32768; 01270 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01271 *lpMem++ = (BYTE)(Temp & 0x00FF); 01272 lpBuff += sizeof(icUInt16Number); 01273 } 01274 return(sNum * 2); 01275 }

SINT WriteObject MEMPTR  lpMem,
MEMPTR  Obj
 

Definition at line 1126 of file dec97/dll32/csprof.c.

References SINT.

01127 { 01128 SINT Res; 01129 01130 Res = lstrlen(Obj); 01131 MemCopy(lpMem, Obj, Res); 01132 return( Res ); 01133 }

SINT WriteObjectN MEMPTR  lpMem,
MEMPTR  Obj,
SINT  n
 

Definition at line 1135 of file dec97/dll32/csprof.c.

References n, and SINT.

01136 { 01137 MemCopy(lpMem, Obj, n); 01138 return( n ); 01139 }

SINT WriteStringToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1210 of file dec97/dll32/csprof.c.

References BYTE, SINT, and Token.

01211 { 01212 *lpMem++ = Token; 01213 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01214 *lpMem++ = (BYTE)(sNum & 0x00FF); 01215 return (3); 01216 }


Variable Documentation

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

Definition at line 10 of file dec97/dll32/csprof.c.

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

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

Definition at line 11 of file dec97/dll32/csprof.c.

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

SINT CPLastError [static]
 

Definition at line 16 of file dec97/dll32/csprof.c.

Referenced by GetCPLastError(), and SetCPLastError().

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

Definition at line 9 of file dec97/dll32/csprof.c.


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