Index

C/C++ Functions

dtOutputSetAsHDC

DT_SWORD dtOutputSetAsHDC(DT_DTENGINE engine, DT_HDC hdc, DT_SWORD clip_x, DT_SWORD clip_y, DT_SWORD clip_w, DT_SWORD clip_h)

Short Description: Set Output to Windows Device Context (HDC) - Windows only

This function connects the Output of the specified Standard Engine instance with the supplied Windows compatible Device Context (HDC). In this way, any output primitives (e.g. glyphs, shapes, bitmaps) that are sent to the Output (e.g. using the dtGlyphDoOutput, dtShapeDoOutput or dtBitmapDoOutput function) will be rendered in that Device Context. Furthermore, this function sets the clipping rectangle associated with the memory surface so that output primitives that are completely outside the clipping rectangle are not processed/rendered when they are sent to the Output.

This function has limited capabilities as is supported only on Windows.

Parameters

ParameterDescription

engine

Handle of the previously created Standard Engine instance.

hdc

Windows compatible Device Context (DT_HDC). Alternatively, this value can be set to 0. See below for details.

clip_x

X coordinate of the clipping rectangle in pixels.

clip_y

Y coordinate of the clipping rectangle in pixels.

clip_w

Width of the clipping rectangle in pixels.

clip_h

Height of the clipping rectangle in pixels.

Return Value

If successful, the return value is 1. Otherwise, the function returns 0.

Comments

The dtOutputSetAsHDC tells D-Type Engine to redirect all D-Type output to a Windows Device Context (HDC). This type of drawing is only available on Microsoft Windows. Thus, Windows applications can draw directly to the screen, into a window or to the printer. However, this method is not very fast and not recommended due to limitations of the Windows graphics system.

When hdc is set to 0, the above mentioned device context redirection is disabled. In this case, clipping coordinates are ignored and all output primitives are processed (even if they are completely outside the clipping region). In some applications, this is useful for retrieving plain 8-bit grayscale memory bitmap data via the DT_BMP structure.

Note 1

Rendering to Windows compatible Device Context does not support transparency and true alpha blending. If you wish to draw transparent text or shapes, you should use Memory Surfaces (DT_MDC) instead. For more information, see the dtOutputSetAsMDC function.

Note 2

Although Windows applications can render to a Windows compatible Device Context, it is best to avoid this rendering method. Rendering to Memory Surfaces (DT_MDC) is far superior and faster. In addition, rendering to Memory Surfaces is cross platform.

 

Index