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 Byte
Dim LABData(100) As Byte
Dim nWidth As Integer
Dim nHeight As Integer
Dim nInAlign As Integer
Dim nOutAlign As Integer
Dim ClrHandle As Long 'color handle
Dim cnvParam As CONVERSION_PARAMS 'conversion params
Dim wtPoint As WHITEPOINT 'white point definition
Set the conversion options by filling a CONVERSION_PARAMS structure:
'set the whitepoint
wtPoint.nWhitePoint = CIELAB\_D50
wtPoint.xWhite = 0
wtPoint.yWhite = 0
'initialize the conversion structure
cnvParam.uStructSize = Len(cnvParam)
cnvParam.nQuantization = 8
cnvParam.nMethod = USE_BUILTIN
cnvParam.nActiveMethod = USE_BUILTIN
cnvParam.pCmykParams = 0
cnvParam.pLabParams = 0
cnvParam.pYuvParams = 0
cnvParam.sDstInputTable(0) = 0
cnvParam.sInputProfile(0) = 0
cnvParam.sOutputProfile(0) = 0
cnvParam.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