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

runtime.c File Reference

#include "General.h"
#include "CalcEng.h"
#include "CalcEng1.h"
#include "CalcNDim.h"
#include "Runtime.h"
#include <string.h>

Go to the source code of this file.

Classes

struct  ColorSpaceInfo

Defines

#define kProgressTicks   30 /* .5secs -> min. time between calls of progressproc */
#define kMaxTempBlock   300 * 1024 /* allow max. 300 kByte temp buffer */
#define NewCalcProc(userRoutine)   ((CalcProcUPP) (userRoutine))
#define NewCalcProc1Dim(userRoutine)   ((CalcProc1DimUPP) (userRoutine))
#define CallCalcProc(userRoutine, calcParamPtr, lutParamPtr)   (*(userRoutine))( (calcParamPtr), (lutParamPtr) )
#define Byte_Factor   1
#define POS(x)   ((x) > (0) ? (UINT32)(x) : (UINT32)(-(x)))

Typedefs

typedef ColorSpaceInfo ColorSpaceInfo
typedef CMError(* CalcProcPtr )(CMCalcParamPtr calcParamPtr, CMLutParamPtr lutParamPtr)
typedef CalcProcPtr CalcProcUPP
typedef CMError(* CalcProc1DimPtr )(CMCalcParamPtr calcParamPtr, CMLutParamPtr lutParamPtr, char OutDim)
typedef CalcProc1DimPtr CalcProc1DimUPP

Functions

OSErr Convert5To8 (Ptr dataPtr5, Ptr dataPtr8, SINT32 startLine, SINT32 height, SINT32 width, SINT32 rowBytes5)
OSErr Convert8To5 (Ptr dataPtr8, Ptr dataPtr5, SINT32 startLine, SINT32 height, SINT32 width, SINT32 rowBytes5)
OSErr Convert8To1 (Ptr dataPtr8, Ptr dataPtr5, SINT32 startLine, SINT32 height, SINT32 width, SINT32 rowBytes5)
OSErr Convert16To10 (Ptr dataPtr16, Ptr dataPtr10, SINT32 startLine, SINT32 height, SINT32 width, SINT32 rowBytes10)
OSErr Convert10To16 (Ptr dataPtr10, Ptr dataPtr16, SINT32 startLine, SINT32 height, SINT32 width, SINT32 rowBytes10)
CMError FillLutParam (CMLutParamPtr lutParam, CMMModelPtr modelingData)
CMError FillLutParamChk (CMLutParamPtr lutParam, CMMModelPtr modelingData)
CMError FillCalcParam (CMCalcParamPtr calcParam, const CMBitmap *bitMap, const CMBitmap *matchedBitMap)
CMError FillCalcParamCM (CMCalcParamPtr calcParam, CMLutParamPtr lutParam, CMColor *myColors, SINT32 count)
CMError CheckInputColorSpace (const CMBitmap *bitMap, CMCalcParamPtr calcParam, ColorSpaceInfo *info, OSType inColorSpace, long colorLutInDim)
CMError CheckOutputColorSpace (const CMBitmap *bitMap, CMCalcParamPtr calcParam, ColorSpaceInfo *info, OSType outColorSpace, long colorLutOutDim)
CMError SetOutputColorSpaceInplace (CMCalcParamPtr calcParam, ColorSpaceInfo *info, OSType outColorSpace)
CMError CheckOutputColorSpaceChk (const CMBitmap *bitMap, CMCalcParamPtr calcParam, ColorSpaceInfo *info)
CMError AllocBufferCheckCM (CMCalcParamPtr calcParam, ColorSpaceInfo *info)
CalcProcPtr FindLookupRoutine (const CMLutParam *lutParam, const ColorSpaceInfo *info)
CalcProcPtr FindCalcRoutine (const CMCalcParam *calcParam, const CMLutParam *lutParam, const ColorSpaceInfo *info, const Boolean lookupOnly)
CMError Do8To555Setup (CMCalcParamPtr calcParam, ColorSpaceInfo *info, SINT32 *theLinesAtOnce, long reverseOrder)
CMError Do555To8Setup (CMCalcParamPtr calcParam, ColorSpaceInfo *info, SINT32 *theLinesAtOnce, long reverseOrder)
CMError LHMatchColorsPrivate (CMMModelPtr modelingData, CMColor *myColors, SINT32 count)
CMError LHCheckColorsPrivateMS (CMMModelPtr modelingData, CMColor *myColors, UINT32 count, UINT8 *result)
CMError LHCheckColorsPrivate (CMMModelPtr modelingData, CMColor *myColors, UINT32 count, UINT8 *result)
void CopyIndexData (CMBitmap *bitMapIn, CMBitmap *bitMapOut, ColorSpaceInfo *info)
CMError LHMatchBitMapPrivate (CMMModelPtr modelingData, const CMBitmap *inBitMap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *outBitMap)
CMError LHCheckBitMapPrivate (CMMModelPtr modelingData, const CMBitmap *inBitMap, CMBitmapCallBackUPP progressProc, void *refCon, CMBitmap *outBitMap)
CMError LHMatchBitMapPlanePrivate (CMMModelPtr modelingData, const LH_CMBitmapPlane *bitMapLH, CMBitmapCallBackUPP progressProc, void *refCon, LH_CMBitmapPlane *matchedBitMapLH)
OSErr ConvertNamedIndexToColors (CMMModelPtr modelingData, CMColor *theData, SINT32 pixCnt)
OSErr ConvertNamedIndexToPCS (CMMModelPtr cw, CMColor *theData, SINT32 pixCnt)
OSErr ConvertPCSToNamedIndex (CMMModelPtr modelingData, CMColor *theData, SINT32 pixCnt)
CMError CMConvertNamedIndexToColors (CMWorldRef cw, CMColor *theData, unsigned long pixCnt)
CMError CMConvertNamedIndexToPCS (CMWorldRef cw, CMColor *theData, unsigned long pixCnt)
CMError ConvertLabToIndexBitmap (CMMModelPtr modelingData, Ptr InBuffer, UINT32 processedLinesIn, UINT32 inLineCount, UINT32 width, UINT32 rowBytes)
CMError ConvertIndexToLabBitmap (CMMModelPtr modelingData, Ptr InBuffer, Ptr OutBuffer, UINT32 processedLinesIn, UINT32 lineCount, UINT32 inWidth, UINT32 inRowBytes, UINT32 outRowBytes, UINT32 outputSize)
CMError CMConvNameToIndex (icNamedColor2Type *Data, pcCMColorName Ptr2Name, unsigned long *Arr2Indices, unsigned long count)
CMError CMConvNameToIndexCW (CMWorldRef *Storage, pcCMColorName Ptr2Name, unsigned long *Arr2Indices, unsigned long count)
CMError CMConvNameToIndexProfile (CMProfileRef aProf, pcCMColorName Ptr2Name, unsigned long *Arr2Indices, unsigned long count)
CMError CMConvIndexToName (icNamedColor2Type *Data, unsigned long *Arr2Indices, pCMColorName Ptr2Name, unsigned long count)
CMError CMConvIndexToNameCW (CMWorldRef *Storage, unsigned long *Arr2Indices, pCMColorName Ptr2Name, unsigned long count)
CMError CMConvIndexToNameProfile (CMProfileRef aProf, unsigned long *Arr2Indices, pCMColorName Ptr2Name, unsigned long count)
CMError CMGetNamedProfileInfoProfile (CMProfileRef aProf, pCMNamedProfileInfo Info)
CMError CMGetNamedProfileInfoCW (CMWorldRef *Storage, pCMNamedProfileInfo Info)


Define Documentation

#define Byte_Factor   1
 

Definition at line 625 of file w98/lh_core/runtime.c.

#define CallCalcProc userRoutine,
calcParamPtr,
lutParamPtr   )     (*(userRoutine))( (calcParamPtr), (lutParamPtr) )
 

Definition at line 78 of file w98/lh_core/runtime.c.

#define kMaxTempBlock   300 * 1024 /* allow max. 300 kByte temp buffer */
 

Definition at line 63 of file w98/lh_core/runtime.c.

#define kProgressTicks   30 /* .5secs -> min. time between calls of progressproc */
 

Definition at line 62 of file w98/lh_core/runtime.c.

#define NewCalcProc userRoutine   )     ((CalcProcUPP) (userRoutine))
 

Definition at line 74 of file w98/lh_core/runtime.c.

#define NewCalcProc1Dim userRoutine   )     ((CalcProc1DimUPP) (userRoutine))
 

Definition at line 76 of file w98/lh_core/runtime.c.

#define POS  )     ((x) > (0) ? (UINT32)(x) : (UINT32)(-(x)))
 

Definition at line 4762 of file w98/lh_core/runtime.c.


Typedef Documentation

typedef CMError(* CalcProc1DimPtr)(CMCalcParamPtr calcParamPtr, CMLutParamPtr lutParamPtr, char OutDim)
 

Definition at line 70 of file w98/lh_core/runtime.c.

typedef CalcProc1DimPtr CalcProc1DimUPP
 

Definition at line 73 of file w98/lh_core/runtime.c.

typedef CMError(* CalcProcPtr)(CMCalcParamPtr calcParamPtr, CMLutParamPtr lutParamPtr)
 

Definition at line 66 of file w98/lh_core/runtime.c.

typedef CalcProcPtr CalcProcUPP
 

Definition at line 69 of file w98/lh_core/runtime.c.

typedef struct ColorSpaceInfo ColorSpaceInfo
 


Function Documentation

CMError AllocBufferCheckCM CMCalcParamPtr  calcParam,
ColorSpaceInfo info
 

Referenced by LHCheckColorsPrivate().

CMError CheckInputColorSpace const CMBitmap bitMap,
CMCalcParamPtr  calcParam,
ColorSpaceInfo info,
OSType  inColorSpace,
long  colorLutInDim
 

