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 jan99/dll32/csprof.c.

#define TempBfSize   128
 

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


Function Documentation

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

Definition at line 1500 of file jan99/dll32/csprof.c.

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

01503 { 01504 long DataType; 01505 01506 GetCPElementDataType(CP, Index, &DataType); 01507 if (BufSize == 0) 01508 { 01509 if (AllowBinary) 01510 return (DataSize); 01511 else if (DataType == 0) // Ascii data in Profile 01512 return (DataSize); 01513 else // Keep space for ascii85 encoding. 01514 return (DataSize / 4 * 5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048); 01515 } 01516 else 01517 { 01518 if (AllowBinary) 01519 return (DataSize); 01520 else if(DataType == 0) 01521 return (DataSize); 01522 else 01523 return (ConvertBinaryData2Ascii(lpData, DataSize, BufSize) ); 01524 } 01525 }

SINT ConvertBinaryData2Ascii MEMPTR  lpMem,
SINT  DataSize,
SINT  BufSize
 

Definition at line 1455 of file jan99/dll32/csprof.c.

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

01456 { 01457 MEMPTR intrbuf, Temp; 01458 HANDLE intrhandle; 01459 SINT AsciiDataSize = 0; 01460 01461 if (BufSize >= (SINT)(DataSize/4*5 + sizeof(ASCII85DecodeBegine)+sizeof(ASCII85DecodeEnd) + 2048)) 01462 { 01463 if ((intrhandle = GlobalAlloc(GHND, BufSize)) != NULL) 01464 { 01465 if ((intrbuf = (MEMPTR) GlobalLock(intrhandle)) != NULL) 01466 { 01467 Temp = intrbuf; 01468 Temp += WriteObject(Temp, NewLine); 01469 Temp += WriteObject(Temp, ASCII85DecodeBegine); 01470 Temp += WriteObject(Temp, NewLine); 01471 Temp += WriteASCII85Cont(Temp, BufSize, lpMem, DataSize); 01472 Temp += WriteObject(Temp, ASCII85DecodeEnd); 01473 AsciiDataSize = (SINT)(Temp - intrbuf); 01474 lstrcpyn(lpMem, intrbuf, (WORD)AsciiDataSize); 01475 GlobalUnlock(intrhandle); 01476 } 01477 } 01478 GlobalFree(intrhandle); 01479 } 01480 return (AsciiDataSize); 01481 }

BOOL EXTERN DoesCPTagExist CHANDLE  CP,
CSIG  CPTag
 

Definition at line 418 of file jan99/dll32/csprof.c.

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

00419 { 00420 SINT Count; 00421 MEMPTR Data; 00422 lpcpTagList lpTL; 00423 00424 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00425 Count = ui32toSINT(lpTL->count); 00426 Data = (MEMPTR) &(lpTL->tags[0]) ; 00427 while ( Count-- ) 00428 { 00429 if( SigtoCSIG( ((lpcpTag)Data)->sig) == CPTag ) 00430 { 00431 return(TRUE); 00432 }else 00433 { 00434 Data += sizeof(icTag); // Bump pointer to the next tag 00435 } 00436 } 00437 return(FALSE); 00438 }

BOOL EXTERN FreeCP HGLOBAL  hMem  ) 
 

Definition at line 227 of file jan99/dll32/csprof.c.

References BOOL, EXTERN, and MemFree().

00228 { 00229 return( MemFree(hMem) ); 00230 }

BOOL EXTERN GetCPAttributes CHANDLE  CP,
LPATTRIB  lpAttributes
 

Definition at line 900 of file jan99/dll32/csprof.c.

References BOOL, EXTERN, and TRUE.

00901 { 00902 return(TRUE); 00903 }

BOOL EXTERN GetCPClass CHANDLE  CP,
LPCSIG  lpClass
 

Definition at line 799 of file jan99/dll32/csprof.c.

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

00800 { 00801 if (lpClass == NULL) 00802 { 00803 SetCPLastError(CP_NULL_POINTER_ERR); 00804 return(FALSE); 00805 } 00806 *lpClass = SigtoCSIG( ((lpcpHeader)CP)->deviceClass); 00807 return(TRUE); 00808 }

BOOL EXTERN GetCPCMMType CHANDLE  CP,
LPCSIG  lpType
 

Definition at line 777 of file jan99/dll32/csprof.c.

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

00778 { 00779 if (lpType == NULL) 00780 { 00781 SetCPLastError(CP_NULL_POINTER_ERR); 00782 return(FALSE); 00783 } 00784 *lpType = SigtoCSIG( ((lpcpHeader)CP)->cmmId); 00785 return(TRUE); 00786 }

BOOL EXTERN GetCPConnSpace CHANDLE  CP,
LPCSIG  lpOutSpace
 

Definition at line 821 of file jan99/dll32/csprof.c.

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

00822 { 00823 if (lpOutSpace == NULL) 00824 { 00825 SetCPLastError(CP_NULL_POINTER_ERR); 00826 return(FALSE); 00827 } 00828 *lpOutSpace = SigtoCSIG( ((lpcpHeader)CP)->pcs); 00829 return(TRUE); 00830 }

BOOL EXTERN GetCPDevSpace CHANDLE  CP,
LPCSIG  lpInSpace
 

Definition at line 810 of file jan99/dll32/csprof.c.

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

00811 { 00812 if (lpInSpace == NULL) 00813 { 00814 SetCPLastError(CP_NULL_POINTER_ERR); 00815 return(FALSE); 00816 } 00817 *lpInSpace = SigtoCSIG( ((lpcpHeader)CP)->colorSpace); 00818 return(TRUE); 00819 }

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

Definition at line 572 of file jan99/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.

00574 { 00575 SINT ElemSize; 00576 MEMPTR TagData, ElemData; 00577 if (lpData == NULL) 00578 { 00579 SetCPLastError(CP_NULL_POINTER_ERR); 00580 return(FALSE); 00581 } 00582 00583 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00584 (LPMEMPTR) &ElemData) ) 00585 { 00586 return(FALSE); 00587 } 00588 ElemSize = ui32toSINT( ((lpcpTag)TagData)->size); 00589 if(ElemSize > Size ) 00590 { 00591 SetCPLastError(CP_NO_MEMORY_ERR); 00592 return(FALSE); 00593 } 00594 MemCopy(lpData, ElemData, ElemSize); 00595 return(TRUE); 00596 00597 }

BOOL EXTERN GetCPElementCount CHANDLE  CP,
LPSINT  lpCount
 

Definition at line 233 of file jan99/dll32/csprof.c.

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

00234 { 00235 lpcpTagList lpTL; 00236 if (lpCount == NULL) 00237 { 00238 SetCPLastError(CP_NULL_POINTER_ERR); 00239 return(FALSE); 00240 } 00241 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00242 *lpCount = ui32toSINT(lpTL->count); 00243 return(TRUE); 00244 }

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

Definition at line 600 of file jan99/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.

00602 { 00603 SINT ElemSize; 00604 MEMPTR TagData, ElemData; 00605 if (lpData == NULL) 00606 { 00607 SetCPLastError(CP_NULL_POINTER_ERR); 00608 return(FALSE); 00609 } 00610 00611 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00612 (LPMEMPTR) &ElemData) ) 00613 { 00614 return(FALSE); 00615 } 00616 // Changed by jjia 8/24/95 00617 // ElemData += sizeof(lpcpTagBase); 00618 // ElemSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00619 // sizeof(lpcpTagBase); 00620 ElemData += sizeof(icTagBase) + sizeof(icUInt32Number); 00621 ElemSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00622 sizeof(icTagBase) - sizeof(icUInt32Number); 00623 00624 if(ElemSize > Size ) 00625 { 00626 SetCPLastError(CP_NO_MEMORY_ERR); 00627 return(FALSE); 00628 } 00629 00630 MemCopy(lpData, ElemData, ElemSize); 00631 return(TRUE); 00632 }

BOOL EXTERN GetCPElementDataSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 537 of file jan99/dll32/csprof.c.

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

00538 { 00539 MEMPTR TagData, ElemData; 00540 if (lpSize == NULL) 00541 { 00542 SetCPLastError(CP_NULL_POINTER_ERR); 00543 return(FALSE); 00544 } 00545 00546 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00547 (LPMEMPTR) &ElemData) ) 00548 { 00549 // Changed by jjia 8/24/95 00550 // *lpSize = ui32toSINT( ((lpcpTag)TagData)->size ) - 00551 // sizeof(lpcpTagBase); 00552 *lpSize = ui32toSINT( ((lpcpTag)TagData)->size) - 00553 sizeof(icTagBase) - sizeof(icUInt32Number); 00554 }else 00555 { 00556 return(FALSE); 00557 } 00558 00559 return(TRUE); 00560 }

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

Definition at line 636 of file jan99/dll32/csprof.c.

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

00637 { 00638 MEMPTR TagData, ElemData; 00639 00640 if (lpDataType == NULL) 00641 { 00642 SetCPLastError(CP_NULL_POINTER_ERR); 00643 return(FALSE); 00644 } 00645 00646 if ( !GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00647 (LPMEMPTR) &ElemData) ) 00648 { 00649 return(FALSE); 00650 } 00651 ElemData += sizeof(icTagBase); 00652 *lpDataType = ui32toSINT( ((icData __huge *)ElemData)->dataFlag); 00653 return (TRUE); 00654 }

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

