ID2D1GdiInteropRenderTarget interface

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

Methods

The ID2D1GdiInteropRenderTarget interface has these methods.

Method Description
ID2D1GdiInteropRenderTarget::GetDC Retrieves the device context associated with this render target.
ID2D1GdiInteropRenderTarget::ReleaseDC Indicates that drawing with the device context retrieved using the GetDC method is finished.

Remarks

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.

Requirements

   
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

IUnknown