Table of Contents

Class DeviceContextRenderTarget

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll
[Guid("1c51bc64-de61-46fd-9899-63a5d8f03950")]
public class DeviceContextRenderTarget : RenderTarget
Inheritance
DeviceContextRenderTarget
Inherited Members

Constructors

DeviceContextRenderTarget(Factory, RenderTargetProperties)

Creates a render target that draws to a Windows Graphics Device Interface (GDI) device context.

public DeviceContextRenderTarget(Factory factory, RenderTargetProperties properties)

Parameters

factory Factory

an instance of Factory

properties RenderTargetProperties

The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. To enable the device context (DC) render target to work with GDI, set the DXGI format to SharpDX.DXGI.Format.B8G8R8A8_UNorm and the alpha mode to Premultiplied or D2D1_ALPHA_MODE_IGNORE. For more information about pixel formats, see {{Supported Pixel Formats and Alpha Modes}}.

Remarks

Before you can render with a DC render target, you must use the render target's {{BindDC}} method to associate it with a GDI DC. Do this for each different DC and whenever there is a change in the size of the area you want to draw to.To enable the DC render target to work with GDI, set the render target's DXGI format to SharpDX.DXGI.Format.B8G8R8A8_UNorm and alpha mode to Premultiplied or D2D1_ALPHA_MODE_IGNORE.Your application should create render targets once and hold on to them for the life of the application or until the render target's {{EndDraw}} method returns the {{D2DERR_RECREATE_TARGET}} error. When you receive this error, recreate the render target (and any resources it created).

DeviceContextRenderTarget(nint)

public DeviceContextRenderTarget(nint nativePtr)

Parameters

nativePtr nint

Methods

BindDeviceContext(nint, RawRectangle)

Binds the render target to the device context to which it issues drawing commands.

public void BindDeviceContext(nint hDC, RawRectangle subRectRef)

Parameters

hDC nint

The device context to which the render target issues drawing commands.

subRectRef RawRectangle

The dimensions of the handle to a device context (nint) to which the render target is bound.

Remarks

Before you can render with the DC render target, you must use its BindDC method to associate it with a GDI DC. You do this each time you use a different DC, or the size of the area you want to draw to changes.

Operators

explicit operator DeviceContextRenderTarget(nint)

public static explicit operator DeviceContextRenderTarget(nint nativePtr)

Parameters

nativePtr nint

Returns

DeviceContextRenderTarget