Color::GetGray

Color::GetGray
inline UByte GetGray() const;
Description

GetGray retrieves the 8-bit grayscale value of the current color. The Color class provides several ways to convert a color to grayscale, such as GetGray and IIntensity. Unlike the IIntensity, GetGray does not rely on the RGB luminance constants (SF_COLOR_ILUM_*), instead it uses the following formula:

  (unsigned(r)*11 + unsigned(g)*16 + unsigned(b)*5) / 32.

The actual implementation is:

  return (unsigned(GetRed())*11 + unsigned(GetGreen())*16 + unsigned(GetBlue())*5) / 32;
Return Value

An UByte containing the grayscale value of the current color.

See Also