Is this page helpful?

In this page

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:

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:

Copied to clipboard
L_VOID Tables_Convert_CMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput, L_INT nWidth, L_INT nHeight) 
{ 
   LColor clr; /*Color Conversion object*/ 
   CONVERSION_PARAMS params; /*Conversion options*/ 
    
   /* Zero initialize, this step is important*/ 
   ZeroMemory ( &params, 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 */ 
   clr.Initialize (CCS_CMYK, /*input color space*/ 
   CCS_RGB, /*output color space*/ 
   &params /*pointer to the initialization options*/ 
   ); 
    
   /* Convert the image buffer */ 
   clr.Convert (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 */ 
   clr.Free (); 
} 

The code below shows how a conversion can be done using user-defined tables:

Copied to clipboard
L_VOID Tables_Convert_CMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput, L_INT nWidth, L_INT nHeight) 
{ 
   LColor clr; /*Color Conversion object*/ 
   CONVERSION_PARAMS params; /*Conversion options*/ 
   ZeroMemory(&params, 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 */ 
   clr.Initialize (CCS_CMYK, /*input color space*/ 
   CCS_RGB, /*output color space*/ 
   &params /*pointer to the initialization options*/ 
   ); 
   /* convert the image buffer */ 
   clr.Convert (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 */ 
   clr.Free (); 
} 

See Also

Topics:

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Color Conversion C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.