Definition at line 247 of file jan99/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.

00249 { 00250 SINT Count; 00251 lpcpTagList lpTL; 00252 00253 if ( (lpTagData == NULL) || (lpElemData == NULL) ) 00254 { 00255 SetCPLastError(CP_NULL_POINTER_ERR); 00256 return(FALSE); 00257 } 00258 00259 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00260 Count = ui32toSINT(lpTL->count); 00261 if ( Count <= Index ) 00262 { 00263 SetCPLastError(CP_OUT_OF_RANGE_ERR); 00264 return(FALSE); 00265 } 00266 *lpTagData = ((MEMPTR) &(lpTL->tags[0])) + (Index * sizeof(icTag)) ; 00267 *lpElemData = ((MEMPTR) CP) + 00268 ui32toSINT( ((lpcpTag)*lpTagData)->offset); 00269 return(TRUE); 00270 }

BOOL EXTERN GetCPElementSize CHANDLE  CP,
SINT  Index,
LPSINT  lpSize
 

Definition at line 516 of file jan99/dll32/csprof.c.

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

00517 { 00518 MEMPTR TagData, ElemData; 00519 if (lpSize == NULL) 00520 { 00521 SetCPLastError(CP_NULL_POINTER_ERR); 00522 return(FALSE); 00523 } 00524 00525 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00526 (LPMEMPTR) &ElemData) ) 00527 { 00528 *lpSize = ui32toSINT( ((lpcpTag)TagData)->size ); 00529 }else 00530 { 00531 return(FALSE); 00532 } 00533 00534 return(TRUE); 00535 }

