XMColorAdjustContrast 函式 (directxmath.h)

調整色彩的對比值。

語法

XMVECTOR XM_CALLCONV XMColorAdjustContrast(
  [in] FXMVECTOR C,
  [in] float     Contrast
) noexcept;

參數

[in] C

描述色彩的XMVECTORC的每個元件都應該介於 0.0f 到 1.0f 的範圍內。

[in] Contrast

對比值。 此參數會以線性方式插補 50% 灰色與色彩 C。如果此參數為 0.0f,傳回的色彩為 50% 灰色。 如果此參數為 1.0f,傳回的色彩會是原始色彩。

傳回值

會傳回 XMVECTOR ,描述對比調整所產生的色彩。

備註

下列虛擬程式碼示範函式的作業。

XMVECTOR colorOut;

colorOut.x = (C.x - 0.5f) * Contrast + 0.5f;
colorOut.y = (C.y - 0.5f) * Contrast + 0.5f;
colorOut.z = (C.z - 0.5f) * Contrast + 0.5f;
colorOut.w = C.w;

return colorOut;

平臺需求

Microsoft Visual Studio 2010 或 Microsoft Visual Studio 2012 搭配 Windows SDK for Windows 8。 支援 Win32 傳統型應用程式、Windows 市集應用程式和 Windows Phone 8 個應用程式。

需求

   
目標平台 Windows
標頭 directxmath.h

另請參閱

DirectXMath 程式庫色彩函式