Built-in Conversion

The Color Conversion C DLL provides built-in conversion. To do a built-in conversion, follow the steps below:

1.

Define the following global variables:

HANDLE ClrHandle;
CONVERSION_PARAMS params;
WHITEPOINT WPoint;
L_UCHAR *pRGBData;
L_UCHAR *pLABData;
L_INT nWidth;
L_INT nHeight;
L_INT nInAlign;
L_INT nOutAlign;

2.

Set the conversion options by filling a CONVERSION_PARAMS structure:

ZeroMemory(&params, 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;

3.

Initialize the color conversion handle with L_ClrInit():

L_ClrInit(&ClrHandle, CCS_RGB, CCS_LAB, &params);

4.

Convert from RGB to CIELab:

L_ClrConvert(ClrHandle, pRGBData, pLABData, nWidth, nHeight, nInAlign, nOutAlign);

 

5.

At the end, free the color conversion handle:

L_ClrFree(ClrHandle);

See Also:

Introduction

Programming with Color Conversion

Color Conversion C DLL Function Groups

Visual C++ Tutorials

Delphi Tutorials

Visual Basic Tutorials