ColorMatchToTarget  2BE6615 

The ColorMatchToTarget function enables or disables preview for the specified device context. When preview is enabled, colors in subsequent output to the specified device context are displayed as they would appear on the target device. This is useful for checking how well the target maps the specified colors in an image. To enable preview, image color matching must be enabled for both the target and the preview device context.

BOOL ColorMatchToTarget(

    HDC hdc,

 

    HDC hdcTarget,

 

    DWORD uiAction

 

   );

 

 

Parameters

hdc

Handle to the device context to use for preview, typically the display.

hdcTarget

Handle to the target device context, typically a printer.

uiAction

This parameter can have one of the following values:

Value

Meaning

CS_ENABLE

Enable preview; start matching colors through the target before displaying.

CS_DISABLE

Disable preview; stop matching colors through the target and restore the previous method for the preview device.

CS_DELETE_TRANSFORM

Disable preview and delete the color transformation used for previewing.

 

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

If you use the ColorMatchToTarget function to enable preview, your next call to this function must be to disable preview; you must not nest calls to enable preview. While preview is enabled, any changes you make to the color space or gamut matching method are temporarily ignored, but take effect when preview is disabled.

This function creates a color transformation that translates colors for the target device first, then translates colors for the preview device. You need not delete the color transformation using CS_DELETE_TRANSFORM because the system deletes the transformation when either of the devices is removed from the system, or when the color space is deleted. However, if the transform is not going to be used again, an application can free up the space taken by it.