BOOL EXTERN GetCPElementType CHANDLE  CP,
SINT  Index,
LPCSIG  lpCSig
 

Definition at line 500 of file jan99/dll32/csprof.c.

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

00501 { 00502 MEMPTR TagData, ElemData; 00503 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00504 (LPMEMPTR) &ElemData) ) 00505 { 00506 *lpCSig = SigtoCSIG( ((lpcpTagBase)ElemData)->sig ) ; 00507 }else 00508 { 00509 return(FALSE); 00510 } 00511 return(TRUE); 00512 }

BOOL EXTERN GetCPFlags CHANDLE  CP,
LPSINT  lpFlags
 

Definition at line 865 of file jan99/dll32/csprof.c.

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

00866 { 00867 if (lpFlags == NULL) 00868 { 00869 SetCPLastError(CP_NULL_POINTER_ERR); 00870 return(FALSE); 00871 } 00872 *lpFlags = ui32toSINT( ((lpcpHeader)CP)->flags); 00873 return(TRUE); 00874 }

SINT EXTERN GetCPLastError  ) 
 

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

References CPLastError, EXTERN, and SINT.

00028 { 00029 return(CPLastError); 00030 }

BOOL EXTERN GetCPManufacturer CHANDLE  CP,
LPCSIG  lpManuf
 

Definition at line 843 of file jan99/dll32/csprof.c.

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

00844 { 00845 if (lpManuf == NULL) 00846 { 00847 SetCPLastError(CP_NULL_POINTER_ERR); 00848 return(FALSE); 00849 } 00850 *lpManuf = SigtoCSIG( ((lpcpHeader)CP)->manufacturer); 00851 return(TRUE); 00852 }

BOOL EXTERN GetCPMediaWhitePoint CHANDLE  cp,
LPSFLOAT  lpMediaWP
 

