The GetNearestPaletteIndex function retrieves the index for the entry in the specified logical palette most closely matching a specified color value.
UINT GetNearestPaletteIndex(
HPALETTE hpal, | // handle of logical color palette |
COLORREF crColor | // color to be matched |
); |
Parameters
hpal
Identifies a logical color palette.
crColor
Specifies a color to be matched.
Return Values
If the function succeeds, the return value is the index of an entry in a logical palette.
If the function fails, the return value is CLR_INVALID. To get extended error information, call GetLastError.
Remarks
An application can determine whether a device supports palette operations by calling the GetDeviceCaps function and specifying the RASTERCAPS constant.
If the given logical palette contains entries with the PC_EXPLICIT flag set, the return value is undefined.
See Also
GetDeviceCaps, GetNearestColor, GetPaletteEntries, GetSystemPaletteEntries, COLORREF