The Color Conversion C API provides built-in conversion. To do a built-in conversion, follow the steps below:
Define the following global variables:
Dim RGBData(100) As ByteDim LABData(100) As ByteDim nWidth As IntegerDim nHeight As IntegerDim nInAlign As IntegerDim nOutAlign As IntegerDim ClrHandle As Long 'color handleDim cnvParam As CONVERSION_PARAMS 'conversion paramsDim wtPoint As WHITEPOINT 'white point definition
Set the conversion options by filling a CONVERSION_PARAMS structure:
'set the whitepointwtPoint.nWhitePoint = CIELAB\_D50wtPoint.xWhite = 0wtPoint.yWhite = 0'initialize the conversion structurecnvParam.uStructSize = Len(cnvParam)cnvParam.nQuantization = 8cnvParam.nMethod = USE_BUILTINcnvParam.nActiveMethod = USE_BUILTINcnvParam.pCmykParams = 0cnvParam.pLabParams = 0cnvParam.pYuvParams = 0cnvParam.sDstInputTable(0) = 0cnvParam.sInputProfile(0) = 0cnvParam.sOutputProfile(0) = 0cnvParam.pWpoint = VarPtr(wtPoint)
Initialize the color conversion handle with L_ClrInit:
L_ClrInit ClrHandle, CCS\_RGB, CCS\_LAB, cnvParam
L_ClrConvert ClrHandle, RGBData(0), LABData(0), nWidth, nHeight, nInAlign, nOutAlign
L_ClrFree ClrHandle