Referenced by LHCheckBitMapPrivate(), LHMatchBitMapPlanePrivate(), and LHMatchBitMapPrivate().

CMError CheckOutputColorSpace const CMBitmap bitMap,
CMCalcParamPtr  calcParam,
ColorSpaceInfo info,
OSType  outColorSpace,
long  colorLutOutDim
 

Referenced by LHMatchBitMapPlanePrivate(), and LHMatchBitMapPrivate().

CMError CheckOutputColorSpaceChk const CMBitmap bitMap,
CMCalcParamPtr  calcParam,
ColorSpaceInfo info
 

Referenced by LHCheckBitMapPrivate().

CMError CMConvertNamedIndexToColors CMWorldRef  cw,
CMColor theData,
unsigned long  pixCnt
 

CMError CMConvertNamedIndexToPCS CMWorldRef  cw,
CMColor theData,
unsigned long  pixCnt
 

CMError CMConvIndexToName icNamedColor2Type Data,
unsigned long *  Arr2Indices,
pCMColorName  Ptr2Name,
unsigned long  count
 

Referenced by CMConvIndexToNameCW(), and CMConvIndexToNameProfile().

CMError CMConvIndexToNameCW CMWorldRef Storage,
unsigned long *  Arr2Indices,
pCMColorName  Ptr2Name,
unsigned long  count
 

CMError CMConvIndexToNameProfile CMProfileRef  aProf,
unsigned long *  Arr2Indices,
pCMColorName  Ptr2Name,
unsigned long  count
 

CMError CMConvNameToIndex icNamedColor2Type Data,
pcCMColorName  Ptr2Name,
unsigned long *  Arr2Indices,
unsigned long  count
 

Referenced by CMConvNameToIndexCW(), and CMConvNameToIndexProfile().

CMError CMConvNameToIndexCW CMWorldRef Storage,
pcCMColorName  Ptr2Name,
unsigned long *  Arr2Indices,
unsigned long  count
 

CMError CMConvNameToIndexProfile CMProfileRef  aProf,
pcCMColorName  Ptr2Name,
unsigned long *  Arr2Indices,
unsigned long  count
 

CMError CMGetNamedProfileInfoCW CMWorldRef Storage,
pCMNamedProfileInfo  Info
 

CMError CMGetNamedProfileInfoProfile CMProfileRef  aProf,
pCMNamedProfileInfo  Info
 

OSErr Convert10To16 Ptr  dataPtr10,
Ptr  dataPtr16,
SINT32  startLine,
SINT32  height,
SINT32  width,
SINT32  rowBytes10
 

Referenced by LHCheckBitMapPrivate(), and LHMatchBitMapPrivate().

OSErr Convert16To10 Ptr  dataPtr16,
Ptr  dataPtr10,
SINT32  startLine,
SINT32  height,
SINT32  width,
SINT32  rowBytes10
 

Referenced by LHMatchBitMapPrivate().

OSErr Convert5To8 Ptr  dataPtr5,
Ptr  dataPtr8,
SINT32  startLine,
SINT32  height,
SINT32  width,
SINT32  rowBytes5
 

Referenced by LHCheckBitMapPrivate(), and LHMatchBitMapPrivate().

OSErr Convert8To1 Ptr  dataPtr8,
Ptr  dataPtr5,
SINT32  startLine,
SINT32  height,
SINT32  width,
SINT32  rowBytes5
 

Referenced by LHCheckBitMapPrivate(), and LHCheckColorsPrivate().

OSErr Convert8To5 Ptr  dataPtr8,
Ptr  dataPtr5,
SINT32  startLine,
SINT32  height,
SINT32  width,
SINT32  rowBytes5
 

Referenced by LHMatchBitMapPrivate().

CMError ConvertIndexToLabBitmap CMMModelPtr  modelingData,
Ptr  InBuffer,
Ptr  OutBuffer,
UINT32  processedLinesIn,
UINT32  lineCount,
UINT32  inWidth,
UINT32  inRowBytes,
UINT32  outRowBytes,
UINT32  outputSize
 

Definition at line 4946 of file w98/lh_core/runtime.c.

References CMError, cmNamedColorNotFound, cmparamErr, DATA_2_PTR, LH_END_PROC, LH_START_PROC, LOCK_DATA, LUT_DATA_TYPE, noErr, NULL, OSErr, UINT16, UINT32, UINT8, and UNLOCK_DATA.

Referenced by LHCheckBitMapPrivate(), and LHMatchBitMapPrivate().

04955 { 04956 OSErr err = noErr; 04957 LUT_DATA_TYPE tagH=NULL; 04958 UINT16 *tagTbl = NULL,*ColorPtr = NULL; 04959 UINT32 *imgIn=NULL; 04960 UINT8 *imgOut=NULL; 04961 int deviceChannelCount,elemSz; 04962 UINT32 i,j,index,countNamesInProfile; 04963 04964 LH_START_PROC("ConvertIndexToLabBitmap") 04965 /* set up the table for indexing */ 04966 tagH = modelingData->theNamedColorTagData; 04967 if (tagH==NULL) { 04968 err = cmparamErr; 04969 goto CleanUp; 04970 } 04971 04972 LOCK_DATA(tagH); 04973 tagTbl = (UINT16 *)DATA_2_PTR(tagH) + 58; /* points to PCS */ 04974 deviceChannelCount = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.nDeviceCoords; 04975 countNamesInProfile = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.count; 04976 if (deviceChannelCount==3) { 04977 elemSz = 32+(3+3)*sizeof(UINT16); 04978 } else if (deviceChannelCount==4) { 04979 elemSz = 32+(3+4)*sizeof(UINT16); 04980 } else if (deviceChannelCount==0) { 04981 elemSz = 32+(3+0)*sizeof(UINT16); 04982 } else { 04983 err = cmparamErr; 04984 goto CleanUp; 04985 } 04986 elemSz/=2; 04987 04988 /* ...and convert the data from index to PCS values */ 04989 for( i=processedLinesIn; i<processedLinesIn+lineCount; i++ ){ 04990 imgIn = (UINT32 *)(InBuffer + i * inRowBytes); 04991 imgOut = (UINT8*)OutBuffer + (i-processedLinesIn) * outRowBytes; 04992 if( outputSize == 24 ){ 04993 for (j=0;j<inWidth;j++) { 04994 index = *imgIn++; 04995 if( index == 0 || index > countNamesInProfile ){ 04996 err = cmNamedColorNotFound; 04997 goto CleanUp; 04998 } 04999 05000 ColorPtr = tagTbl + (index-1)*elemSz; 05001 *imgOut++ = (*ColorPtr++)>>8; 05002 *imgOut++ = (*ColorPtr++)>>8; 05003 *imgOut++ = (*ColorPtr++)>>8; 05004 } 05005 } 05006 else if( outputSize == 32 ){ 05007 for (j=0;j<inWidth;j++) { 05008 index = *imgIn++; 05009 if( index == 0 || index > countNamesInProfile ){ 05010 err = cmNamedColorNotFound; 05011 goto CleanUp; 05012 } 05013 05014 ColorPtr = tagTbl + (index-1)*elemSz; 05015 *imgOut++ = (*ColorPtr++)>>8; 05016 *imgOut++ = (*ColorPtr++)>>8; 05017 *imgOut = (*ColorPtr++)>>8; 05018 imgOut += 2; 05019 } 05020 } 05021 } 05022 CleanUp: 05023 UNLOCK_DATA(tagH); 05024 LH_END_PROC("ConvertIndexToLabBitmap") 05025 return err; 05026 }

CMError ConvertLabToIndexBitmap CMMModelPtr  modelingData,
Ptr  InBuffer,
UINT32  processedLinesIn,
UINT32  inLineCount,
UINT32  width,
UINT32  rowBytes
 

Definition at line 4863 of file w98/lh_core/runtime.c.

References CMError, cmparamErr, DATA_2_PTR, LH_END_PROC, LH_START_PROC, LOCK_DATA, LUT_DATA_TYPE, noErr, NULL, OSErr, POS, SINT16, UINT16, UINT32, UINT8, and UNLOCK_DATA.

Referenced by LHMatchBitMapPrivate().

04869 { 04870 OSErr err = noErr; 04871 LUT_DATA_TYPE tagH=NULL; 04872 UINT16 *tagTbl = NULL,*colorPtr = NULL; 04873 int deviceChannelCount,elemSz,count; 04874 UINT32 i,j,k,index,dE,dEnow; 04875 UINT16 LL,aa,bb; 04876 UINT8 *imgIn=NULL,*imgOut=NULL; 04877 UINT32 *imgInPtr=NULL; 04878 UINT8 *imgInPtr8=NULL; 04879 UINT8 *imgOutPtr8=NULL; 04880 04881 LH_START_PROC("ConvertLabToIndexBitmap") 04882 /* prepare the tag table */ 04883 tagH = modelingData->theNamedColorTagData; 04884 if (tagH==NULL){ 04885 err = cmparamErr; 04886 goto CleanUp; 04887 } 04888 LOCK_DATA(tagH); 04889 tagTbl = (UINT16 *)DATA_2_PTR(tagH) + 58; 04890 count = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.count; 04891 deviceChannelCount = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.nDeviceCoords; 04892 if (deviceChannelCount == 3){ 04893 elemSz = 32+(3+3)*sizeof(SINT16); 04894 } 04895 else if (deviceChannelCount == 4){ 04896 elemSz = 32+(3+4)*sizeof(SINT16); 04897 } 04898 else if (deviceChannelCount == 0){ 04899 elemSz = 32+(3+0)*sizeof(SINT16); 04900 } 04901 else{ 04902 err = cmparamErr; 04903 goto CleanUp; 04904 } 04905 elemSz /= 2; 04906 04907 /* search for index */ 04908 imgIn = (UINT8*)InBuffer + processedLinesIn * rowBytes; 04909 imgInPtr8=((UINT8 *)imgIn); 04910 LL = *(imgInPtr8+0)+1; /* do not use cache for first pixel */ 04911 for (i = 0; i < inLineCount; i++){ 04912 for (j = 0; j < width; j++){ 04913 imgInPtr8=((UINT8 *)imgIn+j*4); 04914 if( LL == *(imgInPtr8+0) ){ 04915 if( aa == *(imgInPtr8+1) && bb == *(imgInPtr8+2) ){ 04916 *((UINT32 *)imgIn+j) = index+1; 04917 continue; 04918 } 04919 } 04920 LL = *(imgInPtr8+0); 04921 aa = *(imgInPtr8+1); 04922 bb = *(imgInPtr8+2); 04923 /* go through the whole table to find the closest one*/ 04924 dEnow = 0x40000; /* just arbitrarily high = 256*256*4 */ 04925 index =(UINT32)-1; 04926 colorPtr = tagTbl; 04927 for (k = 0; k < (UINT32)count; k++){ 04928 dE = POS((long)aa - (*(colorPtr+1)>>8)); 04929 dE = dE + POS((long)bb - (*(colorPtr+2)>>8)); 04930 dE = 2*dE + (dE>>1) + POS((long)LL - (*(colorPtr)>>8)); /* Quantization L = 2.55 * (a|b) */ 04931 if (dE < dEnow){ 04932 index = k; 04933 dEnow = dE; 04934 } 04935 colorPtr += elemSz; 04936 } 04937 *((UINT32 *)imgIn+j) = index+1; 04938 } 04939 imgIn+=rowBytes; 04940 } 04941 CleanUp: 04942 UNLOCK_DATA(tagH); 04943 LH_END_PROC("ConvertLabToIndexBitmap") 04944 return err; 04945 }

