Table of Contents

Struct RenderTargetProperties

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll

Contains rendering options (hardware or software), pixel format, DPI information, remoting options, and Direct3D support requirements for a render target.

public struct RenderTargetProperties
Inherited Members

Remarks

Use this structure when creating a render target, or use it with the ID2D1RenderTarget::IsSupported method to check the properties supported by an existing render target.

As a convenience, Direct2D provides the D2D1::RenderTargetProperties helper function for creating RenderTargetProperties structures. An easy way to create a RenderTargetProperties structure that works for most render targets is to call the function without specifying any parameters. Doing so creates a RenderTargetProperties structure that has its fields set to default values. For more information, see D2D1::RenderTargetProperties.

Not all render targets support hardware rendering. For a list, see the Render Targets Overview.

Constructors

RenderTargetProperties(PixelFormat)

Initializes a new instance of the RenderTargetProperties struct.

public RenderTargetProperties(PixelFormat pixelFormat)

Parameters

pixelFormat PixelFormat

The pixel format and alpha mode of the render target. You can use the {{D2D1::PixelFormat}} function to create a pixel format that specifies that Direct2D should select the pixel format and alpha mode for you. For a list of pixel formats and alpha modes supported by each render target, see {{Supported Pixel Formats and Alpha Modes}}.

RenderTargetProperties(RenderTargetType, PixelFormat, float, float, RenderTargetUsage, FeatureLevel)

Initializes a new instance of the RenderTargetProperties struct.

public RenderTargetProperties(RenderTargetType type, PixelFormat pixelFormat, float dpiX, float dpiY, RenderTargetUsage usage, FeatureLevel minLevel)

Parameters

type RenderTargetType

A value that specifies whether the render target should force hardware or software rendering. A value of Default specifies that the render target should use hardware rendering if it is available; otherwise, it uses software rendering. Note that WIC bitmap render targets do not support hardware rendering.

pixelFormat PixelFormat

The pixel format and alpha mode of the render target. You can use the {{D2D1::PixelFormat}} function to create a pixel format that specifies that Direct2D should select the pixel format and alpha mode for you. For a list of pixel formats and alpha modes supported by each render target, see {{Supported Pixel Formats and Alpha Modes}}.

dpiX float

The horizontal DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section.

dpiY float

The vertical DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section.

usage RenderTargetUsage

A value that specifies how the render target is remoted and whether it should be GDI-compatible. Set to None to create a render target that is not compatible with GDI and uses Direct3D command-stream remoting if it is available.

minLevel FeatureLevel

A value that specifies the minimum Direct3D feature level required for hardware rendering. If the specified minimum level is not available, the render target uses software rendering if the type member is set to Default; if type is set to to D2D1_RENDER_TARGET_TYPE_HARDWARE, render target creation fails. A value of Level_DEFAULT indicates that Direct2D should determine whether the Direct3D feature level of the device is adequate. This field is used only when creating WindowRenderTarget and DeviceContextRenderTarget objects.

Fields

DpiX

The horizontal DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section.

public float DpiX

Field Value

float

DpiY

The vertical DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section.

public float DpiY

Field Value

float

MinLevel

A value that specifies the minimum Direct3D feature level required for hardware rendering. If the specified minimum level is not available, the render target uses software rendering if the type member is set to D2D1_RENDER_TARGET_TYPE_DEFAULT; if type is set to to D2D1_RENDER_TARGET_TYPE_HARDWARE, render target creation fails. A value of 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 creating WindowRenderTarget and DeviceContextRenderTarget objects.

public FeatureLevel MinLevel

Field Value

FeatureLevel

PixelFormat

The pixel format and alpha mode of the render target. You can use the D2D1::PixelFormat function to create a pixel format that specifies that Direct2D should select the pixel format and alpha mode for you. For a list of pixel formats and alpha modes supported by each render target, see Supported Pixel Formats and Alpha Modes.

public PixelFormat PixelFormat

Field Value

PixelFormat

Type

A value that specifies whether the render target should force hardware or software rendering. A value of D2D1_RENDER_TARGET_TYPE_DEFAULT specifies that the render target should use hardware rendering if it is available; otherwise, it uses software rendering. Note that WIC bitmap render targets do not support hardware rendering.

public RenderTargetType Type

Field Value

RenderTargetType

Usage

A value that specifies how the render target is remoted and whether it should be GDI-compatible. Set to D2D1_RENDER_TARGET_USAGE_NONE to create a render target that is not compatible with GDI and uses Direct3D command-stream remoting if it is available.

public RenderTargetUsage Usage

Field Value

RenderTargetUsage