typedef struct _CONVERSION_PARAMS
{
L_UINT uStructSize;
L_INT nActiveMethod;
LPWHITEPOINT pWpoint;
L_TCHAR sInputProfile[L_MAXPATH];
pMEMICCPROFILE pMemInputProfile;
L_TCHAR sOutputProfile[L_MAXPATH];
pMEMICCPROFILE pMemOutputProfile;
L_TCHAR sDstInputTable[L_MAXPATH];
LPCMYK_PARAMS pCmykParams;
LPYUV_PARAMS pYuvParams;
LPLAB_PARAMS pLabParams;
L_INT nMethod;
L_INT nQuantization; /* Reserved, must be 8*/
L_UINT uFlags;
} CONVERSION_PARAMS, *LPCONVERSION_PARAMS;
Size of this structure.
Active conversion method. Possible values should be one and only one of the following:
Value | Meaning |
---|---|
USE_BUILTIN | [1] For equations. |
USE_ICC | [2] For profiles. |
USE_CUSTOM_ICC | [4] For custom profiles. |
USE_ET | [8] For emulation tables. |
USE_CUSTOM_ET | [16] For custom emulation tables |
USE_AUTO | [32] For best conversion. Since the nMethod member may contain more than one conversion method, this member is used to determine which method to use in the conversion process. |
Pointer to a WHITEPOINT structure that describes the white point.
Character string that contains the input profile name, used with USE_CUSTOM_ICC active conversion method (nActiveMethod member).
Pointer to an MEMICCPROFILE structure that contains information about the input memory profile to be used as the input profile.
Character string that contains the output profile name, used with USE_CUSTOM_ICC active conversion method (nActiveMethod member).
Pointer to a MEMICCPROFILE structure that contains information about the input memory profile to be used as the output profile.
Character string that contains the destination image name for emulation, used with USE_CUSTOM_ICC active conversion method (nActiveMethod member.
Pointer to a CMYK_PARAMS structure that describes the CMYK conversion properties. If this parameter is NULL, default values are assumed.
Pointer to a YUV PARAMS structure that describes the YUV conversion properties. If this parameter is NULL, default values are assumed.
Pointer to a LAB PARAMS structure that describes the CIELab conversion properties. If this parameter is NULL, default values are assumed.
Conversion method when the conversion method is used with the L_ClrInit function. Possible values are:
Value | Meaning |
---|---|
USE_BUILTIN | [1] For equations (default). |
USE_ICC | [2] For profiles. |
USE_CUSTOM_ICC | [4] For custom profiles. |
USE_ET | [8] For emulation tables. This option is valid for CMYK to RGB, RGB to CIELab, and CIELab to RGB conversions only. |
USE_CUSTOM_ET | [16] For custom emulation tables. This option is valid for CMYK to RGB, RGB to CIELab, and CIELab to RGB conversions only. |
USE_AUTO | [32] For best conversion |
USE_ALL | [63] For all of the above |
The nMethod can be used to initialize the SDK with more than one conversion method. Therefore, the nActiveMethod member should be set with the conversion method to be used.
Use L_ClrSetConversionParams to switch between conversions by specifying CHANGE_ACTIVE_METHOD for this member.
When the conversion method is used with the L_ClrSetConversionParams function, the possible values are:
Value | Meaning |
---|---|
CHANGE_ACTIVE_METHOD | [1] Change the active method. |
CHANGE_CUSTOM_PROFILES | [2] Change profiles. |
CHANGE_WHITE_POINT | [4] Change white point. |
CHANGE_ET | [8] Change emulation tables. |
CHANGE_CMYK | [16] Change CMYK parameters. |
CHANGE_YUV | [32] Change YUV parameters. |
CHANGE_LAB | [64] Change LAB parameters |
CHANGE_ALL | [127] Change all of the above. |
Quantization level, must be 8.
Flags used to control the behavior of the color conversion. The default value is 0. The only flag available at the moment is:
Value | Meaning |
---|---|
LTCLR_DISABLE_WHITE_POINT_ADJUSTMENT | [0x0001] Disable automatic white point adjustment. |
The ICC specification requires that white is converted to pure white. However, some profiles convert white to off-white (very light gray). Such profiles could cause problems called "ink dot scum" in the printing world (lots of tiny dots on white paper).
LEADTOOLS automatically corrects these problems by adjusting the conversion formulas so that white is converted to pure white.
Earlier versions of LEADTOOLS did not perform this conversion. The LTCLR_DISABLE_WHITE_POINT_ADJUSTMENT flag is provided mainly for backwards compatibility.
The correct behavior is to set uFlags to 0.
You can obtain behavior similar to earlier versions of the toolkit by uFlags to LTCLR_DISABLE_WHITE_POINT_ADJUSTMENT.
By default, LEADTOOLS automatically corrects a problem called "Ink Dot Scum" in the printing world. The automatic correction causes white to be converted to pure white, even if the ICC profiles would convert white to a dirty white (something like RGB(227, 227, 227)). If you do not want the white to be automatically converted to pure white, you can set uFlags to LTCLR_DONT_FIX_SCUM_DOT.
If the conversion is from CMYK to RGB or RGB to/from CIELab, and the nActiveMethod member is set to USE_CUSTOM_ET, the user should specify the full path to the images in the sDstInputTable member. The following table shows the image dimensions to be used in the emulation tables that are passed to the sDstInputTable member:
Conversion | Image Dimensions | |
---|---|---|
CMYK to RGB | 289x289 RGB TIF image | |
RGB to CIELab | 190x190 CIELab TIF image | |
CIELab to RGB | 190x190 RGB TIFF image |
There are cmyk_src_image.tif, rgb_src_image.tif, and lab_src_image.tif images distributed with the library. They can be used and converted, using any tool, to their RGB, CIELab, and RGB equivalents respectively.
When using the custom ICC engine (USE_CUSTOM_ICC set in the nMethod member), there are two ways to specify the source and/or destination profiles:
Profiles from disk files: sInputProfile and sOutputProfile are used.
Profiles resident in memory: pMemInputProfile and pMemOutputProfile are used.
Any combination of the input and output profiles is allowed. For example, a file source profile can be used with a memory destination profile.
If all four options for source and destination profiles are set (sInputProfile, sOutputProfile, pMemInputProfile and pMemOutputProfile), the memory profiles get the highest priority. Therefore, if you set both sInputProfile and pMemInputProfile, only the source specified in pMemInputProfile will be used. In addition, if only a source profile is provided (either file or memory), without a destination profile, the ICC engine will use the default destination profile.
When using USE_ICC or USE_CUSTOM_ICC, any color that does not exist in ICC profile tables will be calculated as an average of the closest colors. If any color component is outside the range (i.e. above its maximum or below its minimum) that value will be cropped to the maximum/minimum value of that component in the specified color space.