OSErr ConvertNamedIndexToColors CMMModelPtr  modelingData,
CMColor theData,
SINT32  pixCnt
 

Definition at line 4603 of file w98/lh_core/runtime.c.

References PI_CMYKCOLOR::black, PI_RGBCOLOR::blue, cmNamedColorNotFound, cmparamErr, CMColor::cmyk, PI_CMYKCOLOR::cyan, DATA_2_PTR, PI_RGBCOLOR::green, LH_END_PROC, LH_START_PROC, LOCK_DATA, LUT_DATA_TYPE, PI_CMYKCOLOR::magenta, CMColor::namedColor, PI_NAMEDCOLOR::namedColorIndex, noErr, NoNamedColorProfile, NULL, OSErr, PI_RGBCOLOR::red, CMColor::rgb, SINT16, UINT16, UINT32, UNLOCK_DATA, and PI_CMYKCOLOR::yellow.

04606 { 04607 UINT16 *tagTbl = NULL; 04608 LUT_DATA_TYPE tagH = NULL; 04609 OSErr err = noErr; 04610 UINT32 i,index; 04611 UINT16 *colorPtr=NULL; 04612 int elemSz,deviceChannelCount,count; 04613 04614 LH_START_PROC("ConvertNamedIndexToColors") 04615 04616 if ( modelingData->hasNamedColorProf!=NoNamedColorProfile) 04617 { 04618 /* prepare the tag table */ 04619 tagH = modelingData->theNamedColorTagData; 04620 if (tagH==NULL) 04621 { 04622 err = cmparamErr; 04623 goto CleanUp; 04624 } 04625 LOCK_DATA(tagH); 04626 04627 /* tagTbl should now point to beginning of first device data */ 04628 /* = CMNamedColor2Type_header(84) + firstName(32) + PCSSize(3*2) */ 04629 tagTbl = (UINT16 *)DATA_2_PTR(tagH) + 61; 04630 04631 /* find out how many bytes to skip per element. div'ed 2 for indexing purpose */ 04632 count = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.count; 04633 deviceChannelCount = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.nDeviceCoords; 04634 if (deviceChannelCount==3) 04635 { 04636 elemSz = 32+(3+3)*sizeof(SINT16); 04637 } else if (deviceChannelCount == 4) 04638 { 04639 elemSz = 32+(3+4)*sizeof(SINT16); 04640 } else if (deviceChannelCount == 0) 04641 { 04642 elemSz = 32+(3+0)*sizeof(SINT16); 04643 } else 04644 { 04645 err = cmparamErr; 04646 goto CleanUp; 04647 } 04648 elemSz/=2; 04649 04650 /* doing the actual */ 04651 for (i=0; i<(UINT32)pixCnt; i++) 04652 { 04653 /* go to the index'th element*/ 04654 index = theData->namedColor.namedColorIndex; 04655 if (index > (UINT32)count || index == 0 ) 04656 { 04657 err = cmNamedColorNotFound; 04658 goto CleanUp; 04659 } 04660 colorPtr = tagTbl + (index-1)*elemSz; 04661 /* put in all the info */ 04662 if (deviceChannelCount==3) 04663 { 04664 theData->rgb.red = *colorPtr++; 04665 theData->rgb.green = *colorPtr++; 04666 theData->rgb.blue = *colorPtr++; 04667 } else if (deviceChannelCount==4) 04668 { 04669 theData->cmyk.cyan = *colorPtr++; 04670 theData->cmyk.magenta = *colorPtr++; 04671 theData->cmyk.yellow = *colorPtr++; 04672 theData->cmyk.black = *colorPtr++; 04673 } 04674 theData++; 04675 } 04676 UNLOCK_DATA(tagH); 04677 } 04678 CleanUp: 04679 LH_END_PROC("ConvertNamedIndexToColors") 04680 return err; 04681 }

OSErr ConvertNamedIndexToPCS CMMModelPtr  cw,
CMColor theData,
SINT32  pixCnt
 

Definition at line 4688 of file w98/lh_core/runtime.c.

References PI_LabCOLOR::a, PI_LabCOLOR::b, CMMModelPtr, cmNamedColorNotFound, cmparamErr, DATA_2_PTR, PI_LabCOLOR::L, CMColor::Lab, LH_END_PROC, LH_START_PROC, LOCK_DATA, LUT_DATA_TYPE, CMColor::namedColor, PI_NAMEDCOLOR::namedColorIndex, noErr, NULL, OSErr, SINT16, UINT16, UINT32, and UNLOCK_DATA.

Referenced by CMConvertNamedIndexToPCS(), LHCheckColorsPrivateMS(), and LHMatchColorsPrivate().

04691 { 04692 UINT16 *tagTbl = NULL; 04693 LUT_DATA_TYPE tagH = NULL; 04694 OSErr err = noErr; 04695 UINT32 i,index; 04696 UINT16 *colorPtr=NULL; 04697 int elemSz,deviceChannelCount,count; 04698 CMMModelPtr modelingData = (CMMModelPtr)cw; 04699 04700 04701 LH_START_PROC("ConvertNamedIndexToPCS") 04702 if( cw == 0 )return cmparamErr; 04703 { 04704 /* prepare the tag table */ 04705 tagH = modelingData->theNamedColorTagData; 04706 if (tagH == NULL) 04707 { 04708 err = cmparamErr; 04709 goto CleanUp; 04710 } 04711 LOCK_DATA(tagH); 04712 04713 /* tagTbl should now point to beginning of first PCS data */ 04714 /* = CMNamedColor2Type_header(84) + firstName(32) */ 04715 tagTbl = (UINT16 *)DATA_2_PTR(tagH) + 58; 04716 04717 /* find out how many bytes to skip per element. div'ed 2 for indexing purpose */ 04718 count = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.count; 04719 deviceChannelCount = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.nDeviceCoords; 04720 if (deviceChannelCount == 3) 04721 { 04722 elemSz = 32+(3+3)*sizeof(SINT16); 04723 } else if (deviceChannelCount == 4) 04724 { 04725 elemSz = 32+(3+4)*sizeof(SINT16); 04726 } else if (deviceChannelCount == 0) 04727 { 04728 elemSz = 32+(3+0)*sizeof(SINT16); 04729 } else 04730 { 04731 err = cmparamErr; 04732 goto CleanUp; 04733 } 04734 elemSz /= 2; 04735 04736 /* doing the actual */ 04737 for (i=0; i<(UINT32)pixCnt; i++) 04738 { 04739 /* go to the index'th element*/ 04740 index = theData->namedColor.namedColorIndex; 04741 if (index > (UINT32)count || index == 0 ) 04742 { 04743 err = cmNamedColorNotFound; 04744 goto CleanUp; 04745 } 04746 colorPtr = tagTbl + (index-1)*elemSz; 04747 /* put in all the info */ 04748 theData->Lab.L = *colorPtr++; 04749 theData->Lab.a = *colorPtr++; 04750 theData->Lab.b = *colorPtr++; 04751 theData++; 04752 } 04753 UNLOCK_DATA(tagH); 04754 } 04755 CleanUp: 04756 LH_END_PROC("ConvertNamedIndexToPCS") 04757 return err; 04758 }

OSErr ConvertPCSToNamedIndex CMMModelPtr  modelingData,
CMColor theData,
SINT32  pixCnt
 

Definition at line 4768 of file w98/lh_core/runtime.c.

References PI_LabCOLOR::a, PI_LabCOLOR::b, cmparamErr, DATA_2_PTR, PI_LabCOLOR::L, CMColor::Lab, LH_END_PROC, LH_START_PROC, LOCK_DATA, LUT_DATA_TYPE, CMColor::namedColor, PI_NAMEDCOLOR::namedColorIndex, NamedColorProfileAtEnd, noErr, NULL, OSErr, POS, SINT16, UINT16, UINT32, and UNLOCK_DATA.

