IDXGISwapChain2::SetMatrixTransform method (dxgi1_3.h)

Sets the transform matrix that will be applied to a composition swap chain upon the next present.

Starting with Windows 8.1, Windows Store apps are able to place DirectX swap chain visuals in XAML pages using the SwapChainPanel element, which can be placed and sized arbitrarily. This exposes the DirectX swap chain visuals to touch scaling and translation scenarios using touch UI. The GetMatrixTransform and SetMatrixTransform methods are used to synchronize scaling of the DirectX swap chain with its associated SwapChainPanel element. Only simple scale/translation elements in the matrix are allowed – the call will fail if the matrix contains skew/rotation elements.


HRESULT SetMatrixTransform(
  const DXGI_MATRIX_3X2_F *pMatrix



The transform matrix to use for swap chain scaling and translation. This function can only be used with composition swap chains created by IDXGIFactory2::CreateSwapChainForComposition. Only scale and translation components are allowed in the matrix.

Return value

SetMatrixTransform returns:

  • S_OK if it successfully retrieves the transform matrix.
  • E_INVALIDARG if the pMatrix parameter is incorrect, for example, pMatrix is NULL or the matrix represented by DXGI_MATRIX_3X2_F includes components other than scale and translation.
  • DXGI_ERROR_INVALID_CALL if the method is called on a swap chain that was not created with CreateSwapChainForComposition.
  • Possibly other error codes that are described in the DXGI_ERROR topic.


Requirement Value
Minimum supported client Windows 8.1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dxgi1_3.h
Library Dxgi.lib

See also