ImageGear for C and C++ on Windows v19.3 - Updated
IG_colorspace_conversion_is_applicable
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Color Space Conversion Functions > IG_colorspace_conversion_is_applicable

This function checks whether conversion is possible for the given combination of source and result color spaces.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_colorspace_conversion_is_applicable(
        enumIGColorSpaceIDs sourceSpace,
        const AT_INT* sourceChannelDepths,
        AT_INT sourceChannelCount,
        enumIGColorSpaceIDs resultSpace,
        LPCAT_COLORSPACE_CONVERSION_OPTIONS options,
        AT_BOOL* applicable
);

Arguments:

Name Type Description
sourceSpace enumIGColorSpaceIDs Color space from which to convert.
sourceChannelDepths const AT_INT* Array of channel depths for source color space.
sourceChannelCount AT_INT Number of channels in source color space.
resultSpace enumIGColorSpaceIDs Color space to which to convert.
options LPCAT_COLORSPACE_CONVERSION_OPTIONS Conversion options.
applicable AT_BOOL* This gets set to TRUE if conversion is possible, otherwise FALSE.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

None

Example:

 
Copy Code
/* Can we convert from 48-bit RGB to CMYK? */
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
AT_INT depths[] = { 16, 16, 16 }; /* Channel depths */
AT_BOOL bApplicable;    /* Is conversion applicable? */
nErrcount = IG_colorspace_conversion_is_applicable(
    IG_COLOR_SPACE_ID_RGB, depths, 3, 
    IG_COLOR_SPACE_ID_CMYK, NULL, &bApplicable);
/* bApplicable is TRUE */

Remarks:

In general, conversion cannot be constructed only if: 1) the result color space is indexed and 2) the source color space is something other than indexed or grayscale (8bpp or less). Options controls the conversion flow. You may pass NULL for Options if you don't want to specify any options.

For the detailed information about AT_COLORSPACE_CONVERSION_OPTIONS structure and the whole color conversion process please refer to the section Working with Color Space Conversion Engine.