Partager via


GetDIBColorTable

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function retrieves red, green, and blue color values from a range of entries in the color table of the device-independent bitmap (DIB) that is selected into a specified device context.

Syntax

WINGDIAPI UINT WINAPI GetDIBColorTable(
  HDC hdc,
  UINT uStartIndex,
  UINT cEntries,
  RGBQUAD* pColors
);

Parameters

  • hdc
    [in] Handle to a device context.

    A DIB must be selected into this device context.

  • uStartIndex
    [in] Unsigned integer that that specifies a zero-based index of the first color table entry that you want to retrieve.
  • cEntries
    [in] Unsigned integer that specifies the number of color table entries that you want to retrieve.
  • pColors
    [out] Pointer to a buffer that receives an array of RGBQUAD structures that contain color information from the DIB color table.

    You must specify a buffer that is large enough to contain as many RGBQUAD structures as the value of cEntries.

Return Value

The number of color table entries that the function retrieved indicates success.

Zero indicates failure.

To get extended error information, call GetLastError.

Remarks

You should call the GetDIBColorTable function to retrieve the color table for DIB section bitmaps that use 1, 4, or 8 bits per pixel (bpp).

The biBitCount member of a bitmap-associated BITMAPINFOHEADER structure specifies the number of bpp.

DIB section bitmaps that have a biBitCount value greater than eight do not have a color table, but these bitmaps do have associated color masks. Call the GetObject function to retrieve those color masks.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CreateDIBSection
GetObject
SetDIBColorTable
BITMAPINFOHEADER
DIBSECTION
RGBQUAD