A 32-bit Alpha Red Green Blue (ARGB) color vector, where each color channel is specified as an unsigned 8 bit integer.
If you are programming in C++, you can use the constructors and operator methods of this structure.
Note See DirectXMath Library Type Equivalences for information about equivalent D3DDECLTYPE, D3DFORMAT, and DXGI_FORMAT objects.
struct XMCOLOR
The fields in the XMCOLOR structure are declared as follows:
struct XMCOLOR
{
union
{
struct
{
uint8_t b; // Unsigned integer between 0 and 255
// representing the blue component.
uint8_t g; // Unsigned integer between 0 and 255
// representing the green component.
uint8_t r; // Unsigned integer between 0 and 255
// representing the red component.
uint8_t a; // Unsigned integer between 0 and 255
// representing the alpha component.
};
uint32_t c; // Unsigned 32-bit integer representing the color.
// The colors are stored in A8R8G8B8 format.
};
The alpha component is stored in the most-significant bits, and the blue component is stored in the least-significant bits.
Those XMCOLOR constructors using floating point arguments require normalized input, which are clamped to the range of [0-1.0]. During instantiation, the floating point data specifying the color channels are multiplied by 255.0f, rounded and then assigned to the appropriate members of XMCOLOR.
XMCOLOR can be used to load instances of XMVECTOR from normalized values, by using XMLoadColor, which divides color channel data by 255.0f, rounds the result, and then assigns the components to an XMVECTOR instance.
XMVECTOR instances containing normalized values can be stored into XMCOLOR using XMStoreColor, which multiplies color channel data by 255.0f, rounding the result before assigning the values to the appropriate XMCOLOR members.
Namespace: Use DirectX
Header: Declared in directxpackedvector.h.