Table of Contents

Class GdiInterop

Namespace
SharpDX.DirectWrite
Assembly
SharpDX.Direct2D1.dll
[Guid("1edd9491-9853-4299-898f-6432983b6f3a")]
public class GdiInterop : ComObject
Inheritance
GdiInterop
Derived

Constructors

GdiInterop(nint)

public GdiInterop(nint nativePtr)

Parameters

nativePtr nint

Methods

CreateBitmapRenderTarget(nint, int, int)

Creates an object that encapsulates a bitmap and memory DC (device context) which can be used for rendering glyphs.

public BitmapRenderTarget CreateBitmapRenderTarget(nint hdc, int width, int height)

Parameters

hdc nint

A handle to the optional device context used to create a compatible memory DC (device context).

width int

The width of the bitmap render target.

height int

The height of the bitmap render target.

Returns

BitmapRenderTarget

When this method returns, contains an address of a reference to the newly created BitmapRenderTarget object.

CreateFontFaceFromHdc(nint)

Creates an FontFace object that corresponds to the currently selected HFONT of the specified nint.

public FontFace CreateFontFaceFromHdc(nint hdc)

Parameters

hdc nint

A handle to a device context into which a font has been selected. It is assumed that the client has already performed font mapping and that the font selected into the device context is the actual font to be used for rendering glyphs.

Returns

FontFace

Contains an address of a reference to the newly created font face object, or null in case of failure. The font face returned is guaranteed to reference the same physical typeface that would be used for drawing glyphs (but not necessarily characters) using ExtTextOut.

Remarks

This function is intended for scenarios in which an application wants to use GDI and Uniscribe 1.x for text layout and shaping, but DirectWrite for final rendering. This function assumes the client is performing text output using glyph indexes.

FromLogFont(object)

Creates a font object that matches the properties specified by the LOGFONT structure.

public Font FromLogFont(object logFont)

Parameters

logFont object

A structure containing a GDI-compatible font description.

Returns

Font

a reference to a newly created Font.

ToLogFont(Font, object)

Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font.

public bool ToLogFont(Font font, object logFont)

Parameters

font Font

An Font object to be converted into a GDI-compatible LOGFONT structure.

logFont object

When this method returns, contains a structure that receives a GDI-compatible font description.

Returns

bool

TRUE if the specified font object is part of the system font collection; otherwise, FALSE.

Remarks

The conversion to a LOGFONT by using ConvertFontToLOGFONT operates at the logical font level and does not guarantee that it will map to a specific physical font. It is not guaranteed that GDI will select the same physical font for displaying text formatted by a LOGFONT as the Font object that was converted.

Operators

explicit operator GdiInterop(nint)

public static explicit operator GdiInterop(nint nativePtr)

Parameters

nativePtr nint

Returns

GdiInterop