04771 { 04772 UINT16 *tagTbl = NULL; 04773 LUT_DATA_TYPE tagH = NULL; 04774 OSErr err = noErr; 04775 UINT32 i,j,index,dE,dEnow; 04776 UINT16 *colorPtr=NULL; 04777 int elemSz,deviceChannelCount,count; 04778 04779 LH_START_PROC("ConvertPCSToNamedIndex") 04780 if (modelingData->hasNamedColorProf == NamedColorProfileAtEnd) 04781 { 04782 /* prepare the tag table */ 04783 tagH = modelingData->theNamedColorTagData; 04784 if (tagH==NULL) 04785 { 04786 err = cmparamErr; 04787 goto CleanUp; 04788 } 04789 LOCK_DATA(tagH); 04790 04791 /* tagTbl should now point to beginning of first PCS data */ 04792 /* = CMNamedColor2Type_header(84) + firstName(32) */ 04793 tagTbl = (UINT16 *)DATA_2_PTR(tagH) + 58; 04794 04795 /* find out how many bytes to skip per element. div'ed 2 for indexing purpose */ 04796 count = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.count; 04797 deviceChannelCount = ((icNamedColor2Type *)DATA_2_PTR(tagH))->ncolor.nDeviceCoords; 04798 if (deviceChannelCount == 3) 04799 { 04800 elemSz = 32+(3+3)*sizeof(SINT16); 04801 } else if (deviceChannelCount == 4) 04802 { 04803 elemSz = 32+(3+4)*sizeof(SINT16); 04804 } else if (deviceChannelCount == 0) 04805 { 04806 elemSz = 32+(3+0)*sizeof(SINT16); 04807 } else 04808 { 04809 err = cmparamErr; 04810 goto CleanUp; 04811 } 04812 elemSz/=2; 04813 04814 /* doing the actual */ 04815 for (i=0; i < (UINT32)pixCnt; i++) 04816 { 04817 /* go through the whole table to find the closest one*/ 04818 dEnow = 0x40000; /* just arbitrarily high = 256*256*4 */ 04819 index = (UINT32)-1; 04820 colorPtr = tagTbl; 04821 for (j=0; j < (UINT32)count; j++) 04822 { 04823 dE = POS((long)theData->Lab.a - *(colorPtr+1)); 04824 dE = dE + POS((long)theData->Lab.b - *(colorPtr+2)); 04825 dE = 2*dE + (dE>>1) + POS((long)theData->Lab.L - *(colorPtr)); 04826 if (dE < dEnow) 04827 { 04828 index = j; 04829 dEnow = dE; 04830 } 04831 colorPtr += elemSz; 04832 } 04833 theData->namedColor.namedColorIndex = index+1; 04834 theData++; 04835 } 04836 UNLOCK_DATA(tagH); 04837 } 04838 CleanUp: 04839 LH_END_PROC("ConvertPCSToNamedIndex") 04840 return err; 04841 }

void CopyIndexData CMBitmap bitMapIn,
CMBitmap bitMapOut,
ColorSpaceInfo info
 

Referenced by LHMatchBitMapPrivate().

CMError Do555To8Setup CMCalcParamPtr  calcParam,
ColorSpaceInfo info,
SINT32 theLinesAtOnce,
long  reverseOrder
 

Referenced by CheckInputColorSpace().

CMError Do8To555Setup CMCalcParamPtr  calcParam,
ColorSpaceInfo info,
SINT32 theLinesAtOnce,
long  reverseOrder
 

Referenced by CheckOutputColorSpace().

CMError FillCalcParam CMCalcParamPtr  calcParam,
const CMBitmap bitMap,
const CMBitmap matchedBitMap
 

Referenced by LHCheckBitMapPrivate(), LHMatchBitMapPlanePrivate(), and LHMatchBitMapPrivate().

CMError FillCalcParamCM CMCalcParamPtr  calcParam,
CMLutParamPtr  lutParam,
CMColor myColors,
SINT32  count
 

Referenced by LHCheckColorsPrivate(), LHCheckColorsPrivateMS(), and LHMatchColorsPrivate().

CMError FillLutParam CMLutParamPtr  lutParam,
CMMModelPtr  modelingData
 

Referenced by LHMatchBitMapPlanePrivate(), LHMatchBitMapPrivate(), and LHMatchColorsPrivate().

CMError FillLutParamChk CMLutParamPtr  lutParam,
CMMModelPtr  modelingData
 

Referenced by LHCheckBitMapPrivate(), LHCheckColorsPrivate(), and LHCheckColorsPrivateMS().

CalcProcPtr FindCalcRoutine const CMCalcParam calcParam,
const CMLutParam lutParam,
const ColorSpaceInfo info,
const Boolean  lookupOnly
 

Referenced by LHCheckBitMapPrivate(), LHCheckColorsPrivate(), LHCheckColorsPrivateMS(), LHMatchBitMapPlanePrivate(), LHMatchBitMapPrivate(), and LHMatchColorsPrivate().

CalcProcPtr FindLookupRoutine const CMLutParam lutParam,
const ColorSpaceInfo info
 

Referenced by FindCalcRoutine().

CMError LHCheckBitMapPrivate CMMModelPtr  modelingData,
const CMBitmap inBitMap,
CMBitmapCallBackUPP  progressProc,
void *  refCon,
CMBitmap outBitMap
 

Definition at line 4253 of file w98/lh_core/runtime.c.

References Boolean, CalcProcPtr, CallCalcProc, CallCMBitmapCallBackProc, CheckInputColorSpace(), CheckOutputColorSpaceChk(), CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputPixelOffset, cmInvalidDstMap, CMCalcParam::cmLineCount, cmMethodError, CMCalcParam::cmOutputBytesPerLine, CMLutParam::colorLutInDim, CMLutParam::colorLutOutDim, Convert10To16(), Convert5To8(), Convert8To1(), ConvertIndexToLabBitmap(), DisposeIfPtr(), FALSE, FillCalcParam(), FillLutParamChk(), FindCalcRoutine(), CMBitmap::height, CMBitmap::image, ColorSpaceInfo::inPlace, CMCalcParam::inputData, kMaxTempBlock, kProgressTicks, LH_END_PROC, LH_START_PROC, LOCK_DATA, NamedColorProfileAtBegin, NamedColorProfileOnly, nil, NoNamedColorProfile, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, OSType, CMCalcParam::outputData, ColorSpaceInfo::processedLinesIn, Ptr, CMBitmap::rowBytes, SetMem(), SINT32, ColorSpaceInfo::tempInBuffer, ColorSpaceInfo::tempOutBuffer, TickCount(), TRUE, UNLOCK_DATA, userCanceledErr, and CMBitmap::width.

Referenced by CWCheckBitmap().

