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

icm32.c File Reference

#include "Windef.h"
#include "WinGdi.h"
#include <wtypes.h>
#include <winbase.h>
#include <WindowsX.h>
#include "ICM.h"
#include "General.h"
#include "MemProf.h"

Go to the source code of this file.

Defines

#define CMM_WIN_VERSION   0
#define CMM_IDENT   1
#define CMM_DRIVER_LEVEL   2
#define CMM_DLL_VERSION   3
#define CMM_VERSION   4
#define CMS_LEVEL_1   1
#define DllExport   __declspec( dllexport )

Typedefs

typedef HANDLE HCMTRANSFORM
typedef LPVOID LPDEVCHARACTER
typedef HANDLE * LPHPROFILE
typedef LPVOID LPARGBQUAD
typedef COLORREF FAR * LPCOLORREF

Functions

BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
HCMTRANSFORM WINAPI CMCreateMultiProfileTransform (LPHPROFILE lpahProfiles, DWORD nProfiles, DWORD *aIntentArr, DWORD nIntents, DWORD dwFlags)
long FillProfileFromLog (LPLOGCOLORSPACEA lpColorSpace, PPROFILE theProf)
long FillProfileFromLogW (LPLOGCOLORSPACEW lpColorSpace, PPROFILE theProf)
BOOL WINAPI CMCreateProfile (LPLOGCOLORSPACEA lpColorSpace, LPDEVCHARACTER *lpProfileData)
CMWorldRef StoreTransform (CMWorldRef aRef)
CMBitmapColorSpace CMGetDataColorSpace (BMFORMAT c, long *pixelSize)
HCMTRANSFORM WINAPI CMGetTransform (HCMTRANSFORM hcmTransform)
long CMCreateMultiProfileTransformInternal (CMWorldRef *cw, LPHPROFILE lpahProfiles, DWORD nProfiles, DWORD *aIntentArr, DWORD nIntents, DWORD dwFlags, DWORD dwCreateLink)
DWORD WINAPI CMGetInfo (DWORD dwInfo)
long CMCreateTransformExtInternal (CMWorldRef *cwOut, UINT32 dwFlags, UINT32 lcsIntent, HPROFILE aProf, LPBYTE ptDeRef, LPBYTE pdDeRef)
void WriteProf (LPSTR name, icProfile *theProf, long currentSize)
HCMTRANSFORM WINAPI CMCreateTransformExt (LPLOGCOLORSPACEA lpColorSpace, LPDEVCHARACTER lpDevCharacter, LPDEVCHARACTER lpTargetDevCharacter, DWORD dwFlags)
HCMTRANSFORM WINAPI CMCreateTransform (LPLOGCOLORSPACEA lpColorSpace, LPDEVCHARACTER lpDevCharacter, LPDEVCHARACTER lpTargetDevCharacter)
HCMTRANSFORM WINAPI CMCreateTransformExtW (LPLOGCOLORSPACEW lpColorSpace, LPDEVCHARACTER lpDevCharacter, LPDEVCHARACTER lpTargetDevCharacter, DWORD dwFlags)
HCMTRANSFORM WINAPI CMCreateTransformW (LPLOGCOLORSPACEW lpColorSpace, LPDEVCHARACTER lpDevCharacter, LPDEVCHARACTER lpTargetDevCharacter)
BOOL WINAPI CMDeleteTransform (HCMTRANSFORM hcmTransform)
BOOL WINAPI CMCreateProfile (LPLOGCOLORSPACEA lpColorSpace, LPBYTE *lpProfileData)
BOOL WINAPI CMCreateProfileW (LPLOGCOLORSPACEW lpColorSpace, LPBYTE *lpProfileData)
BOOL WINAPI CMCreateDeviceLinkProfile (LPHPROFILE lpahProfiles, DWORD nProfiles, DWORD *aIntentArr, DWORD nIntents, DWORD dwFlags, LPBYTE *lpProfileData)
BOOL WINAPI CMIsProfileValid (HPROFILE hProfile, LPBOOL lpbValid)
BOOL WINAPI CMTranslateColors (HCMTRANSFORM hcmTransform, LPCOLOR lpaInputColors, DWORD nColors, COLORTYPE ctInput, LPCOLOR lpaOutputColors, COLORTYPE ctOutput)
BOOL WINAPI CMCheckColors (HCMTRANSFORM hcmTransform, LPCOLOR lpaInputColors, DWORD nColors, COLORTYPE ctInput, LPBYTE lpaResult)
BOOL WINAPI CMTranslateRGBs (HCMTRANSFORM hcmTransform, LPVOID lpSrcBits, BMFORMAT bmInput, DWORD dwWidth, DWORD dwHeight, DWORD dwStride, LPVOID lpDestBits, BMFORMAT bmOutput, DWORD dwTranslateDirection)
BOOL WINAPI CMTranslateRGBsExt (HCMTRANSFORM hcmTransform, LPVOID lpSrcBits, BMFORMAT bmInput, DWORD dwWidth, DWORD dwHeight, DWORD dwInputStride, LPVOID lpDestBits, BMFORMAT bmOutput, DWORD dwOutputStride, LPBMCALLBACKFN lpfnCallback, LPARAM ulCallbackData)
BOOL WINAPI CMCheckRGBs (HCMTRANSFORM hcmTransform, LPVOID lpSrcBits, BMFORMAT bmInput, DWORD dwWidth, DWORD dwHeight, DWORD dwStride, LPBYTE lpDestBits, PBMCALLBACKFN pfnCallback, LPARAM ulCallbackData)
BOOL WINAPI CMTranslateRGB (HCMTRANSFORM hcmTransform, COLORREF colorRef, LPCOLORREF lpColorRef, DWORD dwFlags)
BOOL WINAPI CMCheckColorsInGamut (HCMTRANSFORM hcmTransform, RGBTRIPLE *lpaRGBTriplet, LPBYTE lpBuffer, UINT nCount)
BOOL WINAPI CMConvertColorNameToIndex (HPROFILE aProf, LPCOLOR_NAME aColorNameArr, LPDWORD aDWordArr, DWORD count)
BOOL WINAPI CMConvertIndexToColorName (HPROFILE aProf, LPDWORD aDWordArr, LPCOLOR_NAME aColorNameArr, DWORD count)
BOOL WINAPI CMGetNamedProfileInfo (HPROFILE aProf, LPNAMED_PROFILE_INFO Info)

Variables

long IndexTransform = 0
HCMTRANSFORM TheTransform [1000] = {0}
CRITICAL_SECTION GlobalCriticalSection


Define Documentation

#define CMM_DLL_VERSION   3
 

Definition at line 31 of file mscmm/icm32.c.

Referenced by CMGetInfo(), and GetCMMInfo().

#define CMM_DRIVER_LEVEL   2
 

Definition at line 30 of file mscmm/icm32.c.

Referenced by CMGetInfo().

#define CMM_IDENT   1
 

Definition at line 29 of file mscmm/icm32.c.

Referenced by CMGetInfo(), GetCMMInfo(), GetColorMatchingModule(), and ValidColorMatchingModule().

#define CMM_VERSION   4
 

Definition at line 32 of file mscmm/icm32.c.

Referenced by CMGetInfo(), GetColorMatchingModule(), and ValidColorMatchingModule().

#define CMM_WIN_VERSION   0
 

Definition at line 28 of file mscmm/icm32.c.

Referenced by CMGetInfo(), and GetCMMInfo().

#define CMS_LEVEL_1   1
 

Definition at line 33 of file mscmm/icm32.c.

#define DllExport   __declspec( dllexport )
 

Definition at line 88 of file mscmm/icm32.c.


Typedef Documentation

typedef HANDLE HCMTRANSFORM
 

Definition at line 35 of file mscmm/icm32.c.

