ID2D1Factory::CreateHwndRenderTarget method

Creates an ID2D1HwndRenderTarget, a render target that renders to a window.

Syntax


virtual HRESULT CreateHwndRenderTarget(
  [in]   D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties,
  [in]   D2D1_HWND_RENDER_TARGET_PROPERTIES *hwndRenderTargetProperties,
  [out]  ID2D1HwndRenderTarget **hwndRenderTarget
) = 0;

Parameters

renderTargetProperties [in]

Type: D2D1_RENDER_TARGET_PROPERTIES*

The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. For information about supported pixel formats, see Supported Pixel Formats and Alpha Modes.

hwndRenderTargetProperties [in]

Type: D2D1_HWND_RENDER_TARGET_PROPERTIES*

The window handle, initial size (in pixels), and present options.

hwndRenderTarget [out]

Type: ID2D1HwndRenderTarget**

When this method returns, contains the address of the pointer to the ID2D1HwndRenderTarget object created by this method.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should create render targets once and hold onto them for the life of the application or until the D2DERR_RECREATE_TARGET error is received. When you receive this error, you need to recreate the render target (and any resources it created).

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1Factory
CreateHwndRenderTarget

 

 

Community Additions

ADD
Show:
© 2014 Microsoft