RenderTargetProperties function

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

Creates a D2D1_RENDER_TARGET_PROPERTIES structure.

Syntax


D2D1_RENDER_TARGET_PROPERTIES RenderTargetProperties(
  D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE_DEFAULT,
  _In_  const PIXEL_FORMAT pixelFormat = D2D1::PixelFormat(),
  FLOAT dpiX = 0.0,
  FLOAT dpiY = 0.0,
  D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE_NONE,
  D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL_DEFAULT
);

Parameters

type

Type: D2D1_RENDER_TARGET_TYPE

A value that specifies whether the render target must use hardware rendering or software rendering. The default value, D2D1_RENDER_TARGET_TYPE_DEFAULT, specifies that hardware rendering be used; if hardware rendering is not available, the render target uses software rendering. Note that WIC bitmap render targets do not support hardware rendering.

pixelFormat [in]

Type: const PIXEL_FORMAT

The pixel format and alpha mode of the render target. The default pixel format is D2D1::PixelFormat, which tells Direct2D to select a pixel format that is supported by the render target. For a list of pixel formats and alpha modes supported by each render target, see Supported Pixel Formats and Alpha Modes.

dpiX

Type: FLOAT

The horizontal DPI of the render target. The default value is 0.0. If both dpiX and dpiY are set to 0.0, the render target uses its default DPI. For more information, see D2D1_RENDER_TARGET_PROPERTIES.

dpiY

Type: FLOAT

The vertical DPI of the render target. The default value is 0.0. If both dpiX and dpiY are set to 0.0, the render target uses its default DPI. For more information, see D2D1_RENDER_TARGET_PROPERTIES.

usage

Type: D2D1_RENDER_TARGET_USAGE

Specifies how the render target is remotely rendered and whether it should be GDI-compatible. The default value, D2D1_RENDER_TARGET_USAGE_NONE, creates a render target that is not compatible with GDI and that uses Direct3D command-stream remote rendering, if it is available.

minLevel

Type: D2D1_FEATURE_LEVEL

The minimum Direct3D feature level that is required for hardware rendering. The default value, D2D1_FEATURE_LEVEL_DEFAULT, indicates that Direct2D should determine whether the Direct3D feature level of the device is adequate. This field is used only when ID2D1HwndRenderTarget and ID2D1DCRenderTarget objects are created. For more information, see D2D1_RENDER_TARGET_PROPERTIES.

Return value

Type: D2D1_RENDER_TARGET_PROPERTIES

A D2D1_RENDER_TARGET_PROPERTIES that contains the specified settings.

Examples

The following example uses the D2D1::RenderTargetProperties function to create a D2D1_RENDER_TARGET_PROPERTIES structure suitable for most render targets. For the complete code, see the "Hello, World" Sample Application.


RECT rc;
GetClientRect(m_hwnd, &rc);

D2D1_SIZE_U size = D2D1::SizeU(
    rc.right - rc.left,
    rc.bottom - rc.top
    );

// Create a Direct2D render target.
hr = m_pD2DFactory->CreateHwndRenderTarget(
    D2D1::RenderTargetProperties(),
    D2D1::HwndRenderTargetProperties(m_hwnd, size),
    &m_pRenderTarget
    );


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

D2d1helper.h

Library

D2d1.lib

DLL

D2d1.dll

See also

D2D1_RENDER_TARGET_PROPERTIES Structure
"Hello, World" Sample Application
Supported Pixel Formats and Alpha Modes

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.