Programming with LEADTOOLS Color Conversion Functions
Once LEADTOOLS Color Conversion is installed to the system, the user is ready to begin programming. LEADTOOLS provides functions for converting between color-spaces using different methods and options. The toolkit supports conversions among RGB, BGR, YUV, CMYK, HSV, HLS, YIQ, CMY, LAB, YCCK, Y41P, UYVY, YUY2, YVU9, and YCC color spaces.
LEADTOOLS Color Conversion provides two methods to accomplish conversion:
Direct Conversion.
Indirect Conversion.
Direct Conversion
This process doesn't require any initialization code. LColor::ConvertDirect can be called to convert directly between two color spaces. This function uses built-in equations and options and is the same as using the second methods with USE_BUILTIN.
LColor::ConvertDirectToBitmap can also be used to convert directly, however this function will return the converted data a LBitmapBase calss object. This function is valid for conversions from any color space to RGB or BGR.
Indirect Conversion
To begin using the available indirect conversion feature in the LEADTOOLS Color Conversion toolkit, the user should declare an instance of CONVERSION_PARAMS structure; then fill it depending on the conversion process options. The user may optionally utilize emulation tables. For more information, refer to Emulation Tables.
Next, the user should initialize a Color Conversion object. For more information refer to Initializing a Color Conversion class object.
After the user has established a Color Conversion object, he or she is ready to convert image data from a specific one-color conversion model to another. For more information, refer to Conversion Process.
When the Color Conversion class object is no longer needed, it should be freed. For more information, refer to Freeing the Color Conversion class object.
The user can also initiate a conversion visually with LColor::ClrDlg, which brings up a color space option dialog. Based on the option set in that dialog, a Color Conversion object will be returned and/or the option specified in the dialog packed in CONVERSION_PARAMS instance.