The Color Conversion C++ Class Library provides built-in conversion. To do a built-in conversion, follow the steps below:
Define the following global variables:
LColor clr;CONVERSION_PARAMS params;WHITEPOINT WPoint;L_UCHAR *pRGBData;L_UCHAR *pLABData;L_INT nWidth;L_INT nHeight;L_INT nInAlign;L_INT nOutAlign;
Set the conversion options by filling a CONVERSION_PARAMS structure:
ZeroMemory(¶ms, sizeof(CONVERSION_PARAMS));params.pWpoint = &WPoint;params.uStructSize = sizeof(CONVERSION_PARAMS);params.pWpoint->nWhitePoint = CIELAB_D50;params.nQuantization = 8;params.nMethod = USE_BUILTIN;params.nActiveMethod = USE_BUILTIN;params.pWpoint->xWhite = 0.0;params.pWpoint->yWhite = 0.0;
Initialize the color conversion object with LColor::Initialize():
clr.Initialize (CCS_RGB, CCS_LAB, ¶ms); Convert from RGB to CIELab:
clr.Convert (pRGBData, pLABData, nWidth, nHeight, nInAlign, nOutAlign); At the end, free the color conversion object:
clr.Free();