RGBA (Compact 2013)

3/28/2014

This macro selects a color based on the specified color values, the alpha value, and the capabilities of the output device.

Syntax

COLORREF RGBA(
  BYTE byRed,
  BYTE byGreen,
  BYTE byBlue,
  BYTE alpha
);

Parameters

  • byRed
    Specifies the intensity of the red color.
  • byGreen
    Specifies the intensity of the green color.
  • byBlue
    Specifies the intensity of the blue color.
  • alpha
    Specifies the alpha component of the overall color.

Return Value

The return value is a COLORREF that corresponds to the supplied color and alpha values.

Remarks

The intensity for each argument is in the range 0 through 255.

If all three intensities are zero, the result is black.

If all three intensities are 255, the result is white.

For information about using color values in a color palette, see the description of the PALETTERGB macro.

The RGBA macro is defined as follows:

#ifndef RGBA
#define RGBA(r,g,b,a)        ((COLORREF)( (((DWORD)(BYTE)(a))<<24) |     RGB(r,g,b) ))
#endif

Requirements

Header

windows.h

See Also

Reference

GDI Macros