Table of Contents

Class DeviceContext2

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll
[Guid("394ea6a3-0c34-4321-950b-6ca20f0be6c7")]
public class DeviceContext2 : DeviceContext1
Inheritance
DeviceContext2
Derived
Inherited Members

Constructors

DeviceContext2(Device2, DeviceContextOptions)

Initializes a new instance of the DeviceContext2 class using an existing Device2.

public DeviceContext2(Device2 device, DeviceContextOptions options)

Parameters

device Device2

The device.

options DeviceContextOptions

The options to be applied to the created device context.

Remarks

The new device context will not have a selected target bitmap. The caller must create and select a bitmap as the target surface of the context.

DeviceContext2(nint)

public DeviceContext2(nint nativePtr)

Parameters

nativePtr nint

Methods

DrawGdiMetafile(GdiMetafile, RawRectangleF?, RawRectangleF?)

Draws a metafile to the device context using the given source and destination rectangles.

public void DrawGdiMetafile(GdiMetafile gdiMetafile, RawRectangleF? destinationRectangle, RawRectangleF? sourceRectangle)

Parameters

gdiMetafile GdiMetafile

The metafile to draw.

destinationRectangle RawRectangleF?

The rectangle in the target where the metafile will be drawn, relative to the upper left corner (defined in DIPs) of the render target. If null is specified, the destination rectangle is {0, 0, w, h}, where w and h are the width and height of the metafile as reported by ID2D1GdiMetafile::GetBounds.

sourceRectangle RawRectangleF?

The rectangle of the source metafile that will be drawn, relative to the upper left corner (defined in DIPs) of the metafile. If null is specified, the source rectangle is the value returned by ID2D1GdiMetafile1::GetSourceBounds.

DrawGradientMesh(GradientMesh)

Renders a given gradient mesh to the target.

public void DrawGradientMesh(GradientMesh gradientMesh)

Parameters

gradientMesh GradientMesh

The gradient mesh to be rendered.

DrawInk(Ink, Brush, InkStyle)

Renders the given ink object using the given brush and ink style.

public void DrawInk(Ink ink, Brush brush, InkStyle inkStyle)

Parameters

ink Ink

The ink object to be rendered.

brush Brush

The brush with which to render the ink object.

inkStyle InkStyle

The ink style to use when rendering the ink object.

GetGradientMeshWorldBounds(GradientMesh, out RawRectangleF)

Returns the world bounds of a given gradient mesh.

public void GetGradientMeshWorldBounds(GradientMesh gradientMesh, out RawRectangleF boundsRef)

Parameters

gradientMesh GradientMesh

The gradient mesh whose world bounds will be calculated.

boundsRef RawRectangleF

When this method returns, contains a reference to the bounds of the gradient mesh, in device independent pixels (DIPs).

Remarks

The world bounds reflect the current DPI, unit mode, and world transform of the context. They indicate which pixels would be impacted by calling DrawGradientMesh with the given gradient mesh. They do not reflect the current clip rectangle set on the device context or the extent of the context?s current target.

Operators

explicit operator DeviceContext2(nint)

public static explicit operator DeviceContext2(nint nativePtr)

Parameters

nativePtr nint

Returns

DeviceContext2