Referenced by CMCreateMultiProfileTransform(), CMCreateTransform(), CMCreateTransformExt(), CMCreateTransformExtW(), CMCreateTransformW(), CMDeleteTransform(), CMGetTransform(), CMTranslateRGB(), CMTranslateRGBs(), and StoreTransform().

typedef LPVOID LPARGBQUAD
 

Definition at line 38 of file mscmm/icm32.c.

typedef COLORREF FAR* LPCOLORREF
 

Definition at line 39 of file mscmm/icm32.c.

typedef LPVOID LPDEVCHARACTER
 

Definition at line 36 of file mscmm/icm32.c.

typedef HANDLE* LPHPROFILE
 

Definition at line 37 of file mscmm/icm32.c.


Function Documentation

BOOL WINAPI CMCheckColors HCMTRANSFORM  hcmTransform,
LPCOLOR  lpaInputColors,
DWORD  nColors,
COLORTYPE  ctInput,
LPBYTE  lpaResult
 

Definition at line 1005 of file mscmm/icm32.c.

References BOOL, CMGetTransform(), and CWCheckColorsMS().

01010 { 01011 long matchErr; 01012 01013 matchErr = CWCheckColorsMS( CMGetTransform( hcmTransform ), (CMColor *)lpaInputColors, nColors, lpaResult ); 01014 if( matchErr ){ 01015 SetLastError( matchErr ); 01016 return 0; 01017 } 01018 return 1; 01019 }

BOOL WINAPI CMCheckColorsInGamut HCMTRANSFORM  hcmTransform,
RGBTRIPLE *  lpaRGBTriplet,
LPBYTE  lpBuffer,
UINT  nCount
 

Definition at line 1435 of file mscmm/icm32.c.

References BOOL, cm8PerChannelPacking, CMBitmapCallBackUPP, CMGetTransform(), cmRGBSpace, CWCheckBitmap(), FALSE, CMBitmap::height, CMBitmap::image, NULL, CMBitmap::pixelSize, CMBitmap::rowBytes, CMBitmap::space, and CMBitmap::width.

