Using GDI Functions With ICM

[This is preliminary documentation and subject to change.]

There are various functions in the graphics device interface (GDI) that use or operate on color data. Some are enabled for use with ICM and some are not. The following GDI functions are relevant to ICM:

Device Context Functions with ICM

CreateCompatibleDC
If the device context (DC) that is passed to this function through its hdc parameter is enabled for ICM, then the DC the function creates is also ICM-enabled. The source and destination color spaces are specified in the DC.
CreateDC
ICM can be enabled by setting the dmICMMethod member of the DEVMODE structure pointed to by the pInitData parameter to the appropriate value. For details, see the documentation in the Platform SDK on the DEVMODE structure.
ResetDC
The color profile of the device context specified by the hdc parameter will be reset based on the information in the DEVMODE structure specified by the lpInitData parameter.

Pen And Brush Functions with ICM

Brush Functions
No color management is done at brush creation. However, color management will be performed when the brush is selected into an ICM-enabled DC.
CreatePen
No color management is done at pen creation. However, color management will be performed when the brush is selected into an ICM-enabled DC.
ExtCreatePen
No color management is done at pen creation. However, color management will be performed when the brush is selected into an ICM-enabled DC.
SelectObject
If the object being selected is a brush or a pen, color management is performed.
SetDCBrushColor
Color management is performed if ICM is enabled.
SetDCPenColor
Color management is performed if ICM is enabled.

Text Output Functions with ICM

SetBkColor
Color management is performed if ICM is enabled.
SetTextColor
Color management is performed if ICM is enabled.

Bitmap Functions with ICM

BitBlt
No color management is performed when blits occur.
CreateDIBitmap
The fuUsage parameter specifies that the bmiColors member of the BITMAPINFO structure pointed at by the lpbmi parameter does or does not contain color information. If it does not, no color management is performed for this bitmap. The bitmap must use version 4 or version 5 of the BITMAPINFO structure for color management to be enabled. The contents of the resulting bitmap are not color matched after the bitmap has been created.
CreateDIBSection
If the BITMAPINFO structure passed through the pbmi parameter is not version 4 or version 5, no color management is done. If it is version 4 or 5, color management is enabled, and the specified color space is associated with the bitmap.
MaskBlt
No color management is performed when blits occur.
SelectObject
If the object is a bitmap created with CreateDIBSection, color management is performed. The bitmap's color space is used as the destination color space.
SetDIBits
Color management is performed. If the specified BITMAPINFO structure is not version 4 or version 5, the color profile of the current DC is used as the source color space profile. If it does not have one, the sRGB space is used. If the specified BITMAPINFO structure is version 4 or version 5, the color space profile specified in the bitmap header is used as the source color space profile.
SetDIBitsToDevice
Color management is performed. If the specified BITMAPINFO structure is not version 4 or version 5, the color profile of the current device context is used as the source color space profile. If it doesn't have one, the sRGB color space is used. If the specified BITMAPINFO structure is version 4 or version 5, the color space profile associated with the bitmap is used as the source color space.
SetDIBColorTable
No color management is performed.
StretchBlt
No color management is performed when blits occur.
StretchDIBits
Color management is performed. If the specified BITMAPINFO structure is not version 4 or version 5, the color profile of the current DC is used as the source color space profile. If it does not have one, the sRGB space is used. If the specified BITMAPINFO structure is version 4 or version 5, the color space profile specified in the bitmap header is used as the source color space profile.