Definition at line 905 of file jan99/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.

00906 { 00907 HGLOBAL hTempMem; 00908 SINT TempSize; 00909 MEMPTR TempBuff; 00910 MEMPTR lpTable; 00911 SINT i, Index; 00912 00913 if (DoesCPTagExist (cp, icSigMediaWhitePointTag) && 00914 GetCPTagIndex (cp, icSigMediaWhitePointTag, (LPSINT) & Index) && 00915 GetCPElementSize (cp, Index, (LPSINT) & TempSize) && 00916 MemAlloc (TempSize, (HGLOBAL *) & hTempMem, (LPMEMPTR) & TempBuff) && 00917 GetCPElement (cp, Index, TempBuff, TempSize)) 00918 { 00919 lpTable = (MEMPTR) & (((lpcpXYZType) TempBuff)->data); 00920 for (i = 0; i < 3; i++) 00921 { 00922 lpMediaWP[i] = (SFLOAT) si16f16toSFLOAT (lpTable); 00923 lpTable += sizeof (icS15Fixed16Number); 00924 } 00925 MemFree (hTempMem); 00926 return (TRUE); 00927 } 00928 return (FALSE); 00929 }

BOOL EXTERN GetCPModel CHANDLE  CP,
LPCSIG  lpModel
 

Definition at line 854 of file jan99/dll32/csprof.c.

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

00855 { 00856 if (lpModel == NULL) 00857 { 00858 SetCPLastError(CP_NULL_POINTER_ERR); 00859 return(FALSE); 00860 } 00861 *lpModel = SigtoCSIG( ((lpcpHeader)CP)->model); 00862 return(TRUE); 00863 }

BOOL EXTERN GetCPRenderIntent CHANDLE  CP,
LPSINT  lpIntent
 

Definition at line 876 of file jan99/dll32/csprof.c.

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

00877 { 00878 if (lpIntent == NULL) 00879 { 00880 SetCPLastError(CP_NULL_POINTER_ERR); 00881 return(FALSE); 00882 } 00883 *lpIntent = ui32toSINT( ((lpcpHeader)CP)->renderingIntent); 00884 return(TRUE); 00885 }

BOOL EXTERN GetCPSize CHANDLE  CP,
LPSINT  lpSize
 

Definition at line 766 of file jan99/dll32/csprof.c.

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

00767 { 00768 if (lpSize == NULL) 00769 { 00770 SetCPLastError(CP_NULL_POINTER_ERR); 00771 return(FALSE); 00772 } 00773 *lpSize = ui32toSINT( ((lpcpHeader)CP)->size); 00774 return(TRUE); 00775 }

BOOL EXTERN GetCPTagIndex CHANDLE  CP,
CSIG  CPTag,
LPSINT  lpIndex
 

Definition at line 441 of file jan99/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.

