Contents

CWCheckColors

Tests a list of colors using a specified color world to see if they fall within the gamut of a destination device.

Declaration

CMError CWCheckColors (
   CMWorldRef cw,
   CMColor *myColors,
   size_t count,
   UInt8 *result
);

Parameters

  • cw:

    A reference to the color world of type Cmworldref describing how the test is to occur.

    The functions 1805079 Ncwnewcolorworld and 1805087 Cwconcatcolorworld both allocate color world references of type Cmworldref.

  • myColors:

    A pointer to an array containing a list of colors of type 1560453 Cmcolor to be checked.This function assumes the color values are specified in the data color space of the source profile.

  • count:

    The number of colors in the array. This is a one-based count.

  • result:

    A pointer to a buffer of packed bits. On return, each bit value is interpreted as a bit field with each bit representing a color in the array pointed to by myColors. You allocate enough memory to allow for 1 bit to represent each color in the myColors array. Bits in the result field are set to 1 if the corresponding color is out of gamut for the destination device. Ensure that the buffer you allocate is zeroed out before you call this function.

    To access the packed bit-array, use code similar to the following:

    inline bool GetNthBit (UInt8* result, int n)
    {
        return ( 0 != (result[n/8] & (128>>(n%8))) );
    }

    The result bit array indicates whether the colors in the list are in or out of gamut for the destination profile. If a bit is set, its corresponding color falls out of gamut for the destination device. The leftmost bit in the field corresponds to the first color in the list.

Return Value

A CMError value. See Result Codes.

Overview

The color test provides a preview of color matching using the specified color world.

All CMMs must support the CWCheckColors function.

If you have set a profile’s gamut-checking mask so that no gamut information is included—see Flag Mask Definitions for Version 2.x ProfilesCWCheckColors returns the cmCantGamutCheckError error.

The CWCheckColors function supports matching sessions set up with one of the multichannel color data types. CWCheckColors is not supported if the color world was initialized with a named color space profile.

See Also

Working With ColorWorlds