SetDIBitsToDevice (Compact 2013)

3/28/2014

This function sets the pixels in the specified rectangle on the device that is associated with the destination device context using color data from a DIB.

Syntax

int SetDIBitsToDevice(
  HDC hdc,
  int XDest,
  int YDest,
  DWORD dwWidth,
  DWORD dwHeight,
  int XSrc,
  int YSrc,
  UINT uStartScan,
  UINT cScanLines,
  CONST VOID* lpvBits,
  CONST BITMAPINFO* lpbmi,
  UINT fuColorUse
);

Parameters

  • hdc
    [in] Handle to the device context.
  • XDest
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
  • YDest
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
  • dwWidth
    [in] Specifies the width, in logical units, of the DIB.
  • dwHeight
    [in] Specifies the height, in logical units, of the DIB.
  • XSrc
    [in] Specifies the x-coordinate, in logical units, of the lower left corner of the DIB.
  • YSrc
    [in] Specifies the y-coordinate, in logical units, of the lower left corner of the DIB.
  • uStartScan
    [in] Specifies the starting scan line in the DIB.
  • cScanLines
    [in] Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter.
  • lpvBits
    [in] Pointer to DIB color data stored as an array of bytes.

    For more information, see the following Remarks section.

  • lpbmi
    [in] Pointer to a BITMAPINFO structure that contains information about the DIB.
  • fuColorUse
    [in] Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, blue (RGB) values or indexes into a palette.

    For more information, see the following Remarks section.

    The fuColorUse parameter must be one of the following values.

    Value

    Description

    DIB_PAL_COLORS

    The array contains 16-bit indexes into the logical palette of the source device context.

    DIB_RGB_COLORS

    The color table contains literal red, green, and blue values.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

Optimal bitmap drawing speed is obtained when the bitmap bits are indexes into the system palette.

Applications can retrieve the system palette colors and indexes by calling the GetSystemPaletteEntries function. After the colors and indexes are retrieved, the application can create the DIB.

The origin of a bottom-up DIB is the lower left corner of the bitmap; the origin of a top-down DIB is the upper-left corner.

To reduce the amount of memory required to set bits from a large DIB on a device surface, an application can band the output by repeatedly calling SetDIBitsToDevice, placing a different portion of the bitmap into the lpvBits array each time.

The values of the uStartScan and cScanLines parameters identify the portion of the bitmap contained in the lpvBits array.

Requirements

Header

windows.h

Library

coredll.lib

See Also

Reference

GDI Functions
GetSystemPaletteEntries
BITMAPINFO