COLORREF

3DS Max Plug-In SDK

COLORREF - DWORD Color Format

From the Windows API:

The COLORREF value is a 32-bit value used to specify an RGB color.

COLORREF RGB(

BYTE bRed,  // red component of color

BYTE bGreen, // green component of color

BYTE bBlue  // blue component of color

);

When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:

0x00bbggrr

The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

Also see the following macros in the Windows API:

GetBValue, GetGValue, GetRValue, RGB.

These are used to create COLORREF values and break them down into component values. These can be used as follows:

COLORREF fillcolor = RGB(48, 96, 192);

int r = (int) GetRValue(fillcolor);

int g = (int) GetGValue(fillcolor);

int b = (int) GetBValue(fillcolor);