00442 { 00443 SINT Count; 00444 MEMPTR Data; 00445 SINT i; 00446 lpcpTagList lpTL; 00447 00448 if (lpIndex == NULL) 00449 { 00450 SetCPLastError(CP_NULL_POINTER_ERR); 00451 return(FALSE); 00452 } 00453 00454 lpTL = (lpcpTagList) &(((lpcpProfile)CP)->count); 00455 Count = ui32toSINT(lpTL->count); 00456 Data = (MEMPTR) &(lpTL->tags[0]) ; 00457 00458 for (i = 0; i < Count; i++ ) 00459 { 00460 if( SigtoCSIG( ((lpcpTag)Data)->sig) == CPTag ) 00461 { 00462 *lpIndex = i; 00463 return(TRUE); 00464 }else 00465 { 00466 Data += sizeof(icTag); // Bump pointer to the next tag 00467 } 00468 } 00469 00470 SetCPLastError(CP_NOT_FOUND_ERR); 00471 return(FALSE); 00472 }

BOOL EXTERN GetCPTagSig CHANDLE  CP,
SINT  Index,
LPCSIG  lpCPTag
 

Definition at line 476 of file jan99/dll32/csprof.c.

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

00477 { 00478 MEMPTR TagData, ElemData; 00479 if (lpCPTag == NULL) 00480 { 00481 SetCPLastError(CP_NULL_POINTER_ERR); 00482 return(FALSE); 00483 } 00484 if ( GetCPElementInfo(CP, Index, (LPMEMPTR) &TagData, 00485 (LPMEMPTR) &ElemData) ) 00486 { 00487 *lpCPTag = SigtoCSIG( ((lpcpTag)TagData)->sig ) ; 00488 }else 00489 { 00490 return(FALSE); 00491 } 00492 return(TRUE); 00493 }

BOOL EXTERN GetCPTarget CHANDLE  CP,
LPCSIG  lpTarget
 

Definition at line 832 of file jan99/dll32/csprof.c.

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

00833 { 00834 if (lpTarget == NULL) 00835 { 00836 SetCPLastError(CP_NULL_POINTER_ERR); 00837 return(FALSE); 00838 } 00839 *lpTarget = SigtoCSIG( ((lpcpHeader)CP)->platform); 00840 return(TRUE); 00841 }

BOOL EXTERN GetCPVersion CHANDLE  CP,
LPSINT  lpVers
 

Definition at line 788 of file jan99/dll32/csprof.c.

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

00789 { 00790 if (lpVers == NULL) 00791 { 00792 SetCPLastError(CP_NULL_POINTER_ERR); 00793 return(FALSE); 00794 } 00795 *lpVers = ui32toSINT( ((lpcpHeader)CP)->version); 00796 return(TRUE); 00797 }

BOOL EXTERN GetCPWhitePoint CHANDLE  CP,
LPSFLOAT  lpWP
 

Definition at line 887 of file jan99/dll32/csprof.c.

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

00888 { 00889 if (lpWP == NULL) 00890 { 00891 SetCPLastError(CP_NULL_POINTER_ERR); 00892 return(FALSE); 00893 } 00894 lpWP[0] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.X); 00895 lpWP[1] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.Y); 00896 lpWP[2] = (SFLOAT) si16f16toSFLOAT( ((lpcpHeader)CP)->illuminant.Z); 00897 return(TRUE); 00898 }

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

Definition at line 953 of file jan99/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.

00955 { 00956 SINT Index; 00957 SINT Size; 00958 00959 if (!cp) 00960 return FALSE; 00961 00962 Size = (SINT) *lpcbSize; 00963 if( ( lpMem == NULL ) || ( Size == 0 ) ) 00964 { 00965 lpMem = NULL; 00966 Size = 0; 00967 *lpcbSize = 0; 00968 } 00969 00970 switch(Intent) 00971 { 00972 case icPerceptual: 00973 if( DoesCPTagExist(cp, icSigPs2Intent0Tag) && 00974 GetCPTagIndex(cp, icSigPs2Intent0Tag, (LPSINT) &Index) && 00975 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00976 ( ( lpMem == NULL ) || 00977 GetCPElementData(cp, Index, lpMem, Size) ) ) 00978 { 00979 } 00980 break; 00981 00982 case icRelativeColorimetric: 00983 if( DoesCPTagExist(cp, icSigPs2Intent1Tag) && 00984 GetCPTagIndex(cp, icSigPs2Intent1Tag, (LPSINT) &Index) && 00985 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00986 ( ( lpMem == NULL ) || 00987 GetCPElementData(cp, Index, lpMem, Size) ) ) 00988 { 00989 } 00990 break; 00991 00992 case icSaturation: 00993 if( DoesCPTagExist(cp, icSigPs2Intent2Tag) && 00994 GetCPTagIndex(cp, icSigPs2Intent2Tag, (LPSINT) &Index) && 00995 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 00996 ( ( lpMem == NULL ) || 00997 GetCPElementData(cp, Index, lpMem, Size ) ) 00998 ) 00999 { 01000 } 01001 break; 01002 case icAbsoluteColorimetric: 01003 if( DoesCPTagExist(cp, icSigPs2Intent3Tag) && 01004 GetCPTagIndex(cp, icSigPs2Intent3Tag, (LPSINT) &Index) && 01005 GetCPElementDataSize(cp, Index, (LPSINT) &Size) && 01006 ( ( lpMem == NULL ) || 01007 GetCPElementData(cp, Index, lpMem, Size) ) ) 01008 { 01009 } 01010 break; 01011 default: 01012 Size = 0 ; 01013 break; 01014 } 01015 01016 if (Size != 0) 01017 { 01018 if (lpMem) 01019 { 01020 lpMem[Size] = '\0'; 01021 } 01022 Size ++; 01023 *lpcbSize = (DWORD) Size; 01024 return (TRUE); 01025 } 01026 else 01027 { 01028 return(FALSE); 01029 } 01030 }

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

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

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

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

Definition at line 32 of file jan99/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 jan99/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 jan99/dll32/csprof.c.

References BOOL, CPLastError, EXTERN, and TRUE.

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

BOOL EXTERN ValidateCP CHANDLE  CP  ) 
 

