ID2D1Bitmap1::GetSurface method (d2d1_1.h)

Gets either the surface that was specified when the bitmap was created, or the default surface created when the bitmap was created.

Syntax

HRESULT GetSurface(
  [out, optional] IDXGISurface **dxgiSurface
);

Parameters

[out, optional] dxgiSurface

Type: IDXGISurface**

The underlying DXGI surface for the bitmap.

Return value

Type: HRESULT

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

HRESULT Description
S_OK No error occurred.
D2DERR_BITMAP_BOUND_AS_TARGET Cannot draw with a bitmap that is currently bound as the target bitmap.

Remarks

The bitmap used must have been created from a DXGI surface render target, a derived render target, or a device context created from an ID2D1Device.

The returned surface can be used with Microsoft Direct3D or any other API that interoperates with shared surfaces. The application must transitively ensure that the surface is usable on the Direct3D device that is used in this context. For example, if using the surface with Direct2D then the Direct2D render target must have been created through ID2D1Factory::CreateDxgiSurfaceRenderTarget or on a device context created on the same device.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1_1.h
DLL D2d1.dll

See also

ID2D1Bitmap1

ID2D1DeviceContext::CreateBitmap

ID2D1DeviceContext::CreateBitmapFromDxgiSurface

ID2D1RenderTarget::CreateSharedBitmap