04258 { 04259 CMCalcParam calcParam; 04260 CMLutParam lutParam; 04261 CMError err = -1; 04262 ColorSpaceInfo info; 04263 CalcProcPtr calcRoutine = nil; 04264 CMBitmap bitMapIn = *inBitMap; 04265 CMBitmap bitMapOut; 04266 OSType inColorSpace = modelingData->firstColorSpace; 04267 Boolean progressProcWasCalled = FALSE; 04268 SINT32 offset; 04269 SINT32 progressTimer; 04270 SINT32 dimLoop; 04271 Boolean matchInPlace = FALSE; 04272 long progressProcCount = 0; 04273 SINT32 inLineCount; 04274 04275 LH_START_PROC("LHCheckBitMapPrivate") 04276 04277 if( (modelingData)->gamutLutParam.colorLut == 0 )return cmMethodError; 04278 LOCK_DATA((modelingData)->gamutLutParam.inputLut); 04279 LOCK_DATA((modelingData)->gamutLutParam.colorLut); 04280 LOCK_DATA((modelingData)->gamutLutParam.outputLut); 04281 04282 SetMem(&info, sizeof(ColorSpaceInfo), 0); 04283 SetMem(&calcParam, sizeof(CMCalcParam), 0); 04284 04285 if ( (outBitMap == nil ) || (modelingData->gamutLutParam.colorLut == nil) ) 04286 { 04287 err = cmInvalidDstMap; 04288 goto CleanupAndExit; 04289 } 04290 bitMapOut = *outBitMap; 04291 FillLutParamChk(&lutParam, modelingData); 04292 FillCalcParam(&calcParam, &bitMapIn, &bitMapOut); 04293 04294 err = CheckInputColorSpace( &bitMapIn, &calcParam, &info, inColorSpace, lutParam.colorLutInDim ); 04295 inLineCount = calcParam.cmLineCount; 04296 if (err) 04297 goto CleanupAndExit; 04298 04299 err = CheckOutputColorSpaceChk( &bitMapOut, &calcParam, &info ); 04300 if (err) 04301 goto CleanupAndExit; 04302 04303 info.inPlace = bitMapOut.image == bitMapIn.image && info.tempInBuffer == nil && info.tempOutBuffer == nil; 04304 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 04305 if (calcRoutine == nil) 04306 { 04307 err = cmMethodError; 04308 goto CleanupAndExit; 04309 } 04310 04311 /* ------------------------------------------------- 8 or 16 bit data --------------------------------------------------------- */ 04312 if ((info.tempInBuffer == nil) && (info.tempOutBuffer == nil) && modelingData->hasNamedColorProf == NoNamedColorProfile) 04313 { 04314 if (progressProc == nil) 04315 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); /* no callback proc - do it all in one step */ 04316 else 04317 { 04318 calcParam.cmLineCount = kMaxTempBlock / calcParam.cmInputBytesPerLine; 04319 if (calcParam.cmLineCount < 1) 04320 calcParam.cmLineCount = 1; 04321 else if (calcParam.cmLineCount > bitMapIn.height) 04322 calcParam.cmLineCount = bitMapIn.height; 04323 04324 progressTimer = TickCount(); 04325 while ( info.processedLinesIn < bitMapIn.height ) 04326 { 04327 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); 04328 04329 for (dimLoop = 0; dimLoop< lutParam.colorLutInDim; dimLoop++) 04330 calcParam.inputData[dimLoop] = (Ptr)calcParam.inputData[dimLoop] + calcParam.cmLineCount * calcParam.cmInputBytesPerLine; 04331 04332 for (dimLoop = 0; dimLoop< lutParam.colorLutOutDim; dimLoop++) 04333 calcParam.outputData[dimLoop] = (Ptr)calcParam.outputData[dimLoop] + calcParam.cmLineCount * calcParam.cmOutputBytesPerLine; 04334 04335 info.processedLinesIn += calcParam.cmLineCount; 04336 if ( info.processedLinesIn + calcParam.cmLineCount > bitMapIn.height ) 04337 calcParam.cmLineCount = bitMapIn.height-info.processedLinesIn; 04338 04339 /* - - - - - handle CMBitmapCallBackProc - - - - - */ 04340 if ( progressProc && ( progressTimer + kProgressTicks < (SINT32)TickCount()) ) 04341 { 04342 progressProcWasCalled = TRUE; 04343 if (CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, info.processedLinesIn, (void *)refCon )) 04344 { 04345 info.processedLinesIn = bitMapIn.height; 04346 err = userCanceledErr; 04347 } else 04348 progressTimer = TickCount(); 04349 progressProcCount = info.processedLinesIn; 04350 } 04351 } 04352 } 04353 } 04354 else if (modelingData->hasNamedColorProf != NamedColorProfileOnly ){ 04355 info.processedLinesIn = 0; 04356 progressTimer = TickCount(); 04357 if( info.tempInBuffer && info.tempOutBuffer ){ 04358 if( inLineCount > calcParam.cmLineCount )inLineCount = calcParam.cmLineCount; 04359 } 04360 else if( info.tempInBuffer ){ 04361 } 04362 else if( info.tempOutBuffer ){ 04363 inLineCount = calcParam.cmLineCount; 04364 } 04365 else if( progressProc ){ 04366 inLineCount = kMaxTempBlock / calcParam.cmInputBytesPerLine; 04367 if (inLineCount < 1) 04368 inLineCount = 1; 04369 else if (inLineCount > bitMapIn.height) 04370 inLineCount = bitMapIn.height; 04371 } 04372 while ( info.processedLinesIn < bitMapIn.height ) 04373 { 04374 if ( info.processedLinesIn + inLineCount > bitMapIn.height ) 04375 inLineCount = bitMapIn.height-info.processedLinesIn; 04376 04377 if (info.origSizeIn == 5 ) /* input is 5 bit */ 04378 Convert5To8 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04379 #ifdef PI_Application_h 04380 else if (info.origSizeIn == 6 ) /* output is 5 bit */ 04381 Convert565To8 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04382 #endif 04383 else if (info.origSizeIn == 10 ) 04384 Convert10To16 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04385 04386 if (modelingData->hasNamedColorProf == NamedColorProfileAtBegin ){ 04387 err = ConvertIndexToLabBitmap( modelingData, bitMapIn.image, 04388 (Ptr)info.tempInBuffer, info.processedLinesIn, 04389 inLineCount, bitMapIn.width, 04390 bitMapIn.rowBytes, 04391 calcParam.cmInputBytesPerLine, 04392 calcParam.cmInputPixelOffset*8 ); 04393 if (err) 04394 goto CleanupAndExit; 04395 } 04396 calcParam.cmLineCount = inLineCount; 04397 err = CallCalcProc( calcRoutine, &calcParam, &lutParam ); 04398 if (err) 04399 goto CleanupAndExit; 04400 04401 if( info.origSizeOut == 1 ) /* output is 5 bit */ 04402 Convert8To1 ( (Ptr)info.tempOutBuffer, bitMapOut.image, info.processedLinesIn, calcParam.cmLineCount, bitMapOut.width, bitMapOut.rowBytes); 04403 04404 info.processedLinesIn += inLineCount; 04405 /* - - - - - handle CMBitmapCallBackProc - - - - - */ 04406 if ( progressProc && ( progressTimer + kProgressTicks < (SINT32)TickCount()) ) 04407 { 04408 progressProcWasCalled = TRUE; 04409 if (CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, info.processedLinesIn, (void *)refCon )) 04410 { 04411 info.processedLinesIn = bitMapIn.height; 04412 err = userCanceledErr; 04413 } else 04414 progressTimer = TickCount(); 04415 progressProcCount = info.processedLinesIn; 04416 } 04417 if( !info.tempInBuffer ){ 04418 offset = calcParam.cmLineCount * calcParam.cmInputBytesPerLine; 04419 for (dimLoop = 0; dimLoop< lutParam.colorLutInDim; dimLoop++) 04420 calcParam.inputData[dimLoop] = (Ptr)calcParam.inputData[dimLoop] + offset; 04421 } 04422 if( !info.tempOutBuffer ){ 04423 offset = calcParam.cmLineCount * calcParam.cmOutputBytesPerLine; 04424 for (dimLoop = 0; dimLoop< lutParam.colorLutOutDim; dimLoop++) 04425 calcParam.outputData[dimLoop] = (Ptr)calcParam.outputData[dimLoop] + offset; 04426 } 04427 } 04428 DisposeIfPtr((Ptr)info.tempInBuffer); 04429 DisposeIfPtr((Ptr)info.tempOutBuffer); 04430 } 04431 else{ 04432 DisposeIfPtr((Ptr)info.tempInBuffer); 04433 err = cmMethodError; 04434 goto CleanupAndExit; 04435 } 04436 if (err) 04437 goto CleanupAndExit; 04438 04439 if( progressProcWasCalled && progressProcCount != bitMapIn.height ) 04440 CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, bitMapIn.height, (void *)refCon ); 04441 CleanupAndExit: 04442 UNLOCK_DATA((modelingData)->gamutLutParam.inputLut); 04443 UNLOCK_DATA((modelingData)->gamutLutParam.colorLut); 04444 UNLOCK_DATA((modelingData)->gamutLutParam.outputLut); 04445 04446 LH_END_PROC("LHCheckBitMapPrivate") 04447 04448 return err; 04449 }

CMError LHCheckColorsPrivate CMMModelPtr  modelingData,
CMColor myColors,
UINT32  count,
UINT8 result
 

Definition at line 3871 of file w98/lh_core/runtime.c.

References AllocBufferCheckCM(), CalcProcPtr, CallCalcProc, CMError, CMCalcParam::cmLineCount, cmMethodError, Convert8To1(), DisposeIfPtr(), FillCalcParamCM(), FillLutParamChk(), FindCalcRoutine(), ColorSpaceInfo::inPlace, LH_END_PROC, LH_START_PROC, LOCK_DATA, NamedColorProfileAtEnd, NamedColorProfileOnly, nil, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, ColorSpaceInfo::processedLinesIn, Ptr, SetMem(), ColorSpaceInfo::tempOutBuffer, unimpErr, UNLOCK_DATA, ColorSpaceInfo::usedSizeIn, and ColorSpaceInfo::usedSizeOut.

03875 { 03876 CMCalcParam calcParam; 03877 CMLutParam lutParam; 03878 CMError err = -1; 03879 ColorSpaceInfo info; 03880 CalcProcPtr calcRoutine = nil; 03881 03882 LH_START_PROC("LHCheckColorsPrivate") 03883 03884 SetMem(&info, sizeof(ColorSpaceInfo), 0); 03885 SetMem(&calcParam, sizeof(CMCalcParam), 0); 03886 03887 /* disabling check colors with Named Color Profile */ 03888 if ( modelingData->hasNamedColorProf == NamedColorProfileOnly || 03889 modelingData->hasNamedColorProf == NamedColorProfileAtEnd ){ 03890 err = unimpErr; 03891 goto CleanupAndExit; 03892 } 03893 03894 info.origSizeIn = 16; 03895 info.origSizeOut = 16; 03896 info.usedSizeIn = 16; 03897 info.usedSizeOut = 16; 03898 03899 if( (modelingData)->gamutLutParam.colorLut == 0 )return cmMethodError; 03900 LOCK_DATA((modelingData)->gamutLutParam.inputLut); 03901 LOCK_DATA((modelingData)->gamutLutParam.colorLut); 03902 LOCK_DATA((modelingData)->gamutLutParam.outputLut); 03903 03904 FillLutParamChk(&lutParam, modelingData); 03905 FillCalcParamCM(&calcParam, &lutParam, myColors, count ); 03906 03907 AllocBufferCheckCM(&calcParam, &info); 03908 03909 info.inPlace = info.tempOutBuffer == nil; 03910 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 03911 if (calcRoutine == nil) 03912 { 03913 err = cmMethodError; 03914 goto CleanupAndExit; 03915 } 03916 03917 err = CallCalcProc(calcRoutine, &calcParam, &lutParam); 03918 03919 Convert8To1( (Ptr)info.tempOutBuffer, (Ptr)result, info.processedLinesIn, calcParam.cmLineCount, count, count*sizeof(CMColor)); 03920 03921 DisposeIfPtr((Ptr)info.tempOutBuffer); 03922 03923 CleanupAndExit: 03924 UNLOCK_DATA((modelingData)->gamutLutParam.inputLut); 03925 UNLOCK_DATA((modelingData)->gamutLutParam.colorLut); 03926 UNLOCK_DATA((modelingData)->gamutLutParam.outputLut); 03927 03928 LH_END_PROC("LHCheckColorsPrivate") 03929 return err; 03930 }

CMError LHCheckColorsPrivateMS CMMModelPtr  modelingData,
CMColor myColors,
UINT32  count,
UINT8 result
 

Definition at line 3797 of file w98/lh_core/runtime.c.

References CalcProcPtr, CallCalcProc, CMError, cmGraySpace8Bit, cmMethodError, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, ConvertNamedIndexToPCS(), FillCalcParamCM(), FillLutParamChk(), FindCalcRoutine(), ColorSpaceInfo::inPlace, LH_END_PROC, LH_START_PROC, LOCK_DATA, NamedColorProfileAtBegin, NamedColorProfileAtEnd, NamedColorProfileOnly, nil, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, CMCalcParam::outputData, Ptr, SetMem(), UINT8, unimpErr, UNLOCK_DATA, ColorSpaceInfo::usedSizeIn, and ColorSpaceInfo::usedSizeOut.

Referenced by CWCheckColorsMS().

03801 { 03802 CMCalcParam calcParam; 03803 CMLutParam lutParam; 03804 CMError err = -1; 03805 ColorSpaceInfo info; 03806 CalcProcPtr calcRoutine = nil; 03807 03808 LH_START_PROC("LHCheckColorsPrivateMS") 03809 03810 if( (modelingData)->gamutLutParam.colorLut == 0 )return cmMethodError; 03811 LOCK_DATA((modelingData)->gamutLutParam.inputLut); 03812 LOCK_DATA((modelingData)->gamutLutParam.colorLut); 03813 LOCK_DATA((modelingData)->gamutLutParam.outputLut); 03814 03815 /* preprocess for NamedColor stuff */ 03816 if (modelingData->hasNamedColorProf == NamedColorProfileOnly){ 03817 err = unimpErr; 03818 goto CleanupAndExit; 03819 } 03820 else if (modelingData->hasNamedColorProf==NamedColorProfileAtBegin){ 03821 err = ConvertNamedIndexToPCS(modelingData,myColors,count); 03822 if (err) goto CleanupAndExit; 03823 } 03824 03825 SetMem(&info, sizeof(ColorSpaceInfo), 0); 03826 SetMem(&calcParam, sizeof(CMCalcParam), 0); 03827 03828 info.origSizeIn = 16; 03829 info.origSizeOut = 8; 03830 info.usedSizeIn = 16; 03831 info.usedSizeOut = 8; 03832 03833 FillLutParamChk(&lutParam, modelingData); 03834 FillCalcParamCM(&calcParam, &lutParam, myColors, count ); 03835 calcParam.outputData[0] = (Ptr)result; 03836 calcParam.cmOutputBytesPerLine = count*sizeof(UINT8); 03837 calcParam.cmOutputPixelOffset = 1; 03838 calcParam.cmOutputColorSpace = cmGraySpace8Bit; /* cmGraySpace is 16 bit */ 03839 03840 03841 info.inPlace = (UINT8 *)myColors == result; 03842 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 03843 if (calcRoutine == nil) 03844 { 03845 err = cmMethodError; 03846 goto CleanupAndExit; 03847 } 03848 03849 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); 03850 if (err) 03851 goto CleanupAndExit; 03852 03853 /* postprocess for NamedColor stuff */ 03854 if( modelingData->hasNamedColorProf == NamedColorProfileAtEnd ){ 03855 err = unimpErr; 03856 goto CleanupAndExit; 03857 } 03858 CleanupAndExit: 03859 UNLOCK_DATA((modelingData)->gamutLutParam.inputLut); 03860 UNLOCK_DATA((modelingData)->gamutLutParam.colorLut); 03861 UNLOCK_DATA((modelingData)->gamutLutParam.outputLut); 03862 03863 LH_END_PROC("LHCheckColorsPrivateMS") 03864 return err; 03865 }

CMError LHMatchBitMapPlanePrivate CMMModelPtr  modelingData,
const LH_CMBitmapPlane bitMapLH,
CMBitmapCallBackUPP  progressProc,
void *  refCon,
LH_CMBitmapPlane matchedBitMapLH
 

Definition at line 4464 of file w98/lh_core/runtime.c.

References Boolean, CalcProcPtr, CallCalcProc, CallCMBitmapCallBackProc, CheckInputColorSpace(), CheckOutputColorSpace(), cmAlphaSpace, CMError, CMCalcParam::cmInputColorSpace, CMCalcParam::cmInputPixelOffset, cmInvalidDstMap, cmMethodError, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, CMLutParam::colorLut, CMLutParam::colorLutInDim, CMLutParam::colorLutOutDim, CMCalcParam::copyAlpha, DisposeIfPtr(), LH_CMBitmapPlane::elementOffset, FALSE, FillCalcParam(), FillLutParam(), FindCalcRoutine(), LH_CMBitmapPlane::height, CMBitmap::height, LH_CMBitmapPlane::image, CMBitmap::image, ColorSpaceInfo::inPlace, CMCalcParam::inputData, CMLutParam::inputLut, LH_END_PROC, LH_START_PROC, LOCK_DATA, nil, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, OSType, CMCalcParam::outputData, CMLutParam::outputLut, LH_CMBitmapPlane::pixelSize, CMBitmap::pixelSize, Ptr, LH_CMBitmapPlane::rowBytes, CMBitmap::rowBytes, SetMem(), SINT32, LH_CMBitmapPlane::space, CMBitmap::space, ColorSpaceInfo::tempInBuffer, ColorSpaceInfo::tempOutBuffer, TRUE, UNLOCK_DATA, LH_CMBitmapPlane::width, and CMBitmap::width.

Referenced by CWMatchBitmapPlane().

04469 { 04470 CMCalcParam calcParam; 04471 CMLutParam lutParam; 04472 CMError err = -1; 04473 ColorSpaceInfo info; 04474 CalcProcPtr calcRoutine = nil; 04475 LH_CMBitmapPlane * secondBitmapLH = matchedBitMapLH; 04476 OSType inColorSpace = (modelingData)->firstColorSpace; 04477 OSType outColorSpace = (modelingData)->lastColorSpace; 04478 Boolean progressProcWasCalled = FALSE; 04479 Boolean matchInPlace = FALSE; 04480 SINT32 dimLoop; 04481 04482 LH_START_PROC("LHMatchBitMapPlanePrivate") 04483 04484 SetMem(&info, sizeof(ColorSpaceInfo), 0); 04485 SetMem(&calcParam, sizeof(CMCalcParam), 0); 04486 04487 if (secondBitmapLH == nil) 04488 { 04489 secondBitmapLH = (LH_CMBitmapPlane *)bitMapLH; 04490 matchInPlace = TRUE; 04491 } 04492 04493 LOCK_DATA((modelingData)->lutParam.inputLut); 04494 LOCK_DATA((modelingData)->lutParam.colorLut); 04495 LOCK_DATA((modelingData)->lutParam.outputLut); 04496 04497 /* create CMBitmap based on the LH_CMBitmapPlane - so we can use the 'standard' setup functions */ 04498 { 04499 CMBitmap bitMap; 04500 CMBitmap secondBitmap; 04501 04502 bitMap.image = bitMapLH->image[0]; 04503 bitMap.width = bitMapLH->width; 04504 bitMap.height = bitMapLH->height; 04505 bitMap.rowBytes = bitMapLH->rowBytes; 04506 bitMap.pixelSize = bitMapLH->pixelSize; 04507 bitMap.space = bitMapLH->space; 04508 04509 secondBitmap.image = secondBitmapLH->image[0]; 04510 secondBitmap.width = secondBitmapLH->width; 04511 secondBitmap.height = secondBitmapLH->height; 04512 secondBitmap.rowBytes = secondBitmapLH->rowBytes; 04513 secondBitmap.pixelSize = secondBitmapLH->pixelSize; 04514 secondBitmap.space = secondBitmapLH->space; 04515 04516 FillLutParam(&lutParam, modelingData); 04517 FillCalcParam(&calcParam, &bitMap, &secondBitmap); 04518 04519 err = CheckInputColorSpace(&bitMap,&calcParam, &info, inColorSpace, lutParam.colorLutInDim ); 04520 if (err) 04521 goto CleanupAndExit; 04522 err = CheckOutputColorSpace(&secondBitmap,&calcParam, &info, outColorSpace, lutParam.colorLutOutDim ); 04523 if (err) 04524 goto CleanupAndExit; 04525 } 04526 04527 /* now update the input/output data pointers */ 04528 for (dimLoop = 0; dimLoop < 8; dimLoop++) 04529 { 04530 calcParam.inputData[dimLoop] = bitMapLH->image[dimLoop]; 04531 calcParam.outputData[dimLoop] = secondBitmapLH->image[dimLoop]; 04532 } 04533 04534 calcParam.cmInputPixelOffset = bitMapLH->elementOffset; 04535 calcParam.cmOutputPixelOffset = secondBitmapLH->elementOffset; 04536 if (bitMapLH == secondBitmapLH) /* matching in place - check if pixeloffsets are ok */ 04537 { 04538 if (calcParam.cmInputPixelOffset < calcParam.cmOutputPixelOffset) 04539 { 04540 err = cmInvalidDstMap; 04541 goto CleanupAndExit; 04542 } 04543 if (info.origSizeIn * lutParam.colorLutInDim < info.origSizeOut * lutParam.colorLutOutDim) 04544 { 04545 err = cmInvalidDstMap; 04546 goto CleanupAndExit; 04547 } 04548 } else 04549 { 04550 calcParam.copyAlpha = (calcParam.cmInputColorSpace & cmAlphaSpace) && (calcParam.cmOutputColorSpace & cmAlphaSpace); 04551 } 04552 04553 info.inPlace = info.tempInBuffer == nil && info.tempOutBuffer == nil; 04554 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 04555 if (calcRoutine == nil) 04556 { 04557 err = cmMethodError; 04558 goto CleanupAndExit; 04559 } 04560 04561 /* ------------------------------------------------- 8 or 16 bit data --------------------------------------------------------- */ 04562 if ((info.tempInBuffer == nil) && (info.tempOutBuffer == nil)) 04563 { 04564 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); 04565 } 04566 /* ----------------------------------------------- input is 5 or 10 bit ------------------------------------------------------- */ 04567 else if ((info.tempInBuffer != nil) && (info.tempOutBuffer == nil)) 04568 { 04569 DisposeIfPtr((Ptr)info.tempInBuffer); 04570 } 04571 /* ----------------------------------------------- output is 5 or 10 bit ------------------------------------------------------- */ 04572 else if ((info.tempInBuffer == nil) && (info.tempOutBuffer != nil)) 04573 { 04574 DisposeIfPtr((Ptr)info.tempOutBuffer); 04575 } 04576 /* ------------------------------------------ input and output are 5 or 10 bit ------------------------------------------------- */ 04577 else 04578 { 04579 DisposeIfPtr((Ptr)info.tempInBuffer); 04580 DisposeIfPtr((Ptr)info.tempOutBuffer); 04581 } 04582 04583 if (progressProcWasCalled) 04584 CallCMBitmapCallBackProc ( progressProc, 0, 0, (void *)refCon ); 04585 CleanupAndExit: 04586 UNLOCK_DATA((modelingData)->lutParam.inputLut); 04587 UNLOCK_DATA((modelingData)->lutParam.colorLut); 04588 UNLOCK_DATA((modelingData)->lutParam.outputLut); 04589 04590 LH_END_PROC("LHMatchBitMapPlanePrivate") 04591 return err; 04592 }