01439 { 01440 CMBitmap InBitmap,OutBitmap; 01441 long matchErr; 01442 BOOL aBgrMode = FALSE; 01443 01444 InBitmap.image = (char *)(lpaRGBTriplet); 01445 InBitmap.width = nCount; 01446 InBitmap.height = 1; 01447 InBitmap.rowBytes = 3*nCount; 01448 InBitmap.pixelSize = 24; 01449 InBitmap.space = cm8PerChannelPacking + cmRGBSpace; 01450 OutBitmap = InBitmap; 01451 OutBitmap.rowBytes = nCount; // perhaps wrong format? 01452 OutBitmap.pixelSize = 8; 01453 OutBitmap.image = (char *)lpBuffer; 01454 01455 matchErr = CWCheckBitmap( CMGetTransform( hcmTransform ), &InBitmap, 01456 (CMBitmapCallBackUPP)0,(void *)NULL,&OutBitmap ); 01457 if( matchErr ){ 01458 SetLastError( matchErr ); 01459 return 0; 01460 } 01461 return 1; 01462 }

BOOL WINAPI CMCheckRGBs HCMTRANSFORM  hcmTransform,
LPVOID  lpSrcBits,
BMFORMAT  bmInput,
DWORD  dwWidth,
DWORD  dwHeight,
DWORD  dwStride,
LPBYTE  lpDestBits,
PBMCALLBACKFN  pfnCallback,
LPARAM  ulCallbackData
 

Definition at line 1279 of file mscmm/icm32.c.

References BOOL, cm8PerChannelPacking, CMBitmapCallBackUPP, CMBitmapColorSpace, cmGamutResultSpace, CMGetDataColorSpace(), CMGetTransform(), cmGraySpace, cmInvalidColorSpace, CWCheckBitmap(), DWORD, FALSE, CMBitmap::height, CMBitmap::image, CMBitmap::pixelSize, CMBitmap::rowBytes, CMBitmap::space, and CMBitmap::width.

01289 { 01290 CMBitmapColorSpace spaceIn,spaceOut; 01291 CMBitmap InBitmap,OutBitmap; 01292 long matchErr, inPixelSize; 01293 BOOL aBgrMode = FALSE; 01294 01295 spaceIn = CMGetDataColorSpace( bmInput, &inPixelSize ); 01296 if( spaceIn == 0 ){ 01297 SetLastError( (DWORD)cmInvalidColorSpace ); 01298 return 0; 01299 } 01300 spaceOut = cm8PerChannelPacking + cmGraySpace; 01301 01302 if( spaceOut == 0 )return 0; 01303 InBitmap.image = lpSrcBits; 01304 InBitmap.width = dwWidth; 01305 InBitmap.height = dwHeight; 01306 if( dwStride == 0 ){ 01307 InBitmap.rowBytes = ( dwWidth * (inPixelSize / 8) + 3 ) & ~3; 01308 } 01309 else{ 01310 InBitmap.rowBytes = dwStride; 01311 } 01312 InBitmap.pixelSize = inPixelSize; 01313 InBitmap.space = spaceIn; 01314 01315 OutBitmap.image = lpDestBits; 01316 OutBitmap.width = dwWidth; 01317 OutBitmap.height = dwHeight; 01318 OutBitmap.rowBytes = dwWidth; // perhaps wrong format? 01319 OutBitmap.pixelSize = 8; 01320 OutBitmap.space = cmGamutResultSpace; 01321 01322 matchErr = CWCheckBitmap( CMGetTransform( hcmTransform ), &InBitmap, 01323 (CMBitmapCallBackUPP)pfnCallback,(void *)ulCallbackData,&OutBitmap ); 01324 01325 if( matchErr ){ 01326 SetLastError( matchErr ); 01327 return 0; 01328 } 01329 return 1; 01330 }

BOOL WINAPI CMConvertColorNameToIndex HPROFILE  aProf,
LPCOLOR_NAME  aColorNameArr,
LPDWORD  aDWordArr,
DWORD  count
 

Definition at line 1787 of file mscmm/icm32.c.

References BOOL, CMConvNameToIndexProfile(), and CMError.

01788 { 01789 CMError err; 01790 01791 err = CMConvNameToIndexProfile( aProf, aColorNameArr, aDWordArr, count ); 01792 if( err ){ 01793 SetLastError( err ); 01794 return 0; 01795 } 01796 return 1; 01797 }

BOOL WINAPI CMConvertIndexToColorName HPROFILE  aProf,
LPDWORD  aDWordArr,
LPCOLOR_NAME  aColorNameArr,
DWORD  count
 

Definition at line 1799 of file mscmm/icm32.c.

References BOOL, and CMConvIndexToNameProfile().

01800 { 01801 long matchErr; 01802 01803 matchErr = CMConvIndexToNameProfile( aProf, aDWordArr, aColorNameArr, count ); 01804 if( matchErr ){ 01805 SetLastError( matchErr ); 01806 return 0; 01807 } 01808 return 1; 01809 }

BOOL WINAPI CMCreateDeviceLinkProfile LPHPROFILE  lpahProfiles,
DWORD  nProfiles,
DWORD aIntentArr,
DWORD  nIntents,
DWORD  dwFlags,
LPBYTE *  lpProfileData
 

Definition at line 812 of file mscmm/icm32.c.

References BOOL, CMConcatProfileSet, CMCreateMultiProfileTransformInternal(), CMMModelPtr, CMProfileRef, CMWorldRef, CMConcatProfileSet::count, CWDisposeColorWorld(), DeviceLinkFill(), DisposeIfPtr(), dwFlags, DWORD, CMConcatProfileSet::keyIndex, OSErr, CMConcatProfileSet::profileSet, Ptr, SmartNewPtrClear(), and UINT32.

00818 { 00819 long err; 00820 OSErr aOSErr; 00821 CMWorldRef cw; 00822 CMConcatProfileSet *profileSet; 00823 UINT32 i; 00824 00825 *lpProfileData = 0; 00826 00827 err = CMCreateMultiProfileTransformInternal( &cw, lpahProfiles, nProfiles, aIntentArr, nIntents, dwFlags, 0 ); 00828 if( err ){ 00829 SetLastError( err ); 00830 return 0; 00831 } 00832 profileSet = (CMConcatProfileSet *)SmartNewPtrClear(sizeof (CMConcatProfileSet) + (nProfiles)* sizeof(CMProfileRef),&aOSErr); 00833 err = aOSErr; 00834 if (aOSErr == 0 ) 00835 { 00836 profileSet->keyIndex = 0; 00837 profileSet->count = (unsigned short)nProfiles; 00838 for( i=0; i<nProfiles; i++) 00839 profileSet->profileSet[i] = (CMProfileRef)((DWORD *)(((PVOID *)lpahProfiles)[i])); 00840 } 00841 else goto CleanupAndExit; 00842 00843 err = DeviceLinkFill( (CMMModelPtr)cw, profileSet, (icProfile **)lpProfileData, aIntentArr[0] ); 00844 profileSet= (CMConcatProfileSet *)DisposeIfPtr( (Ptr) profileSet ); 00845 00846 if( err )goto CleanupAndExit; 00847 CWDisposeColorWorld ( cw ); 00848 return 1; 00849 00850 CleanupAndExit: 00851 CWDisposeColorWorld ( cw ); 00852 SetLastError( err ); 00853 return 0; 00854 }

HCMTRANSFORM WINAPI CMCreateMultiProfileTransform LPHPROFILE  lpahProfiles,
DWORD  nProfiles,
DWORD aIntentArr,
DWORD  nIntents,
DWORD  dwFlags
 

Definition at line 626 of file mscmm/icm32.c.

References CMCreateMultiProfileTransformInternal(), CMWorldRef, dwFlags, HCMTRANSFORM, and StoreTransform().

00631 { 00632 long err; 00633 CMWorldRef cw; 00634 00635 err = CMCreateMultiProfileTransformInternal( &cw, lpahProfiles, nProfiles, aIntentArr, nIntents, dwFlags, 0 ); 00636 if( err ){ 00637 SetLastError( err ); 00638 return (HCMTRANSFORM)(ULONG_PTR)(err & 255); 00639 } 00640 cw = StoreTransform( cw ); 00641 return (HCMTRANSFORM)cw; 00642 }

long CMCreateMultiProfileTransformInternal CMWorldRef cw,
LPHPROFILE  lpahProfiles,
DWORD  nProfiles,
DWORD aIntentArr,
DWORD  nIntents,
DWORD  dwFlags,
DWORD  dwCreateLink
 

Definition at line 516 of file mscmm/icm32.c.

References cmBestMode, CMConcatProfileSet, cmDraftMode, cmNormalMode, CMProfileRef, CMConcatProfileSet::count, CWConcatColorWorld4MS(), DisposeIfPtr(), dwFlags, DWORD, icAbsoluteColorimetric, icPerceptual, icRelativeColorimetric, kCreateGamutLutMask, CMConcatProfileSet::keyIndex, kLookupOnlyMask, kUseRelColorimetric, MyNewDeviceLink(), OSErr, CMConcatProfileSet::profileSet, Ptr, SmartNewPtrClear(), and UINT32.

00523 { 00524 CMConcatProfileSet *profileSet; 00525 OSErr aOSErr; 00526 DWORD i; 00527 long err; 00528 UINT32 theFlags; 00529 UINT32 *arrIntents = 0;; 00530 00531 profileSet = (CMConcatProfileSet *)SmartNewPtrClear( sizeof (CMConcatProfileSet) + (nProfiles)* sizeof(CMProfileRef), &aOSErr ); 00532 if (aOSErr == 0 ) 00533 { 00534 profileSet->keyIndex = 0; 00535 profileSet->count = (unsigned short)nProfiles; 00536 for( i=0; i<nProfiles; i++) 00537 profileSet->profileSet[i] = (CMProfileRef)((DWORD *)(((PVOID *)lpahProfiles)[i])); 00538 } 00539 else return ERROR_NOT_ENOUGH_MEMORY; 00540 00541 switch( dwFlags & 0xffff ){ 00542 case BEST_MODE: 00543 theFlags = cmBestMode; 00544 break; 00545 case PROOF_MODE: 00546 theFlags = cmDraftMode; 00547 break; 00548 default: 00549 theFlags = cmNormalMode; 00550 break; 00551 } 00552 if( ! (dwFlags & ENABLE_GAMUT_CHECKING) ){ 00553 theFlags |= kCreateGamutLutMask; 00554 } 00555 if( dwFlags & USE_RELATIVE_COLORIMETRIC ){ 00556 theFlags |= kUseRelColorimetric; 00557 } 00558 if( dwFlags & FAST_TRANSLATE ){ 00559 theFlags |= kLookupOnlyMask; 00560 } 00561 if( nProfiles > 1 && nIntents == 1 ){ 00562 arrIntents = (UINT32 *)SmartNewPtrClear( nProfiles * sizeof (UINT32), &aOSErr); 00563 if (aOSErr != 0 ){ 00564 err = ERROR_NOT_ENOUGH_MEMORY; 00565 goto CleanupAndExit; 00566 } 00567 arrIntents[0] = icPerceptual; 00568 arrIntents[1] = aIntentArr[0]; 00569 for( i=2; i<nProfiles; i++){ 00570 arrIntents[i] = icAbsoluteColorimetric; 00571 if( dwFlags & kUseRelColorimetric ) arrIntents[i] = icRelativeColorimetric; 00572 } 00573 err = CWConcatColorWorld4MS( cw, profileSet, arrIntents, nProfiles, theFlags ); 00574 arrIntents= (UINT32 *)DisposeIfPtr( (Ptr) arrIntents ); 00575 } 00576 else{ 00577 err = CWConcatColorWorld4MS( cw, profileSet, aIntentArr, nIntents, theFlags ); 00578 } 00579 #ifdef WRITE_PROFILE 00580 if( err == 0 ){ 00581 err = MyNewDeviceLink( *cw, profileSet, "MyCreateTransform.pf" ); 00582 //goto CleanupAndExit; 00583 } 00584 #endif 00585 CleanupAndExit: 00586 profileSet= (CMConcatProfileSet *)DisposeIfPtr( (Ptr) profileSet ); 00587 return err; 00588 }

BOOL WINAPI CMCreateProfile LPLOGCOLORSPACEA  lpColorSpace,
LPBYTE *  lpProfileData
 

Definition at line 712 of file mscmm/icm32.c.

References BOOL, CMWorldRef, and MyNewAbstract().

Referenced by CMCreateTransformExt().

00714 { 00715 CMWorldRef cw=0; 00716 long err; 00717 00718 if( lpColorSpace->lcsFilename[0] ) return 0; 00719 err = MyNewAbstract( lpColorSpace, (icProfile **)lpProfileData ); 00720 //err = FillProfileFromLog( lpColorSpace, &theProf ); 00721 if( err ){ 00722 SetLastError( err ); 00723 goto CleanupAndExit; 00724 } 00725 return 1; 00726 CleanupAndExit: 00727 return 0; 00728 }

BOOL WINAPI CMCreateProfile LPLOGCOLORSPACEA  lpColorSpace,
LPDEVCHARACTER lpProfileData
 

BOOL WINAPI CMCreateProfileW LPLOGCOLORSPACEW  lpColorSpace,
LPBYTE *  lpProfileData
 

Definition at line 751 of file mscmm/icm32.c.

References BOOL, CMWorldRef, and MyNewAbstractW().

00753 { 00754 CMWorldRef cw=0; 00755 long err; 00756 00757 if( lpColorSpace->lcsFilename[0] ) return 0; 00758 err = MyNewAbstractW( lpColorSpace, (icProfile **)lpProfileData ); 00759 //err = FillProfileFromLogW( lpColorSpace, &theProf ); 00760 if( err ){ 00761 SetLastError( err ); 00762 goto CleanupAndExit; 00763 } 00764 return 1; 00765 CleanupAndExit: 00766 return 0; 00767 }

HCMTRANSFORM WINAPI CMCreateTransform LPLOGCOLORSPACEA  lpColorSpace,
LPDEVCHARACTER  lpDevCharacter,
LPDEVCHARACTER  lpTargetDevCharacter
 

Definition at line 410 of file mscmm/icm32.c.

References CMCreateTransformExt(), and HCMTRANSFORM.

00413 { 00414 return CMCreateTransformExt( lpColorSpace, lpDevCharacter, lpTargetDevCharacter, PROOF_MODE | ENABLE_GAMUT_CHECKING | 0x80000000 ); 00415 }

HCMTRANSFORM WINAPI CMCreateTransformExt LPLOGCOLORSPACEA  lpColorSpace,
LPDEVCHARACTER  lpDevCharacter,
LPDEVCHARACTER  lpTargetDevCharacter,
DWORD  dwFlags
 

Definition at line 282 of file mscmm/icm32.c.

References BOOL, CloseColorProfile(), CMCreateProfile(), CMCreateTransformExtInternal(), CMWorldRef, dwFlags, DWORD, FillProfileFromLog(), HCMTRANSFORM, OPEN_EXISTING, pd, and WriteProf().

00286 { 00287 CMWorldRef cw=0; 00288 long err; 00289 LPBYTE pt,pd, ptDeRef, pdDeRef; 00290 HPROFILE aProf; 00291 PROFILE theProf; 00292 BOOL bWin95; 00293 OSVERSIONINFO osvi; 00294 00295 #if 0 /* Test for CMCreateProfile */ 00296 CMCreateProfile( lpColorSpace, &pt ); 00297 err = *(long *)pt; 00298 SwapLong(&err); 00299 WriteProf( "CMCreateProfile.icc", (icProfile *)pt, err ); 00300 GlobalFreePtr( pt ); 00301 #endif 00302 00303 00304 err = FillProfileFromLog( lpColorSpace, &theProf ); 00305 if( err ){ 00306 SetLastError( err ); 00307 goto CleanupAndExit; 00308 } 00309 aProf = OpenColorProfile(&theProf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING ); 00310 if( !aProf ){ 00311 err = GetLastError(); 00312 goto CleanupAndExit; 00313 } 00314 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 00315 GetVersionEx(&osvi); 00316 bWin95 = osvi.dwMajorVersion == 4 && 00317 osvi.dwMinorVersion == 0 && 00318 osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS; 00319 00320 if (bWin95) 00321 { 00322 PROFILE myProf; 00323 DWORD l; 00324 00325 // 00326 // Handles are not provided below LCS structure, so create handles 00327 // 00328 00329 myProf.dwType = PROFILE_MEMBUFFER; 00330 myProf.pProfileData = lpDevCharacter; 00331 l = *(DWORD *)(myProf.pProfileData); 00332 myProf.cbDataSize = SwapLong(&l); 00333 pdDeRef = OpenColorProfile(&myProf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING ); 00334 if( !pdDeRef ){ 00335 err = GetLastError(); 00336 goto CleanupAndExit; 00337 } 00338 00339 ptDeRef = 0; 00340 if (lpTargetDevCharacter) 00341 { 00342 myProf.dwType = PROFILE_MEMBUFFER; 00343 myProf.pProfileData = lpTargetDevCharacter; 00344 l = *(DWORD *)(myProf.pProfileData); 00345 myProf.cbDataSize = SwapLong(&l); 00346 ptDeRef = OpenColorProfile(&myProf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING ); 00347 if( !ptDeRef ){ 00348 err = GetLastError(); 00349 goto CleanupAndExit; 00350 } 00351 } 00352 } 00353 else 00354 { 00355 pd = ((LPBYTE)lpColorSpace+sizeof(LOGCOLORSPACEA)); 00356 pdDeRef= (LPBYTE)*(PULONG_PTR)pd; 00357 00358 pt = ((LPBYTE)lpColorSpace+sizeof(LOGCOLORSPACEA)+sizeof(HPROFILE)); 00359 ptDeRef= (LPBYTE)*(PULONG_PTR)pt; 00360 } 00361 00362 err = CMCreateTransformExtInternal( &cw, dwFlags, 00363 lpColorSpace->lcsIntent, aProf, ptDeRef, pdDeRef ); 00364 00365 CleanupAndExit: 00366 if( lpColorSpace->lcsFilename[0] == 0 ){ 00367 if( theProf.pProfileData )GlobalFreePtr( theProf.pProfileData ); 00368 theProf.pProfileData = 0; 00369 } 00370 if (bWin95) 00371 { 00372 if (pdDeRef) 00373 { 00374 CloseColorProfile(pdDeRef); 00375 } 00376 if (ptDeRef) 00377 { 00378 CloseColorProfile(ptDeRef); 00379 } 00380 } 00381 if( err ){ 00382 return (HCMTRANSFORM)(ULONG_PTR)(err & 255); 00383 } 00384 return (HCMTRANSFORM)cw; 00385 }

long CMCreateTransformExtInternal CMWorldRef cwOut,
UINT32  dwFlags,
UINT32  lcsIntent,
HPROFILE  aProf,
LPBYTE  ptDeRef,
LPBYTE  pdDeRef
 

Definition at line 167 of file mscmm/icm32.c.

References CloseColorProfile(), CMCreateMultiProfileTransformInternal(), CMMModelPtr, CMWorldRef, CWDisposeColorWorld(), DATA_2_PTR, dwFlags, icAbsoluteColorimetric, icPerceptual, icRelativeColorimetric, icSaturation, LCS_GM_BUSINESS, LCS_GM_GRAPHICS, LOCK_DATA, StoreTransform(), UINT32, and UNLOCK_DATA.

00173 { 00174 CMWorldRef cw=0; 00175 CMWorldRef cw2=0; 00176 long err; 00177 HPROFILE saveProf; 00178 HPROFILE hArray[3]; 00179 UINT32 aIntent[3]; 00180 UINT32 aUINT32,count; 00181 CMMModelPtr theModelPtr; 00182 00183 *cwOut = 0; 00184 aIntent[0] = icRelativeColorimetric; 00185 switch( lcsIntent ){ 00186 case LCS_GM_BUSINESS: 00187 aIntent[1] = icSaturation; 00188 break; 00189 case LCS_GM_GRAPHICS: 00190 aIntent[1] = icRelativeColorimetric; 00191 break; 00192 case LCS_GM_ABS_COLORIMETRIC: 00193 aIntent[1] = icAbsoluteColorimetric; 00194 break; 00195 default: 00196 aIntent[1] = icPerceptual; 00197 break; 00198 } 00199 if( ptDeRef == 0 ){ 00200 count = 2; 00201 hArray[0] = aProf; 00202 hArray[1] = pdDeRef; 00203 } 00204 else{ 00205 count = 3; 00206 hArray[0] = aProf; 00207 hArray[1] = ptDeRef; 00208 hArray[2] = pdDeRef; 00209 if( dwFlags & USE_RELATIVE_COLORIMETRIC )aIntent[2] = INTENT_RELATIVE_COLORIMETRIC; 00210 else aIntent[2] = INTENT_ABSOLUTE_COLORIMETRIC; 00211 } 00212 00213 err = CMCreateMultiProfileTransformInternal( &cw, hArray, count, aIntent, count, dwFlags, 0 ); 00214 if( err ){ 00215 goto CleanupAndExit; 00216 } 00217 if( dwFlags & 0x80000000 ){ /* this is for the backward transform */ 00218 count--; 00219 saveProf = hArray[count]; 00220 hArray[count] = hArray[0]; 00221 hArray[0] = saveProf; 00222 aUINT32 = aIntent[count]; 00223 aIntent[count] = aIntent[0]; 00224 aIntent[0] = aUINT32; 00225 00226 count++; 00227 err = CMCreateMultiProfileTransformInternal( &cw2, hArray, count, aIntent, count, dwFlags, 0 ); 00228 if( err ){ 00229 CWDisposeColorWorld( cw ); /* delete other cw */ 00230 goto CleanupAndExit; 00231 } 00232 LOCK_DATA( cw ); 00233 theModelPtr = (CMMModelPtr)(DATA_2_PTR( cw )); 00234 theModelPtr->pBackwardTransform = cw2; 00235 UNLOCK_DATA( aTrans ); 00236 } 00237 00238 CleanupAndExit: 00239 CloseColorProfile( aProf ); 00240 if( err ){ 00241 SetLastError( err ); 00242 cw = (CMWorldRef)(ULONG_PTR)(err & 255); 00243 } 00244 else{ 00245 cw = StoreTransform( cw ); 00246 } 00247 *cwOut = cw; 00248 return 0; 00249 }

HCMTRANSFORM WINAPI CMCreateTransformExtW LPLOGCOLORSPACEW  lpColorSpace,
LPDEVCHARACTER  lpDevCharacter,
LPDEVCHARACTER  lpTargetDevCharacter,
DWORD  dwFlags
 

Definition at line 446 of file mscmm/icm32.c.

References CMCreateTransformExtInternal(), CMWorldRef, dwFlags, FillProfileFromLogW(), HCMTRANSFORM, OPEN_EXISTING, OpenColorProfileW(), and pd.

00450 { 00451 CMWorldRef cw=0; 00452 long err; 00453 LPBYTE pt,pd, ptDeRef, pdDeRef; 00454 HPROFILE aProf; 00455 PROFILE theProf; 00456 00457 err = FillProfileFromLogW( lpColorSpace, &theProf ); 00458 if( err ){ 00459 SetLastError( err ); 00460 goto CleanupAndExit; 00461 } 00462 aProf = OpenColorProfileW(&theProf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING ); 00463 if( !aProf ){ 00464 err = GetLastError(); 00465 goto CleanupAndExit; 00466 } 00467 pd = ((LPBYTE)lpColorSpace+sizeof(LOGCOLORSPACEW)); 00468 pdDeRef= (LPBYTE)*(PULONG_PTR)pd; 00469 00470 pt = ((LPBYTE)lpColorSpace+sizeof(LOGCOLORSPACEW)+sizeof(HPROFILE)); 00471 ptDeRef= (LPBYTE)*(PULONG_PTR)pt; 00472 00473 err = CMCreateTransformExtInternal( &cw, dwFlags, 00474 lpColorSpace->lcsIntent, aProf, ptDeRef, pdDeRef ); 00475 00476 CleanupAndExit: 00477 if( lpColorSpace->lcsFilename[0] == 0 ){ 00478 if( theProf.pProfileData )GlobalFreePtr( theProf.pProfileData ); 00479 theProf.pProfileData = 0; 00480 } 00481 if( err ){ 00482 return (HCMTRANSFORM)(ULONG_PTR)(err & 255); 00483 } 00484 return (HCMTRANSFORM)cw; 00485 }

HCMTRANSFORM WINAPI CMCreateTransformW LPLOGCOLORSPACEW  lpColorSpace,
LPDEVCHARACTER  lpDevCharacter,
LPDEVCHARACTER  lpTargetDevCharacter
 

Definition at line 509 of file mscmm/icm32.c.

References CMCreateTransformExtW(), and HCMTRANSFORM.

00512 { 00513 return CMCreateTransformExtW( lpColorSpace, lpDevCharacter, lpTargetDevCharacter, PROOF_MODE | ENABLE_GAMUT_CHECKING ); 00514 }

BOOL WINAPI CMDeleteTransform HCMTRANSFORM  hcmTransform  ) 
 

Definition at line 658 of file mscmm/icm32.c.

References BOOL, CMMModelPtr, CMWorldRef, CWDisposeColorWorld(), DATA_2_PTR, GlobalCriticalSection, HCMTRANSFORM, IndexTransform, LOCK_DATA, NULL, TheTransform, and UNLOCK_DATA.

00659 { 00660 long actTransform = (long)(ULONG_PTR)hcmTransform - 256; 00661 HCMTRANSFORM aTrans = NULL; 00662 CMMModelPtr theModelPtr; 00663 CMWorldRef theWorldRef; 00664 BOOL bReturn = 0; 00665 00666 __try { 00667 EnterCriticalSection(&GlobalCriticalSection); 00668 if( actTransform < IndexTransform && actTransform >= 0 ){ 00669 aTrans = TheTransform[actTransform]; 00670 TheTransform[ actTransform ] = 0; 00671 if( actTransform == IndexTransform-1 )IndexTransform--; 00672 bReturn = 1; 00673 } 00674 } 00675 __finally{ 00676 LeaveCriticalSection(&GlobalCriticalSection); 00677 00678 LOCK_DATA( aTrans ); 00679 theModelPtr = (CMMModelPtr)(DATA_2_PTR( aTrans )); 00680 theWorldRef = theModelPtr->pBackwardTransform; 00681 UNLOCK_DATA( aTrans ); 00682 if( theWorldRef != 0 ){ 00683 CWDisposeColorWorld( theWorldRef ); 00684 } 00685 00686 CWDisposeColorWorld( aTrans ); 00687 } 00688 return bReturn; 00689 }

CMBitmapColorSpace CMGetDataColorSpace BMFORMAT  c,
long *  pixelSize
 

Definition at line 1557 of file mscmm/icm32.c.

References cm16PerChannelPacking, cm8PerChannelPacking, cmBGR32Space, cmBGRSpace, CMBitmapColorSpace, cmCMYKSpace, cmGenericSpace, cmGraySpace, cmKYMCSpace, cmLABSpace, cmLong10ColorPacking, cmLong8ColorPacking, cmMCEight8Space, cmMCFive8Space, cmMCSeven8Space, cmMCSix8Space, cmNamedIndexed32Space, cmRGBA32Space, cmRGBSpace, cmWord565ColorPacking, cmWord5ColorPacking, cmXYZSpace, and cmYXYSpace.

01558 { 01559 switch( bmMode ){ 01560 case BM_565RGB: 01561 *pixelSize = 16; 01562 return cmWord565ColorPacking + cmRGBSpace; 01563 break; 01564 case BM_x555RGB: 01565 *pixelSize = 16; 01566 return cmWord5ColorPacking + cmRGBSpace; 01567 break; 01568 case BM_x555XYZ: 01569 *pixelSize = 16; 01570 return cmWord5ColorPacking + cmXYZSpace; 01571 break; 01572 case BM_x555Yxy: 01573 *pixelSize = 16; 01574 return cmWord5ColorPacking + cmYXYSpace; 01575 break; 01576 case BM_x555Lab: 01577 *pixelSize = 16; 01578 return cmWord5ColorPacking + cmLABSpace; 01579 break; 01580 case BM_x555G3CH: 01581 *pixelSize = 16; 01582 return cmWord5ColorPacking + cmGenericSpace; 01583 break; 01584 case BM_RGBTRIPLETS: 01585 *pixelSize = 24; 01586 return cm8PerChannelPacking + cmBGRSpace; 01587 break; 01588 case BM_BGRTRIPLETS: 01589 *pixelSize = 24; 01590 return cm8PerChannelPacking + cmRGBSpace; 01591 break; 01592 case BM_XYZTRIPLETS: 01593 *pixelSize = 24; 01594 return cm8PerChannelPacking + cmXYZSpace; 01595 break; 01596 case BM_YxyTRIPLETS: 01597 *pixelSize = 24; 01598 return cm8PerChannelPacking + cmYXYSpace; 01599 break; 01600 case BM_LabTRIPLETS: 01601 *pixelSize = 24; 01602 return cm8PerChannelPacking + cmLABSpace; 01603 break; 01604 case BM_G3CHTRIPLETS: 01605 *pixelSize = 24; 01606 return cm8PerChannelPacking + cmGenericSpace; 01607 break; 01608 case BM_5CHANNEL: 01609 *pixelSize = 40; 01610 return cmMCFive8Space; 01611 break; 01612 case BM_6CHANNEL: 01613 *pixelSize = 48; 01614 return cmMCSix8Space; 01615 break; 01616 case BM_7CHANNEL: 01617 *pixelSize = 56; 01618 return cmMCSeven8Space; 01619 break; 01620 case BM_8CHANNEL: 01621 *pixelSize = 64; 01622 return cmMCEight8Space; 01623 break; 01624 case BM_GRAY: 01625 *pixelSize = 8; 01626 return cm8PerChannelPacking + cmGraySpace; 01627 break; 01628 case BM_xRGBQUADS: 01629 *pixelSize = 32; 01630 return cmBGR32Space; 01631 break; 01632 case BM_xBGRQUADS: 01633 *pixelSize = 32; 01634 return cmRGBA32Space; 01635 break; 01636 #if 0 01637 case BM_xXYZQUADS: 01638 *pixelSize = 32; 01639 return cmLong8ColorPacking + cmXYZSpace; 01640 break; 01641 case BM_xYxyQUADS: 01642 *pixelSize = 32; 01643 return cmLong8ColorPacking + cmYXYSpace; 01644 break; 01645 case BM_xLabQUADS: 01646 *pixelSize = 32; 01647 return cmLong8ColorPacking + cmLABSpace; 01648 break; 01649 #endif 01650 case BM_xG3CHQUADS: 01651 *pixelSize = 32; 01652 return cmLong8ColorPacking + cmGenericSpace; 01653 break; 01654 case BM_CMYKQUADS: 01655 *pixelSize = 32; 01656 return cmLong8ColorPacking + cmKYMCSpace; 01657 break; 01658 case BM_KYMCQUADS: 01659 *pixelSize = 32; 01660 return cmLong8ColorPacking + cmCMYKSpace; 01661 break; 01662 case BM_10b_RGB: 01663 *pixelSize = 32; 01664 return cmLong10ColorPacking + cmRGBSpace; 01665 break; 01666 case BM_10b_XYZ: 01667 *pixelSize = 32; 01668 return cmLong10ColorPacking + cmXYZSpace; 01669 break; 01670 case BM_10b_Yxy: 01671 *pixelSize = 32; 01672 return cmLong10ColorPacking + cmYXYSpace; 01673 break; 01674 case BM_10b_Lab: 01675 *pixelSize = 32; 01676 return cmLong10ColorPacking + cmLABSpace; 01677 break; 01678 case BM_10b_G3CH: 01679 *pixelSize = 32; 01680 return cmLong10ColorPacking + cmGenericSpace; 01681 break; 01682 case BM_16b_RGB: 01683 *pixelSize = 48; 01684 return cm16PerChannelPacking + cmBGRSpace; 01685 break; 01686 case BM_16b_XYZ: 01687 *pixelSize = 48; 01688 return cm16PerChannelPacking + cmXYZSpace; 01689 break; 01690 case BM_16b_Yxy: 01691 *pixelSize = 48; 01692 return cm16PerChannelPacking + cmYXYSpace; 01693 break; 01694 case BM_16b_Lab: 01695 *pixelSize = 48; 01696 return cm16PerChannelPacking + cmLABSpace; 01697 break; 01698 case BM_16b_G3CH: 01699 *pixelSize = 48; 01700 return cm16PerChannelPacking + cmGenericSpace; 01701 break; 01702 case BM_16b_GRAY: 01703 *pixelSize = 16; 01704 return cmGraySpace; 01705 break; 01706 case BM_NAMED_INDEX: 01707 *pixelSize = 32; 01708 return cmNamedIndexed32Space; 01709 break; 01710 default: 01711 *pixelSize = 0; 01712 return 0; 01713 } 01714 }

DWORD WINAPI CMGetInfo DWORD  dwInfo  ) 
 

Definition at line 134 of file mscmm/icm32.c.

References CMM_DLL_VERSION, CMM_DRIVER_LEVEL, CMM_IDENT, CMM_VERSION, CMM_WIN_VERSION, CMS_LEVEL_1, and DWORD.

00135 { 00136 DWORD ret = 0; 00137 switch( dwInfo ){ 00138 case CMM_VERSION: 00139 ret = 0x00050000; 00140 break; 00141 case CMM_WIN_VERSION: 00142 ret = 0x00040000; 00143 break; 00144 case CMM_DLL_VERSION: 00145 ret = 0x00010000; 00146 break; 00147 case CMM_IDENT: 00148 ret = 'Win '; 00149 break; 00150 case CMM_LOGOICON: 00151 ret = 100; 00152 break; 00153 case CMM_DESCRIPTION: 00154 ret = 100; 00155 break; 00156 case CMM_DRIVER_LEVEL: 00157 ret = CMS_LEVEL_1; 00158 break; 00159 default: 00160 ret = 0; 00161 break; 00162 } 00163 return ret; 00164 }

BOOL WINAPI CMGetNamedProfileInfo HPROFILE  aProf,
LPNAMED_PROFILE_INFO  Info
 

Definition at line 1811 of file mscmm/icm32.c.

References BOOL, CMGetNamedProfileInfoProfile(), and pCMNamedProfileInfo.

01812 { 01813 long matchErr; 01814 01815 matchErr = CMGetNamedProfileInfoProfile( aProf, (pCMNamedProfileInfo)Info ); 01816 if( matchErr ){ 01817 SetLastError( matchErr ); 01818 return 0; 01819 } 01820 return 1; 01821 }

HCMTRANSFORM WINAPI CMGetTransform HCMTRANSFORM  hcmTransform  ) 
 

Definition at line 1729 of file mscmm/icm32.c.

References GlobalCriticalSection, HCMTRANSFORM, NULL, and TheTransform.

01730 { 01731 long actTransform = (long)(ULONG_PTR)hcmTransform - 256; 01732 HCMTRANSFORM aTrans = NULL; 01733 01734 __try { 01735 EnterCriticalSection(&GlobalCriticalSection); 01736 if( actTransform < IndexTransform && actTransform >= 0 ){ 01737 aTrans = TheTransform[actTransform]; 01738 } 01739 } 01740 __finally{ 01741 LeaveCriticalSection(&GlobalCriticalSection); 01742 } 01743 return aTrans; 01744 }

BOOL WINAPI CMIsProfileValid HPROFILE  hProfile,
LPBOOL  lpbValid
 

Definition at line 918 of file mscmm/icm32.c.

References BOOL, Boolean, CMProfileRef, and CMValidateProfile().

00921 { 00922 Boolean valid; 00923 00924 CMValidateProfile( (CMProfileRef)hProfile, &valid ); 00925 00926 *lpbValid = valid; 00927 return valid; 00928 }

BOOL WINAPI CMTranslateColors HCMTRANSFORM  hcmTransform,
LPCOLOR  lpaInputColors,
DWORD  nColors,
COLORTYPE  ctInput,
LPCOLOR  lpaOutputColors,
COLORTYPE  ctOutput
 

Definition at line 955 of file mscmm/icm32.c.

References BOOL, CMGetTransform(), CWMatchColors(), and DWORD.

00961 { 00962 long matchErr; 00963 DWORD i; 00964 00965 if (lpaOutputColors != lpaInputColors){ 00966 for( i=0; i<nColors; i++) lpaOutputColors[ i ] = lpaInputColors[ i ]; 00967 } 00968 00969 matchErr = CWMatchColors( CMGetTransform( hcmTransform ), (CMColor *)lpaOutputColors, nColors ); 00970 if( matchErr ){ 00971 SetLastError( matchErr ); 00972 return 0; 00973 } 00974 return 1; 00975 }

BOOL WINAPI CMTranslateRGB HCMTRANSFORM  hcmTransform,
COLORREF  colorRef,
LPCOLORREF  lpColorRef,
DWORD  dwFlags
 

Definition at line 1356 of file mscmm/icm32.c.

References BOOL, CMBitmapCallBackUPP, CMBitmapColorSpace, CMGetTransform(), cmKYMC32Space, CMMModelPtr, cmparamErr, cmRGBA32Space, CMS_BACKWARD, CMWorldRef, CWGetColorSpaces(), CWMatchBitmap(), DATA_2_PTR, dwFlags, DWORD, FALSE, HCMTRANSFORM, CMBitmap::height, icSigCmykData, CMBitmap::image, LOCK_DATA, NULL, CMBitmap::pixelSize, CMBitmap::rowBytes, CMBitmap::space, UNLOCK_DATA, and CMBitmap::width.

01361 { 01362 CMBitmapColorSpace spaceIn; 01363 CMBitmap InBitmap,OutBitmap; 01364 long matchErr; 01365 COLORREF aColorRef = colorRef; 01366 BOOL aBgrMode = FALSE; 01367 CMBitmapColorSpace In,Out; 01368 CMMModelPtr theModelPtr; 01369 CMWorldRef theWorldRef; 01370 HCMTRANSFORM theTransform = CMGetTransform( hcmTransform ); 01371 01372 if( dwFlags == CMS_BACKWARD ){ 01373 if( theTransform == 0 ){ 01374 SetLastError( (DWORD)cmparamErr ); 01375 return 0; 01376 } 01377 LOCK_DATA( theTransform ); 01378 theModelPtr = (CMMModelPtr)(DATA_2_PTR( theTransform )); 01379 theWorldRef = theModelPtr->pBackwardTransform; 01380 UNLOCK_DATA( theTransform ); 01381 if( theWorldRef == 0 ){ 01382 SetLastError( (DWORD)cmparamErr ); 01383 return 0; 01384 } 01385 theTransform = (HCMTRANSFORM)theWorldRef; 01386 } 01387 01388 spaceIn = cmRGBA32Space; 01389 InBitmap.image = (char *)(&aColorRef); 01390 InBitmap.width = 1; 01391 InBitmap.height = 1; 01392 InBitmap.rowBytes = 4; 01393 InBitmap.pixelSize = 32; 01394 InBitmap.space = spaceIn; 01395 OutBitmap = InBitmap; 01396 OutBitmap.image = (char *)lpColorRef; 01397 01398 matchErr = CWGetColorSpaces( theTransform, &In, &Out ); 01399 if( matchErr ){ 01400 SetLastError( matchErr ); 01401 return 0; 01402 } 01403 if( Out == icSigCmykData ) OutBitmap.space = cmKYMC32Space; 01404 matchErr = CWMatchBitmap( theTransform, &InBitmap, 01405 (CMBitmapCallBackUPP)0,(void *)NULL,&OutBitmap ); 01406 if( matchErr ){ 01407 SetLastError( matchErr ); 01408 return 0; 01409 } 01410 return 1; 01411 }

BOOL WINAPI CMTranslateRGBs HCMTRANSFORM  hcmTransform,
LPVOID  lpSrcBits,
BMFORMAT  bmInput,
DWORD  dwWidth,
DWORD  dwHeight,
DWORD  dwStride,
LPVOID  lpDestBits,
BMFORMAT  bmOutput,
DWORD  dwTranslateDirection
 

Definition at line 1054 of file mscmm/icm32.c.

References BOOL, CMBitmapCallBackUPP, CMBitmapColorSpace, CMGetDataColorSpace(), CMGetTransform(), cmInvalidColorSpace, CMMModelPtr, cmparamErr, CMS_BACKWARD, CMWorldRef, CWMatchBitmap(), DATA_2_PTR, DWORD, FALSE, HCMTRANSFORM, CMBitmap::height, CMBitmap::image, LOCK_DATA, NULL, CMBitmap::pixelSize, CMBitmap::rowBytes, CMBitmap::space, UNLOCK_DATA, and CMBitmap::width.

01063 { 01064 CMBitmapColorSpace spaceIn,spaceOut; 01065 CMBitmap InBitmap,OutBitmap; 01066 long matchErr, inPixelSize, outPixelSize; 01067 BOOL aBgrMode = FALSE; 01068 CMMModelPtr theModelPtr; 01069 CMWorldRef theWorldRef; 01070 HCMTRANSFORM theTransform = CMGetTransform( hcmTransform ); 01071 01072 if( dwTranslateDirection == CMS_BACKWARD ){ 01073 if( theTransform == 0 ){ 01074 SetLastError( (DWORD)cmparamErr ); 01075 return 0; 01076 } 01077 LOCK_DATA( theTransform ); 01078 theModelPtr = (CMMModelPtr)(DATA_2_PTR( theTransform )); 01079 theWorldRef = theModelPtr->pBackwardTransform; 01080 UNLOCK_DATA( theTransform ); 01081 if( theWorldRef == 0 ){ 01082 SetLastError( (DWORD)cmparamErr ); 01083 return 0; 01084 } 01085 theTransform = (HCMTRANSFORM)theWorldRef; 01086 } 01087 01088 spaceIn = CMGetDataColorSpace( bmInput, &inPixelSize ); 01089 if( spaceIn == 0 ){ 01090 SetLastError( (DWORD)cmInvalidColorSpace ); 01091 return 0; 01092 } 01093 spaceOut = CMGetDataColorSpace( bmOutput, &outPixelSize ); 01094 if( spaceOut == 0 ){ 01095 SetLastError( (DWORD)cmInvalidColorSpace ); 01096 return 0; 01097 } 01098 InBitmap.image = lpSrcBits; 01099 InBitmap.width = dwWidth; 01100 InBitmap.height = dwHeight; 01101 if( dwStride == 0 ){ 01102 InBitmap.rowBytes = ( dwWidth * (inPixelSize / 8) + 3 ) & ~3; 01103 } 01104 else{ 01105 InBitmap.rowBytes = dwStride; 01106 } 01107 InBitmap.pixelSize = inPixelSize; 01108 InBitmap.space = spaceIn; 01109 01110 OutBitmap.image = lpDestBits; 01111 OutBitmap.width = dwWidth; 01112 OutBitmap.height = dwHeight; 01113 OutBitmap.rowBytes = ( dwWidth * (outPixelSize / 8) + 3 ) & ~3; 01114 OutBitmap.pixelSize = outPixelSize; 01115 OutBitmap.space = spaceOut; 01116 01117 matchErr = CWMatchBitmap( theTransform, &InBitmap, 01118 (CMBitmapCallBackUPP)0,(void *)NULL,&OutBitmap ); 01119 if( matchErr ){ 01120 SetLastError( matchErr ); 01121 return 0; 01122 } 01123 return 1; 01124 }

BOOL WINAPI CMTranslateRGBsExt HCMTRANSFORM  hcmTransform,
LPVOID  lpSrcBits,
BMFORMAT  bmInput,
DWORD  dwWidth,
DWORD  dwHeight,
DWORD  dwInputStride,
LPVOID  lpDestBits,
BMFORMAT  bmOutput,
DWORD  dwOutputStride,
LPBMCALLBACKFN  lpfnCallback,
LPARAM  ulCallbackData
 

Definition at line 1169 of file mscmm/icm32.c.

References BOOL, CMBitmapCallBackUPP, CMBitmapColorSpace, CMGetDataColorSpace(), CMGetTransform(), cmInvalidColorSpace, CWMatchBitmap(), DWORD, FALSE, CMBitmap::height, CMBitmap::image, CMBitmap::pixelSize, CMBitmap::rowBytes, CMBitmap::space, and CMBitmap::width.

01180 { 01181 CMBitmapColorSpace spaceIn,spaceOut; 01182 CMBitmap InBitmap,OutBitmap; 01183 long matchErr, inPixelSize, outPixelSize; 01184 BOOL aBgrMode = FALSE; 01185 01186 spaceIn = CMGetDataColorSpace( bmInput, &inPixelSize ); 01187 if( spaceIn == 0 ){ 01188 SetLastError( (DWORD)cmInvalidColorSpace ); 01189 return 0; 01190 } 01191 spaceOut = CMGetDataColorSpace( bmOutput, &outPixelSize ); 01192 if( spaceOut == 0 ){ 01193 SetLastError( (DWORD)cmInvalidColorSpace ); 01194 return 0; 01195 } 01196 InBitmap.image = lpSrcBits; 01197 InBitmap.width = dwWidth; 01198 InBitmap.height = dwHeight; 01199 if( dwInputStride == 0 ){ 01200 InBitmap.rowBytes = ( dwWidth * (inPixelSize / 8) + 3 ) & ~3; 01201 } 01202 else{ 01203 InBitmap.rowBytes = dwInputStride; 01204 } 01205 InBitmap.pixelSize = inPixelSize; 01206 InBitmap.space = spaceIn; 01207 01208 OutBitmap.image = lpDestBits; 01209 OutBitmap.width = dwWidth; 01210 OutBitmap.height = dwHeight; 01211 if( dwOutputStride == 0 ){ 01212 OutBitmap.rowBytes = ( dwWidth * (outPixelSize / 8) + 3 ) & ~3; 01213 } 01214 else{ 01215 OutBitmap.rowBytes = dwOutputStride; 01216 } 01217 OutBitmap.pixelSize = outPixelSize; 01218 OutBitmap.space = spaceOut; 01219 01220 matchErr = CWMatchBitmap( CMGetTransform( hcmTransform ), &InBitmap, 01221 (CMBitmapCallBackUPP)lpfnCallback,(void *)ulCallbackData,&OutBitmap ); 01222 if( matchErr ){ 01223 SetLastError( matchErr ); 01224 return 0; 01225 } 01226 return 1; 01227 }

BOOL WINAPI DllMain HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved
 

Definition at line 71 of file mscmm/icm32.c.

References BOOL, GlobalCriticalSection, and TRUE.

00074 { 00075 switch (fdwReason) 00076 { 00077 case DLL_PROCESS_ATTACH: 00078 DisableThreadLibraryCalls(hinstDLL); 00079 InitializeCriticalSection(&GlobalCriticalSection); 00080 break; 00081 case DLL_PROCESS_DETACH: 00082 DeleteCriticalSection(&GlobalCriticalSection); 00083 break; 00084 } 00085 return TRUE; 00086 }

long FillProfileFromLog LPLOGCOLORSPACEA  lpColorSpace,
PPROFILE  theProf
 

Definition at line 1478 of file mscmm/icm32.c.

References CHAR, CMError, DWORD, LCS_CALIBRATED_RGB, and MyNewAbstract().

01480 { 01481 long l; 01482 icProfile *aProf; 01483 CMError err = -1; 01484 01485 if( lpColorSpace->lcsFilename[0] ){ 01486 theProf->pProfileData = (char *)lpColorSpace->lcsFilename; 01487 theProf->dwType = PROFILE_FILENAME; 01488 theProf->cbDataSize = lstrlenA((const unsigned char *)theProf->pProfileData) * sizeof(CHAR); 01489 err = 0; 01490 } 01491 else if( lpColorSpace->lcsCSType == LCS_CALIBRATED_RGB ){ 01492 err = MyNewAbstract( lpColorSpace, &aProf ); 01493 theProf->pProfileData = ((PVOID *)aProf); 01494 theProf->dwType = PROFILE_MEMBUFFER; 01495 l = *(DWORD *)(theProf->pProfileData); 01496 theProf->cbDataSize = SwapLong(&l); 01497 } 01498 else theProf->pProfileData = 0; 01499 01500 return err; 01501 }

long FillProfileFromLogW LPLOGCOLORSPACEW  lpColorSpace,
PPROFILE  theProf
 

Definition at line 1518 of file mscmm/icm32.c.

References CMError, DWORD, LCS_CALIBRATED_RGB, and MyNewAbstractW().

01520 { 01521 long l; 01522 icProfile *aProf; 01523 CMError err = -1; 01524 01525 if( lpColorSpace->lcsFilename[0] ){ 01526 theProf->pProfileData = (char *)lpColorSpace->lcsFilename; 01527 theProf->dwType = PROFILE_FILENAME; 01528 theProf->cbDataSize = lstrlenW((const unsigned short *)theProf->pProfileData) * sizeof(WCHAR); 01529 err = 0; 01530 } 01531 else if( lpColorSpace->lcsCSType == LCS_CALIBRATED_RGB ){ 01532 err = MyNewAbstractW( lpColorSpace, &aProf ); 01533 theProf->pProfileData = ((PVOID *)aProf); 01534 theProf->dwType = PROFILE_MEMBUFFER; 01535 l = *(DWORD *)(theProf->pProfileData); 01536 theProf->cbDataSize = SwapLong(&l); 01537 } 01538 else theProf->pProfileData = 0; 01539 01540 return err; 01541 }

CMWorldRef StoreTransform CMWorldRef  aRef  ) 
 

Definition at line 1759 of file mscmm/icm32.c.

References CMWorldRef, GlobalCriticalSection, HCMTRANSFORM, IndexTransform, NULL, and TheTransform.

01760 { 01761 long i; 01762 CMWorldRef cw = NULL; 01763 01764 __try { 01765 EnterCriticalSection(&GlobalCriticalSection); 01766 01767 if( IndexTransform >= 1000 )return (HCMTRANSFORM)ERROR_NOT_ENOUGH_MEMORY; 01768 for( i = 0; i<IndexTransform ; i++ ){ 01769 if( TheTransform[i] == 0 ){ 01770 TheTransform[i] = aRef; 01771 cw = (CMWorldRef)(ULONG_PTR)(i + 256 ); 01772 } 01773 } 01774 if( i >= IndexTransform ){ 01775 TheTransform[IndexTransform] = aRef; 01776 IndexTransform++; 01777 cw = (CMWorldRef)(ULONG_PTR)(IndexTransform - 1 + 256); 01778 } 01779 } 01780 __finally{ 01781 LeaveCriticalSection(&GlobalCriticalSection); 01782 } 01783 01784 return cw; 01785 }

void WriteProf LPSTR  name,
icProfile theProf,
long  currentSize
 


Variable Documentation

CRITICAL_SECTION GlobalCriticalSection
 

Definition at line 51 of file mscmm/icm32.c.

Referenced by CMDeleteTransform(), CMGetTransform(), DllMain(), and StoreTransform().

long IndexTransform = 0
 

Definition at line 48 of file mscmm/icm32.c.

Referenced by CMDeleteTransform(), and StoreTransform().

HCMTRANSFORM TheTransform[1000] = {0}
 

Definition at line 49 of file mscmm/icm32.c.

Referenced by CMDeleteTransform(), CMGetTransform(), and StoreTransform().


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