ID2D1GdiInteropRenderTarget interface (d2d1.h)

Provides access to a device context that can accept GDI drawing commands.


The ID2D1GdiInteropRenderTarget interface inherits from the IUnknown interface. ID2D1GdiInteropRenderTarget also has these types of members:


The ID2D1GdiInteropRenderTarget interface has these methods.


Retrieves the device context associated with this render target.

Indicates that drawing with the device context retrieved using the GetDC method is finished.


You don't create an ID2D1GdiInteropRenderTarget object directly; instead, you use the QueryInterface method of an existing render target instance to provide an ID2D1GdiInteropRenderTarget version of that render target.

Not all render targets support the ID2D1GdiInteropRenderTarget interface. The render target must be GDI-compatible (the D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE flag was specified when creating the render target), use the DXGI_FORMAT_B8G8R8A8_UNORM pixel format, and use the D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE alpha mode.

Note that the QueryInterface method always succeeds; if the render target doesn't support the ID2D1GdiInteropRenderTarget interface, calling GetDC will fail. (For render targets created through the CreateCompatibleRenderTarget method, the render target that created it must have these settings.)

To test whether a given render target supports the ID2D1GdiInteropRenderTarget interface, create a D2D1_RENDER_TARGET_PROPERTIES that specifies GDI compatibility and the appropriate pixel format, then call the render target's IsSupported method to see whether the render target is GDI-compatible.


Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header d2d1.h

See also

Direct2D and GDI Interoperability Overview