CMError LHMatchBitMapPrivate CMMModelPtr  modelingData,
const CMBitmap inBitMap,
CMBitmapCallBackUPP  progressProc,
void *  refCon,
CMBitmap outBitMap
 

Definition at line 3995 of file w98/lh_core/runtime.c.

References Boolean, CalcProcPtr, CallCalcProc, CallCMBitmapCallBackProc, CheckInputColorSpace(), CheckOutputColorSpace(), cmAlphaSpace, CMError, CMCalcParam::cmInputBytesPerLine, CMCalcParam::cmInputColorSpace, CMCalcParam::cmInputPixelOffset, cmInvalidDstMap, CMCalcParam::cmLineCount, cmMethodError, CMCalcParam::cmOutputBytesPerLine, CMCalcParam::cmOutputColorSpace, CMCalcParam::cmOutputPixelOffset, CMCalcParam::cmPixelPerLine, CMLutParam::colorLut, CMLutParam::colorLutInDim, CMLutParam::colorLutOutDim, Convert10To16(), Convert16To10(), Convert5To8(), Convert8To5(), ConvertIndexToLabBitmap(), ConvertLabToIndexBitmap(), CMCalcParam::copyAlpha, CopyIndexData(), DisposeIfPtr(), FALSE, FillCalcParam(), FillLutParam(), FindCalcRoutine(), CMBitmap::height, CMBitmap::image, ColorSpaceInfo::inPlace, CMCalcParam::inputData, CMLutParam::inputLut, ColorSpaceInfo::inputPixelSize, kMaxTempBlock, kProgressTicks, LH_END_PROC, LH_START_PROC, LOCK_DATA, NamedColorProfileAtBegin, NamedColorProfileAtEnd, NamedColorProfileOnly, nil, NoNamedColorProfile, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, OSType, CMCalcParam::outputData, CMLutParam::outputLut, ColorSpaceInfo::outputPixelSize, ColorSpaceInfo::processedLinesIn, Ptr, CMBitmap::rowBytes, SetMem(), SetOutputColorSpaceInplace(), SINT32, CMBitmap::space, ColorSpaceInfo::tempInBuffer, ColorSpaceInfo::tempOutBuffer, TickCount(), TRUE, UNLOCK_DATA, userCanceledErr, and CMBitmap::width.

