ULONG color = hw_MapRGB(ULONG rgb, int outfmt);
To convert a color from an arbitrary pixel format to RGB, use hw_GetRGB(). See hw_GetRGB for details.