Definition at line 275 of file jan99/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.

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

BOOL EXTERN ValidateCPElement CHANDLE  CP,
SINT  Index
 

Definition at line 656 of file jan99/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.

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

BOOL EXTERN ValidColorSpace LPPDEVICE  lppd,
LPICMINFO  lpICMI,
LPCSIG  lpDevCS
 

Definition at line 1044 of file jan99/dll32/csprof.c.

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

01045 { 01046 icHeader CPHeader; 01047 HFILE hFile; 01048 SINT Res; 01049 CSIG CPColorSpaceTag; 01050 01051 if (NULL == lpICMI) 01052 { 01053 return(FALSE); 01054 } 01055 hFile = _lopen(lpICMI->lcsDestFilename, READ); 01056 if( hFile == HFILE_ERROR ) 01057 { 01058 return(FALSE); 01059 } 01060 01061 Res = _lread(hFile, (LPVOID) &CPHeader, sizeof(CPHeader)); 01062 _lclose(hFile); 01063 if( (Res == HFILE_ERROR) || (Res != sizeof(CPHeader)) ) 01064 { 01065 return(FALSE); 01066 } 01067 01068 // Make the initial check for validity of the profile 01069 if( SigtoCSIG(CPHeader.magic) != icMagicNumber ) 01070 { 01071 return(FALSE); 01072 } 01073 // Make sure the profile is 'prtr' 01074 // SRGB98 01075 // if( SigtoCSIG(CPHeader.deviceClass) != icSigOutputClass ) 01076 // { 01077 // return(FALSE); 01078 // } 01079 CPColorSpaceTag = SigtoCSIG(CPHeader.colorSpace); 01080 *lpDevCS = CPColorSpaceTag; // 247974 01081 01082 switch ( lppd->lpPSExtDevmode->dm.iColorMatchingMethod ) 01083 { 01084 case COLOR_MATCHING_ON_HOST: 01085 if ((CPColorSpaceTag == icSigCmyData)) 01086 // (CPColorSpaceTag == icSigRgbData)) 01087 // (CPColorSpaceTag == icSigGrayData)) 01088 { 01089 return(FALSE); 01090 } 01091 break; 01092 case COLOR_MATCHING_ON_PRINTER: 01093 if ((CPColorSpaceTag == icSigCmyData)) 01094 // (CPColorSpaceTag == icSigGrayData)) 01095 { 01096 return(FALSE); 01097 } 01098 break; 01099 case COLOR_MATCHING_PRINTER_CALIBRATION: 01100 default: 01101 break; 01102 } 01103 return (TRUE); 01104 }

SINT WriteAscii85 MEMPTR  lpDest,
unsigned long  inWord,
SINT  nBytes
 

Definition at line 1415 of file jan99/dll32/csprof.c.

References BYTE, lpDest, MEMPTR, and SINT.

01416 { 01417 unsigned long divisor; 01418 int bcount; 01419 BYTE outchar; 01420 MEMPTR lpSave = lpDest; 01421 01422 if ((inWord == 0UL) && (nBytes == 5)) 01423 *lpDest++ = 'z'; 01424 else 01425 { 01426 divisor = 52200625UL; 01427 for (bcount = 0; bcount < nBytes; bcount ++) 01428 { 01429 outchar = (BYTE)((int)(inWord/divisor) + (int)'!'); 01430 *lpDest++ = outchar; 01431 if (bcount < 4) 01432 { 01433 inWord = (inWord % divisor); 01434 divisor =(divisor / 85); 01435 } 01436 } 01437 } 01438 return (SINT)(lpDest - lpSave); 01439 }

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

Definition at line 1354 of file jan99/dll32/csprof.c.

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

01355 { 01356 SINT incount; 01357 MEMPTR lpPtr, lpSave; 01358 SINT rem; 01359 SINT bcount; 01360 SINT dex; 01361 unsigned long word; 01362 01363 /* encode the initial 4-tuples */ 01364 lpSave = lpDest; 01365 lpPtr = lpSource; 01366 word = 0UL; 01367 bcount = 0; 01368 01369 for (incount = 0; incount < DataSize; incount ++) 01370 { 01371 if ( incount && ((incount % LINELENG) == 0) ) 01372 lpDest += WriteObject(lpDest, NewLine); 01373 word = (word<<8); 01374 word |= (BYTE)*lpPtr++; 01375 if (bcount == 3) 01376 { 01377 lpDest += WriteAscii85(lpDest, word, 5); 01378 word = 0UL; 01379 bcount = 0; 01380 } 01381 else 01382 { 01383 bcount ++; 01384 } 01385 } 01386 01387 /* now do the last partial 4-tuple -- if there is one */ 01388 /* see the Red Book spec for the rules on how this is done */ 01389 if (bcount > 0) 01390 { 01391 rem = 4 - bcount; /* count the remaining bytes */ 01392 for (dex = 0; dex < rem; dex ++) /* shift left for each of them */ 01393 { 01394 word = (word<<8); /* (equivalent to adding in ZERO's)*/ 01395 word |= (BYTE)32; 01396 } 01397 // lpDest += WriteAscii85(lpDest, word, (bcount + 1)); /* output only meaningful 01398 lpDest += WriteAscii85(lpDest, word, 5); /* output only meaningful bytes + 1 */ 01399 } 01400 return (lpDest - lpSave); 01401 }

SINT WriteByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

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

References SINT.

01315 { 01316 SINT i; 01317 01318 for (i = 0; i < sBytes; i ++) 01319 *lpMem++ = *lpBuff++; 01320 01321 return(sBytes); 01322 }

SINT WriteFloat MEMPTR  lpMem,
double  dFloat
 

Definition at line 1208 of file jan99/dll32/csprof.c.

References DWORD, SINT, and TempBfSize.

01209 { 01210 char cSign; 01211 double dInt ; 01212 double dFract ; 01213 LONG lFloat ; 01214 SINT Res; 01215 char TempArray[TempBfSize]; 01216 01217 lFloat = (LONG) floor( dFloat * 10000.0 + 0.5); 01218 01219 dFloat = lFloat / 10000.0 ; 01220 01221 dInt = floor(fabs(dFloat)); 01222 dFract = fabs(dFloat) - dInt ; 01223 01224 cSign = ' ' ; 01225 if ( dFloat < 0 ) 01226 { 01227 cSign = '-' ; 01228 } 01229 01230 Res = wsprintf( (LPSTR) TempArray, (LPSTR) "%c%d.%0.4lu ", 01231 cSign, (WORD) dInt , (DWORD) (dFract *10000.0) ); 01232 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01233 return ( Res ); 01234 }

SINT WriteHex MEMPTR  lpMem,
SINT  Number
 

Definition at line 1192 of file jan99/dll32/csprof.c.

References SINT, and TempBfSize.

01193 { 01194 SINT Res; 01195 char TempArray[TempBfSize]; 01196 01197 Res = wsprintf( TempArray, "%2.2x", (int)(Number & 0x00FF) ); 01198 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01199 return( Res ); 01200 }

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

Definition at line 1119 of file jan99/dll32/csprof.c.

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

01120 { 01121 SINT Res; 01122 char TempArray[TempBfSize]; 01123 MEMPTR lpOldPtr = lpMem; 01124 01125 for ( ; dwBytes ; dwBytes-- ) 01126 { 01127 Res = wsprintf( (MEMPTR)TempArray, (LPSTR) "%2.2x", *lpBuff ); 01128 *lpMem++ = TempArray[0]; 01129 *lpMem++ = TempArray[1]; 01130 lpBuff++; 01131 if (((SINT)(lpMem - lpLineStart)) > MAX_LINELENG) 01132 { 01133 lpLineStart = lpMem; 01134 lpMem += WriteObject(lpMem, NewLine); 01135 } 01136 } 01137 return( (SINT)(lpMem - lpOldPtr)); 01138 }

SINT WriteHNAToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1256 of file jan99/dll32/csprof.c.

References BYTE, SINT, and Token.

01257 { 01258 *lpMem++ = Token; 01259 *lpMem++ = 32; // 16-bit fixed integer, high-order byte first 01260 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01261 *lpMem++ = (BYTE)(sNum & 0x00FF); 01262 return (4); 01263 }

SINT WriteInt MEMPTR  lpMem,
SINT  Number
 

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

References MEMPTR, SINT, and TempBfSize.

01178 { 01179 SINT Res; 01180 char TempArray[TempBfSize]; 01181 01182 Res = wsprintf( (MEMPTR)TempArray, "%lu ", Number ); 01183 MemCopy(lpMem, TempArray, lstrlen(TempArray)); 01184 return( Res ); 01185 }

SINT WriteInt2ByteString MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sBytes
 

Definition at line 1329 of file jan99/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01330 { 01331 SINT i; 01332 01333 for( i = 0; i < sBytes ; i++) 01334 { 01335 *lpMem++ = (BYTE)(ui16toSINT( lpBuff)/256) ; 01336 lpBuff += sizeof(icUInt16Number); 01337 } 01338 return(sBytes); 01339 }

SINT WriteIntStringU2S MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1272 of file jan99/dll32/csprof.c.

References BYTE, icUInt16Number, SINT, and ui16toSINT.

01273 { 01274 SINT i; 01275 SINT Temp; 01276 01277 for (i = 0; i < sNum; i ++) 01278 { 01279 Temp = ui16toSINT( lpBuff) - 32768; 01280 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01281 *lpMem++ = (BYTE)(Temp & 0x00FF); 01282 lpBuff += sizeof(icUInt16Number); 01283 } 01284 return(sNum * 2); 01285 }

SINT WriteIntStringU2S_L MEMPTR  lpMem,
MEMPTR  lpBuff,
SINT  sNum
 

Definition at line 1294 of file jan99/dll32/csprof.c.

References BYTE, icUInt16Number, PUSHORT, and SINT.

01295 { 01296 SINT i; 01297 SINT Temp; 01298 01299 for (i = 0; i < sNum; i ++) 01300 { 01301 Temp = (SINT)*((PUSHORT)lpBuff) - 32768; 01302 *lpMem++ = (BYTE)((Temp & 0xFF00) >> 8); 01303 *lpMem++ = (BYTE)(Temp & 0x00FF); 01304 lpBuff += sizeof(icUInt16Number); 01305 } 01306 return(sNum * 2); 01307 }

SINT WriteNewLineObject MEMPTR  lpMem,
MEMPTR  Obj
 

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

References NewLine, and SINT.

01146 { 01147 SINT Res1, Res2; 01148 01149 Res1 = lstrlen(NewLine); 01150 MemCopy(lpMem, NewLine, Res1); 01151 01152 lpMem += Res1; 01153 Res2 = lstrlen(Obj); 01154 MemCopy(lpMem, Obj, Res2); 01155 return( Res1 + Res2 ); 01156 }

SINT WriteObject MEMPTR  lpMem,
MEMPTR  Obj
 

Definition at line 1158 of file jan99/dll32/csprof.c.

References SINT.

01159 { 01160 SINT Res; 01161 01162 Res = lstrlen(Obj); 01163 MemCopy(lpMem, Obj, Res); 01164 return( Res ); 01165 }

SINT WriteObjectN MEMPTR  lpMem,
MEMPTR  Obj,
SINT  n
 

Definition at line 1167 of file jan99/dll32/csprof.c.

References n, and SINT.

01168 { 01169 MemCopy(lpMem, Obj, n); 01170 return( n ); 01171 }

SINT WriteStringToken MEMPTR  lpMem,
BYTE  Token,
SINT  sNum
 

Definition at line 1242 of file jan99/dll32/csprof.c.

References BYTE, SINT, and Token.

01243 { 01244 *lpMem++ = Token; 01245 *lpMem++ = (BYTE)((sNum & 0xFF00) >> 8); 01246 *lpMem++ = (BYTE)(sNum & 0x00FF); 01247 return (3); 01248 }


Variable Documentation

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

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

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

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

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

Referenced by Convert2Ascii(), and ConvertBinaryData2Ascii().

SINT CPLastError [static]
 

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

Referenced by GetCPLastError(), and SetCPLastError().

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

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


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