Share via


TranslateBitmapBits

The TranslateBitmapBits function translates the colors of a bitmap having a defined format so as to produce another bitmap in a requested format.

BOOL WINAPI TranslateBitmapBits(
  HTRANSFORM hColorTransform,  PVOID pSrcBits,  BMFORMAT bmInput,  DWORD dwWidth,  DWORD dwHeight,  DWORD dwInputStride,  PVOID pDestBits,  BMFORMAT bmOutput,  DWORD dwOutputStride,  PBMCALLBACKFN pfnCallback,  LPARAM ulCallbackData);

Parameters

  • hColorTransform
    Identifies the color transform to use.
  • pSrcBits
    Pointer to the bitmap to translate.
  • bmInput
    Specifies the format of the input bitmap. Must be set to one of the values of the BMFORMAT enumerated type.
  • dwWidth
    Specifies the number of pixels per scan line in the input bitmap.
  • dwHeight
    Specifies the number of scan lines in the input bitmap.
  • dwInputStride
    Specifies the number of bytes from the beginning of one scan line to the beginning of the next in the input bitmap; if set to zero, the function assumes that scan lines are padded so as to be DWORD-aligned.
  • pDestBits
    Pointer to the buffer in which to place the translated bitmap.
  • bmOutput
    Specifies the format of the output bitmap. Must be set to one of the values of the BMFORMAT enumerated type.
  • dwOutputStride
    Specifies the number of bytes from the beginning of one scan line to the beginning of the next in the output bitmap; if set to zero, the function assumes that scan lines should be padded to be DWORD-aligned.
  • pfnCallback
    Pointer to a callback function called periodically by TranslateBitmapBits to report progress and allow the calling process to cancel the translation. (See ICMProgressProcCallback)
  • ulCallbackData
    Data passed back to the callback function, for example, to identify the translation that is reporting progress.

Return Values

If this function succeeds, the return value is TRUE.

If this function fails, the return value is FALSE. For extended error information, call GetLastError.

Remarks

If the input and output formats are not compatible with the color transform, this function fails.

When either of the floating point BMFORMATs, BM_32b_scARGB or BM_32b_scRGB are used, the color data being translated should not contain NaN or infinity. NaN and infinity are not considered to represent legitimate color component values, and the result of translating pixels containing NaN or infinity is meaningless in color terms. NaN or infinity values in the color data being processed will be handled silently, and an error will not be returned.

Requirements

**  Windows NT/2000/XP/Vista:** Included in Windows 2000 and later.
**  Windows 95/98/Me:** Included in Windows 98 and later.
**  Header:** Declared in Icm.h.
**  Library:** Use Mscms.lib.

See Also

Basic Color Management Concepts, Functions, ICMProgressProcCallback, Windows Bitmap Header Structures, BMFORMAT