Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Emulation Tables
The LEAD Color Conversion toolkit provides emulation tables as one of its conversion methods. This method however is provided only for the following conversions:
CMYK to RGB.
CIELab to RGB
and RGB to CIELab
The Emulation tables' method supports both built-in and custom options. For built-in emulation tables, use the USE_ET option. The custom emulation tables' option, USE_CUSTOM_ET, provides custom conversion using user-supplied images, converted from the source images distributed with the library, by any tool, as follows:
Conversion |
Source |
Convert to |
CMYK to RGB |
src_cmyk_image.tif |
RGB image (i.e. dst_cmyk2rgb_image.tif) |
RGB to Lab |
src_rgb_image.tif |
Lab image (i.e. dst_rgb2lab_image.tif) |
Lab to RGB |
src_lab_image.tif |
RGB image (i.e. dst_lab2rgb_image.tif) |
A set of images, already converted and ready for use (dst_cmyk2rgb_image.tif, dst_rgb2lab_image.tif, and dst_lab2rgb_image.tif), is provided. However, using the provided set of converted images will produce the same results as the built-in emulation tables.
The code below shows how a conversion can be done using the built-in tables:
L_VOID Tables_Convert_CMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput, L_INT nWidth)
{
HANDLE ClrHandle /*Color Handle*/;
CONVERSION_PARAMS params /*Conversion options*/;
/* Zero initialize, this step is important*/
ZeroMemory (¶ms, sizeof (CONVERSION_PARAMS));
/*Conversion with options.
The conversion will be done with the options specified in the
params variable
*/
/* Set the params size */
params.uStructSize = sizeof (CONVERSION_PARAMS);
/* We want to use built-in emulation tables */
params.nMethod = USE_ET;
/* set the active conversion method */
params.nActiveMethod = USE_ET;
/* initialize the color conversion */
L_ClrInit (&ClrHandle, /*pointer to color handle to be returned*/
CCS_CMYK, /*input color space*/
CCS_RGB, /*output color space*/
¶ms /*pointer to the initialization options*/
);
/* Convert the image buffer */
L_ClrConvert (ClrHandle, /* conversion handle*/
pInput, /* input buffer*/
pOutput, /* output buffer*/
nWidth, /*pixel's width*/
nHeight, /*pixel's height*/
0, /* 0 bytes align*/
0); /*0 bytes align*/
/* free the conversion */
L_ClrFree (ClrHandle);
}
The code below shows how a conversion can be done using user-defined tables:
L_VOID Tables_Convert_CMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput, L_INT nWidth)
{
HANDLE ClrHandle /*Color Handle*/;
CONVERSION_PARAMS params /*Conversion options*/;
ZeroMemory(¶ms, sizeof(CONVERSION_PARAMS));
/*Conversion with options.
The conversion will be done with the options specified in the
params variable
*/
/* set the params size */
params.uStructSize = sizeof(CONVERSION_PARAMS);
/* we want to use custom emulation tables */
params.nMethod = USE_CUSTOM_ET;
/* set the active conversion method */
params.nActiveMethod = USE_CUSTOM_ET;
/* set the emulation tables */
lstrcpy(params.sDstInputTable, TEXT("C:\\RGBImage.tif"));
/* initialize the color conversion */
L_ClrInit (&ClrHandle, /*pointer to color handle to be returned*/
CCS_CMYK, /*input color space*/
CCS_RGB, /*output color space*/
¶ms /*pointer to the initialization options*/
);
/* convert the image buffer */
L_ClrConvert (ClrHandle, /* conversion handle */
pInput, /* input buffer */
pOutput, /* output buffer */
nWidth, /*pixel's width*/
nHeight, /*pixel's height*/
0, /* 0 bytes align*/
0); /*0 bytes align*/
/* free the conversion */
L_ClrFree (ClrHandle);
}
See Also:
Programming with Color Conversion