Referenced by CWMatchBitmap().

04000 { 04001 CMCalcParam calcParam; 04002 CMLutParam lutParam; 04003 CMError err = -1; 04004 ColorSpaceInfo info; 04005 CalcProcPtr calcRoutine = nil; 04006 CMBitmap bitMapOut; 04007 CMBitmap bitMapIn = *inBitMap; 04008 OSType inColorSpace = modelingData->firstColorSpace; 04009 OSType outColorSpace = modelingData->lastColorSpace; 04010 Boolean progressProcWasCalled = FALSE; 04011 SINT32 offset; 04012 SINT32 progressTimer; 04013 SINT32 dimLoop; 04014 Boolean matchInPlace = FALSE; 04015 long progressProcCount = 0; 04016 SINT32 inLineCount; 04017 Ptr aBuffer; 04018 04019 LH_START_PROC("LHMatchBitMapPrivate") 04020 04021 LOCK_DATA((modelingData)->lutParam.inputLut); 04022 LOCK_DATA((modelingData)->lutParam.colorLut); 04023 LOCK_DATA((modelingData)->lutParam.outputLut); 04024 04025 if( outBitMap == nil ){ 04026 bitMapOut = *inBitMap; 04027 matchInPlace = TRUE; 04028 } 04029 else{ 04030 bitMapOut = *outBitMap; 04031 } 04032 04033 SetMem(&info, sizeof(ColorSpaceInfo), 0); 04034 SetMem(&calcParam, sizeof(CMCalcParam), 0); 04035 04036 FillLutParam(&lutParam, modelingData); 04037 FillCalcParam(&calcParam, &bitMapIn, &bitMapOut); 04038 04039 err = CheckInputColorSpace( &bitMapIn, &calcParam, &info, inColorSpace, lutParam.colorLutInDim ); 04040 inLineCount = calcParam.cmLineCount; 04041 if (err) 04042 goto CleanupAndExit; 04043 04044 if (matchInPlace){ 04045 err = SetOutputColorSpaceInplace( &calcParam, &info, outColorSpace); 04046 if (err) 04047 goto CleanupAndExit; 04048 } 04049 err = CheckOutputColorSpace( &bitMapOut, &calcParam, &info, outColorSpace, lutParam.colorLutOutDim ); 04050 if (err) 04051 goto CleanupAndExit; 04052 04053 if (matchInPlace) /* matching in place - check if pixel sizes are ok */ 04054 { 04055 if (info.inputPixelSize < info.outputPixelSize) 04056 { 04057 err = cmInvalidDstMap; 04058 goto CleanupAndExit; 04059 } 04060 /* set the color space field to the output color space */ 04061 bitMapIn.space = calcParam.cmOutputColorSpace; 04062 } else 04063 { 04064 calcParam.copyAlpha = (calcParam.cmInputColorSpace & cmAlphaSpace) && (calcParam.cmOutputColorSpace & cmAlphaSpace); 04065 } 04066 04067 info.inPlace = bitMapOut.image == bitMapIn.image && info.tempInBuffer == nil && info.tempOutBuffer == nil; 04068 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 04069 if (calcRoutine == nil) 04070 { 04071 err = cmMethodError; 04072 goto CleanupAndExit; 04073 } 04074 04075 if( info.inPlace && calcParam.cmInputPixelOffset < calcParam.cmOutputPixelOffset ){ 04076 for( dimLoop=0; dimLoop<8; dimLoop++){ /* now work backwards */ 04077 calcParam.inputData[dimLoop] = (Ptr)calcParam.inputData[dimLoop] + (calcParam.cmLineCount-1) * calcParam.cmInputBytesPerLine + (calcParam.cmPixelPerLine-1) * calcParam.cmInputPixelOffset; 04078 calcParam.outputData[dimLoop] = (Ptr)calcParam.outputData[dimLoop] + (calcParam.cmLineCount-1) * calcParam.cmOutputBytesPerLine + (calcParam.cmPixelPerLine-1) * calcParam.cmOutputPixelOffset; 04079 } 04080 calcParam.cmInputPixelOffset = -calcParam.cmInputPixelOffset; 04081 calcParam.cmOutputPixelOffset = -calcParam.cmOutputPixelOffset; 04082 calcParam.cmInputBytesPerLine = -calcParam.cmInputBytesPerLine; 04083 calcParam.cmOutputBytesPerLine = -calcParam.cmOutputBytesPerLine; 04084 } 04085 /* ------------------------------------------------- 8 or 16 bit data --------------------------------------------------------- */ 04086 if ((info.tempInBuffer == nil) && (info.tempOutBuffer == nil)&& modelingData->hasNamedColorProf == NoNamedColorProfile) 04087 { 04088 if (progressProc == nil) 04089 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); /* no callback proc - do it all in one step */ 04090 else 04091 { 04092 calcParam.cmLineCount = kMaxTempBlock / calcParam.cmInputBytesPerLine; 04093 if (calcParam.cmLineCount < 1) 04094 calcParam.cmLineCount = 1; 04095 else if (calcParam.cmLineCount > bitMapIn.height) 04096 calcParam.cmLineCount = bitMapIn.height; 04097 04098 progressTimer = TickCount(); 04099 while ( info.processedLinesIn < bitMapIn.height ) 04100 { 04101 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); 04102 04103 for (dimLoop = 0; dimLoop< lutParam.colorLutInDim; dimLoop++) 04104 calcParam.inputData[dimLoop] = (Ptr)calcParam.inputData[dimLoop] + calcParam.cmLineCount * calcParam.cmInputBytesPerLine; 04105 04106 for (dimLoop = 0; dimLoop< lutParam.colorLutOutDim; dimLoop++) 04107 calcParam.outputData[dimLoop] = (Ptr)calcParam.outputData[dimLoop] + calcParam.cmLineCount * calcParam.cmOutputBytesPerLine; 04108 04109 info.processedLinesIn += calcParam.cmLineCount; 04110 if ( info.processedLinesIn + calcParam.cmLineCount > bitMapIn.height ) 04111 calcParam.cmLineCount = bitMapIn.height-info.processedLinesIn; 04112 04113 /* - - - - - handle CMBitmapCallBackProc - - - - - */ 04114 if ( progressProc && ( progressTimer + kProgressTicks < (SINT32)TickCount()) ) 04115 { 04116 progressProcWasCalled = TRUE; 04117 if (CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, info.processedLinesIn, (void *)refCon )) 04118 { 04119 info.processedLinesIn = bitMapIn.height; 04120 err = userCanceledErr; 04121 } else 04122 progressTimer = TickCount(); 04123 progressProcCount = info.processedLinesIn; 04124 } 04125 } 04126 } 04127 } 04128 else if (modelingData->hasNamedColorProf != NamedColorProfileOnly ){ 04129 info.processedLinesIn = 0; 04130 progressTimer = TickCount(); 04131 if( info.tempInBuffer && info.tempOutBuffer ){ 04132 if( inLineCount > calcParam.cmLineCount )inLineCount = calcParam.cmLineCount; 04133 } 04134 else if( info.tempInBuffer ){ 04135 if( progressProc && modelingData->hasNamedColorProf == NamedColorProfileAtEnd ){ 04136 inLineCount /= 32; 04137 if( inLineCount < 1 ) inLineCount = 1; 04138 } 04139 } 04140 else if( info.tempOutBuffer ){ 04141 inLineCount = calcParam.cmLineCount; 04142 } 04143 else if( progressProc ){ 04144 inLineCount = kMaxTempBlock / calcParam.cmInputBytesPerLine; 04145 if (inLineCount < 1) 04146 inLineCount = 1; 04147 else if (inLineCount > bitMapIn.height) 04148 inLineCount = bitMapIn.height; 04149 if( modelingData->hasNamedColorProf == NamedColorProfileAtEnd ){ 04150 inLineCount /= 32; 04151 if( inLineCount < 1 ) inLineCount = 1; 04152 } 04153 } 04154 while ( info.processedLinesIn < bitMapIn.height ) 04155 { 04156 if ( info.processedLinesIn + inLineCount > bitMapIn.height ) 04157 inLineCount = bitMapIn.height-info.processedLinesIn; 04158 04159 if (info.origSizeIn == 5 ) /* input is 5 bit */ 04160 Convert5To8 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04161 #ifdef PI_Application_h 04162 else if (info.origSizeIn == 6 ) /* output is 5 bit */ 04163 Convert565To8 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04164 #endif 04165 else if (info.origSizeIn == 10 ) 04166 Convert10To16 ( bitMapIn.image, (Ptr)info.tempInBuffer, info.processedLinesIn, inLineCount, bitMapIn.width, bitMapIn.rowBytes ); 04167 04168 if (modelingData->hasNamedColorProf == NamedColorProfileAtBegin ){ 04169 err = ConvertIndexToLabBitmap( modelingData, bitMapIn.image, 04170 (Ptr)info.tempInBuffer, info.processedLinesIn, 04171 inLineCount, bitMapIn.width, 04172 bitMapIn.rowBytes, 04173 calcParam.cmInputBytesPerLine, 04174 calcParam.cmInputPixelOffset*8 ); 04175 if (err) 04176 goto CleanupAndExit; 04177 } 04178 calcParam.cmLineCount = inLineCount; 04179 err = CallCalcProc( calcRoutine, &calcParam, &lutParam ); 04180 if (err) 04181 goto CleanupAndExit; 04182 04183 if (modelingData->hasNamedColorProf == NamedColorProfileAtEnd ){ 04184 if( info.tempOutBuffer )aBuffer = (Ptr)info.tempOutBuffer; 04185 else aBuffer = bitMapOut.image; 04186 err = ConvertLabToIndexBitmap( modelingData, aBuffer, 04187 info.processedLinesIn, 04188 calcParam.cmLineCount, 04189 bitMapOut.width, bitMapOut.rowBytes ); 04190 if (err) 04191 goto CleanupAndExit; 04192 } 04193 04194 if( info.origSizeOut == 5 ) /* output is 5 bit */ 04195 Convert8To5 ( (Ptr)info.tempOutBuffer, bitMapOut.image, info.processedLinesIn, calcParam.cmLineCount, bitMapOut.width, bitMapOut.rowBytes); 04196 #ifdef PI_Application_h 04197 else if( info.origSizeOut == 6 ) /* output is 5 bit */ 04198 Convert8To565 ( (Ptr)info.tempOutBuffer, bitMapOut.image, info.processedLinesIn, calcParam.cmLineCount, bitMapOut.width, bitMapOut.rowBytes); 04199 #endif 04200 else if( info.origSizeOut == 10 ) /* output is 10 bit */ 04201 Convert16To10 ( (Ptr)info.tempOutBuffer, bitMapOut.image, info.processedLinesIn, calcParam.cmLineCount, bitMapOut.width, bitMapOut.rowBytes); 04202 04203 info.processedLinesIn += inLineCount; 04204 /* - - - - - handle CMBitmapCallBackProc - - - - - */ 04205 if ( progressProc && ( progressTimer + kProgressTicks < (SINT32)TickCount()) ) 04206 { 04207 progressProcWasCalled = TRUE; 04208 if (CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, info.processedLinesIn, (void *)refCon )) 04209 { 04210 info.processedLinesIn = bitMapIn.height; 04211 err = userCanceledErr; 04212 } else 04213 progressTimer = TickCount(); 04214 progressProcCount = info.processedLinesIn; 04215 } 04216 if( !info.tempInBuffer ){ 04217 offset = calcParam.cmLineCount * calcParam.cmInputBytesPerLine; 04218 for (dimLoop = 0; dimLoop< lutParam.colorLutInDim; dimLoop++) 04219 calcParam.inputData[dimLoop] = (Ptr)calcParam.inputData[dimLoop] + offset; 04220 } 04221 if( !info.tempOutBuffer ){ 04222 offset = calcParam.cmLineCount * calcParam.cmOutputBytesPerLine; 04223 for (dimLoop = 0; dimLoop< lutParam.colorLutOutDim; dimLoop++) 04224 calcParam.outputData[dimLoop] = (Ptr)calcParam.outputData[dimLoop] + offset; 04225 } 04226 } 04227 DisposeIfPtr((Ptr)info.tempInBuffer); 04228 DisposeIfPtr((Ptr)info.tempOutBuffer); 04229 } 04230 else{ 04231 CopyIndexData( &bitMapIn, &bitMapOut, &info ); 04232 DisposeIfPtr((Ptr)info.tempInBuffer); 04233 } 04234 if (err) 04235 goto CleanupAndExit; 04236 04237 if( progressProcWasCalled && progressProcCount != bitMapIn.height ) 04238 CallCMBitmapCallBackProc ( progressProc, bitMapIn.height, bitMapIn.height, (void *)refCon ); 04239 CleanupAndExit: 04240 UNLOCK_DATA((modelingData)->lutParam.inputLut); 04241 UNLOCK_DATA((modelingData)->lutParam.colorLut); 04242 UNLOCK_DATA((modelingData)->lutParam.outputLut); 04243 04244 LH_END_PROC("LHMatchBitMapPrivate") 04245 04246 return err; 04247 }

CMError LHMatchColorsPrivate CMMModelPtr  modelingData,
CMColor myColors,
SINT32  count
 

Definition at line 3733 of file w98/lh_core/runtime.c.

References CalcProcPtr, CallCalcProc, CMError, cmMethodError, CMLutParam::colorLut, ConvertNamedIndexToColors(), ConvertNamedIndexToPCS(), ConvertPCSToNamedIndex(), FillCalcParamCM(), FillLutParam(), FindCalcRoutine(), ColorSpaceInfo::inPlace, CMLutParam::inputLut, LH_END_PROC, LH_START_PROC, LOCK_DATA, NamedColorProfileAtBegin, NamedColorProfileOnly, nil, ColorSpaceInfo::origSizeIn, ColorSpaceInfo::origSizeOut, CMLutParam::outputLut, SetMem(), TRUE, UNLOCK_DATA, ColorSpaceInfo::usedSizeIn, and ColorSpaceInfo::usedSizeOut.

03736 { 03737 CMCalcParam calcParam; 03738 CMLutParam lutParam; 03739 CMError err = -1; 03740 ColorSpaceInfo info; 03741 CalcProcPtr calcRoutine = nil; 03742 03743 LH_START_PROC("LHMatchColorsPrivate") 03744 03745 LOCK_DATA((modelingData)->lutParam.inputLut); 03746 LOCK_DATA((modelingData)->lutParam.colorLut); 03747 LOCK_DATA((modelingData)->lutParam.outputLut); 03748 03749 /* preprocess for NamedColor stuff */ 03750 if (modelingData->hasNamedColorProf == NamedColorProfileOnly){ 03751 err = ConvertNamedIndexToColors(modelingData,myColors,count); 03752 goto CleanupAndExit; 03753 } 03754 else if (modelingData->hasNamedColorProf==NamedColorProfileAtBegin){ 03755 err = ConvertNamedIndexToPCS(modelingData,myColors,count); 03756 if (err) goto CleanupAndExit; 03757 } 03758 03759 SetMem(&info, sizeof(ColorSpaceInfo), 0); 03760 SetMem(&calcParam, sizeof(CMCalcParam), 0); 03761 03762 info.origSizeIn = 16; 03763 info.origSizeOut = 16; 03764 info.usedSizeIn = 16; 03765 info.usedSizeOut = 16; 03766 03767 FillLutParam(&lutParam, modelingData); 03768 FillCalcParamCM(&calcParam, &lutParam, myColors, count ); 03769 03770 info.inPlace = TRUE; 03771 calcRoutine = FindCalcRoutine( &calcParam, &lutParam, &info, modelingData->lookup ); 03772 if (calcRoutine == nil) 03773 { 03774 err = cmMethodError; 03775 goto CleanupAndExit; 03776 } 03777 03778 err = CallCalcProc(calcRoutine,&calcParam, &lutParam); 03779 if (err) 03780 goto CleanupAndExit; 03781 03782 /* postprocess for NamedColor stuff */ 03783 err = ConvertPCSToNamedIndex(modelingData,myColors,count); 03784 03785 CleanupAndExit: 03786 UNLOCK_DATA((modelingData)->lutParam.inputLut); 03787 UNLOCK_DATA((modelingData)->lutParam.colorLut); 03788 UNLOCK_DATA((modelingData)->lutParam.outputLut); 03789 03790 LH_END_PROC("LHMatchColorsPrivate") 03791 return err; 03792 }

CMError SetOutputColorSpaceInplace CMCalcParamPtr  calcParam,
ColorSpaceInfo info,
OSType  outColorSpace
 

Referenced by LHMatchBitMapPrivate().


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