Programming with LEADTOOLS Color Conversion Functions
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. L_ClrConvertDirect 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.
L_ClrConvertDirectToBitmap can also be used to convert directly, however this function will return a LEAD BITMAPHANDLE representation of the destination buffer. 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 handle. For more information refer to Initializing a Color Conversion Handle.
After the user has established a Color Conversion handle, 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 handle to the Color Conversion is no longer needed, it should be freed. For more information, refer to Freeing the Color Conversion Handle.
The user can also initiate a conversion visually with L_ClrDlg, which brings up a color space option dialog. Based on the option set in that dialog, a color handle will be returned and/or the option specified in the dialog packed in CONVERSION_PARAMS instance.
For more information, refer to:
Initializing a Color Conversion Handle