XMLoadColor function (directxpackedvector.h)

Loads an XMCOLOR into an XMVECTOR.

Syntax

XMVECTOR XM_CALLCONV XMLoadColor(
  [in] const XMCOLOR *pSource
) noexcept;

Parameters

[in] pSource

Address of the XMCOLOR structure to load.

Return value

Returns an XMVECTOR loaded with the data from the pSource parameter with X containing the Red color channel, Y containing the Green, Z the Blue, and W the Alpha channel. The values in the components range from 0 to 1.

Remarks

The following pseudocode demonstrates the operation of the function.

XMVECTOR vectorOut;

vectorOut.x = (float)((pSource->c >> 16) & 0xFF) / 255.0f;
vectorOut.y = (float)((pSource->c >> 8) & 0xFF) / 255.0f;
vectorOut.z = (float)((pSource->c >> 0) & 0xFF) / 255.0f;
vectorOut.w = (float)((pSource->c >> 24) & 0xFF) / 255.0f;

return vectorOut;

Platform Requirements

Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.

Requirements

Requirement Value
Target Platform Windows
Header directxpackedvector.h (include DirectXPackedVector.h)

See also

DirectXMath Library Vector Load Functions